重叠标记
Overlapping Markup

原始链接: https://en.wikipedia.org/wiki/Overlapping_markup

## 数字文本中的标记重叠:一个持续存在的挑战 标记重叠是指当文档拥有多种非层级结构——例如诗歌韵律与语言句法结构并存——使其无法表示为传统的树形图时发生的情况。自1988年以来,这种“重叠”已被公认为一个重要问题,但解决它的难度远超最初预期,至今仍是标记技术人员的关键议题。 这一挑战源于文本编码中占主导地位的“内容对象有序层级”(OHCO)范式。已经提出了各种方法,包括使用多个文档、层级结构中的里程碑,或“脱离式”标记,即注释独立于文本本身存在。最近,利用RDF的基于图的形式化方法逐渐受到重视。 尽管有这些解决方案,但普遍接受的标准仍然难以捉摸。诸如神学文本分析等专业领域继续依赖定制标记语言,因为在可互操作的格式(如更广泛的数字人文领域使用的格式)中表示重叠具有困难。虽然脱离式标记和基于图的方法目前受到青睐,但验证和实际实施仍然存在问题,推动着持续的研究和开发。

一个黑客新闻的讨论强调 SGML CONCUR 是一种独特的解决方案,用于处理重叠标记——文本可以同时使用不同的标签标记。与其它方法不同,CONCUR 可以在文本编辑器中直接使用。 用户“tannhaeuser”指出维基百科的文章正确地说明了它不常用的特性,但强调了它优于其它方案。SGML CONCUR 的一个关键特性是它要求在结束标签中指定元素名称(例如 ``),这在严格嵌套的标记(如 XML)中是冗余的。 有趣的是,SGML 甚至允许使用通用的结束标签 ``,但这个特性并没有被 XML 采用。本质上,CONCUR 解释了*为什么* SGML 中的结束标签需要明确,这通常是一个被忽略的细节。
相关文章

原文

Non-hierarchical interaction of overlapping document markup entities

In markup languages and the digital humanities, overlap occurs when a document has two or more structures that interact in a non-hierarchical manner. A document with overlapping markup cannot be represented as a tree. This is also known as concurrent markup. Overlap happens, for instance, in poetry, where there may be a metrical structure of feet and lines; a linguistic structure of sentences and quotations; and a physical structure of volumes and pages and editorial annotations.

The structural differences between multiple editions of Frankenstein have been analysed with overlapping techniques.

The problem of non-hierarchical structures in documents has been recognised since 1988; resolving it against the dominant paradigm of text as a single hierarchy (an ordered hierarchy of content objects or OHCO) was initially thought to be merely a technical issue, but has, in fact, proven much more difficult.[4] In 2008, Jeni Tennison identified markup overlap as "the main remaining problem area for markup technologists". Markup overlap continues to be a primary issue in the digital study of theological texts in 2019, and is a major reason for the field retaining specialised markup formats—the Open Scripture Information Standard and the Theological Markup Language—rather than the inter-operable Text Encoding Initiative-based formats common to the rest of the digital humanities.

Properties and types

[edit]

A distinction exists between schemes that allow non-contiguous overlap, and those that allow only contiguous overlap. Often, 'markup overlap' strictly means the latter. Contiguous overlap can always be represented as a linear document with milestones (typically co-indexed start- and end-markers), without the need for fragmenting a (logical) component into multiple physical ones. Non-contiguous overlap may require document fragmentation. Another distinction in overlapping markup schemes is whether elements can overlap with other elements of the same kind (self-overlap).

A scheme may have a privileged hierarchy. Some XML-based schemes, for example, represent one hierarchy directly in the XML document tree, and represent other, overlapping, structures by another means; these are said to be non-privileged.

Schmidt (2012) identifies a tripartite classification of instances of overlap: 1. "Variation of content and structure", 2. "Overlay of multiple perspectives or markup sets", and 3. "Overlap of individual start and end tags within a single markup perspective"; additionally, some apparent instances of overlap are in fact schema definition problems, which can be resolved hierarchically. He contends that type 1 is best resolved by a system of multiple documents external to the markup, but types 2 and 3 require dealing with internally.

Approaches and implementations

[edit]

DeRose (2004, Evaluation criteria) identifies several criteria for judging solutions to the overlap problem:

  • readability and maintainability,
  • tool support and compatibility with XML,
  • possible validation schemes, and
  • ease of processing.

Tag soup is, strictly speaking, not overlapping markup—it is malformed HTML, which is a non-overlapping language, and may be ill-defined. Some web browsers attempted to represent overlapping start and end tags with non-hierarchical Document Object Models (DOM), but this was not standardised across all browsers and was incompatible with the innately hierarchical nature of the DOM. HTML5 defines how processors should deal with such mis-nested markup in the HTML syntax and turn it into a single hierarchy.[9] With XHTML and SGML-based HTML, however, mis-nested markup is a strict error and makes processing by standards-compliant systems impossible. The HTML standard defines a paragraph concept which can cause overlap with other elements and can be non-contiguous.

SGML, which early versions of HTML were based on, has a feature called CONCUR that allows multiple independent hierarchies to co-exist without privileging any. DTD validation is only defined for each individual hierarchy with CONCUR. Validation across hierarchies is not defined by the standard. CONCUR cannot support self-overlap, and it interacts poorly with some of SGML's abbreviatory features. This feature has been poorly supported by tools and has seen very little actual use; using CONCUR to represent document overlap was not a recommended use case, according to a commentary by the standard's editor.

Within hierarchical languages

[edit]

There are several approaches to representing overlap in a non-overlapping language. The Text Encoding Initiative, as an XML-based markup scheme, cannot directly represent overlapping markup. All four of the below approaches are suggested. The Open Scripture Information Standard is another XML-based scheme, designed to mark up the Bible. It uses empty milestone elements to encode non-privileged components.

To illustrate these approaches, marking up the sentences and lines of a fragment of Richard III by William Shakespeare will be used as a running example. Where there is a privileged hierarchy, the lines will be used.

Multiple documents can each provide different internally consistent hierarchies. The advantage of this approach is that each document is simple and can be processed with existing tools, but requires maintenance of redundant content and it can be difficult to cross-reference between different views. With multiple documents, the overlap can be analysed with data comparison and delta encoding techniques, and, in an XML context, specific XML tree differencing algorithms are available.

Schmidt (2012, 3.5 Variation) recommends this approach for encoding multiple variants of a single text and to accept the duplication of the parts which do not vary, rather than attempting to create a structure that represents all of the variation present; further, he suggests that this alignment be performed automatically, and that misalignment is rare in practice.

Example, with lines marked up:

  <line>I, by attorney, bless thee from thy mother,</line>
  <line>Who prays continually for Richmond's good.</line>
  <line>So much for that.—The silent hours steal on,</line>
  <line>And flaky darkness breaks within the east.</line>

With sentences marked up:

  <sentence>I, by attorney, bless thee from thy mother,
  Who prays continually for Richmond's good.</sentence>
  <sentence>So much for that.</sentence><sentence>—The silent hours steal on,
  And flaky darkness breaks within the east.</sentence>

Milestones are empty elements that mark the beginning and end of a component, typically using the XML ID mechanism to indicate which "begin" element goes with which "end" element. Milestones can be used to embed a non-privileged structure within a hierarchical language, In their basic form they can only represent contiguous overlap. Generic XML can of course parse the milestone elements, but do not understand their special meaning and so cannot easily process or validate the non-privileged structure.

Milestone have the advantage that the markup for overlapping elements is located right at the relevant boundaries, like other markup. This is an advantage for maintainability and readability. CLIX (DeRose 2004) is an example of such an approach.

Example:

  <line><sentence-start />I, by attorney, bless thee from thy mother,</line>
  <line>Who prays continually for Richmond's good.<sentence-end /></line>
  <line><sentence-start />So much for that.<sentence-end /><sentence-start />—The silent hours steal on,</line>
  <line>And flaky darkness breaks within the east.<sentence-end /></line>

Punctuation and spaces have been identified as a type of milestone-style 'crypto-overlap' or 'pseudo-markup', as the boundaries of words, clauses, sentences and the like do not necessarily align with the formal markup boundaries hierarchically.

It is also possible to use more complex milestones to represent non-contiguous structures. For example, TAGML's "suspend" and "resume" semantic can be expressed using milestones, for example by adding an attribute to indicate whether each milestone represents a start, suspend, resume, or end point. Re-ordering and even self-overlap can be achieved similarly, by annotating each milestone with a "next chunk" reference.

Joins are pointers within a privileged hierarchy to other components of the privileged hierarchy, which may be used to reconstruct a non-privileged component akin to following a linked list. A single non-privileged element is segmented into several partial elements within the privileged hierarchy; the partial elements themselves do not represent a single unit in the non-privileged hierarchy, which can be misleading and make processing difficult.[27] While this approach can support some discontiguous structures, it is not able to re-order elements. A slightly different approach can, however, express re-ordering by expressing the join away from the content, at the cost of directness and maintainability.

Join-based representations can introduce the possibility of cycles between elements; detecting and rejecting these adds complexity to implementations.

Example:

  <line><sentence id="a">I, by attorney, bless thee from thy mother,</sentence></line>
  <line><sentence continues="a">Who prays continually for Richmond's good.</sentence></line>
  <line><sentence id="b">So much for that.</sentence><sentence id="c">—The silent hours steal on,</sentence></line>
  <line><sentence continues="c">And flaky darkness breaks within the east.</sentence></line>

Stand-off markup is similar to using joins, except that there may be no privileged hierarchy: each part of the document is given a label (or might be referred to by an offset), and the document structure is expressed by pointing to the content from markup that 'stands off' from the content (possibly in an entirely different file), and might contain no content itself. The TEI guidelines identify the unity of the elements as a primary advantage of stand-off markup over joins, in addition to the ability to produce and distribute annotations separately from the text, possibly even by different authors applying markup to a read-only document,[32] allowing collaborative approaches to markup by a divide and conquer strategy.

Example:

  <span id="a">I, by attorney, bless thee from thy mother,</span>
  <span id="b">Who prays continually for Richmond's good.</span>
  <span id="c">So much for that.</span><span id="d">—The silent hours steal on,</span>
  <span id="e">And flaky darkness breaks within the east.</span>
  ...
  <line contents="a" />
  <line contents="b" />
  <line contents="c d" />
  <line contents="e" />
  <sentence contents="a b" />
  <sentence contents="c" />
  <sentence contents="d e" />

It has been claimed that separating markup and text can result in overall simplification and increased maintainability, and by 2017, "[t]he current state of the art to [represent] (...) linguistically annotated data is to use a graph-based representation serialized as standoff XML as a pivot format", i.e., that standoff was the most widely accepted approach to address the overlapping markup challenge.

Standoff formalisms have been the basis for an ISO standard for linguistic annotation,[36] they have been successfully applied for developing corpus management systems, and (as of April 2020) they are actively being developed in the TEI.[38] One published example of a successful stand-off annotation scheme was developed as part of a bitext natural language documentation project focused on the preservation of low-resource or endangered languages.[39]

Representing overlapping markup within hierarchical languages is challenging, for reasons of redundancy and/or complexity. In the 2000s to 2010s, standoff formalisms were generally accepted as the most promising approach here, but a disadvantage of standoff is that validation is very challenging.[40] Standoff formalisms are not natively supported by database management systems, so that (by 2017) it was suggested to "use ... standoff XML as a pivot format (...) and relational data bases for querying." In practical applications, this requires complicated architectures and/or labor-intense transformation between pivot format and internal representation. As a result, maintenance is problematic.[41] This has been a motivation to develop corpus management systems on the basis of graph data bases and for using established graph-based formalisms as pivot formats.

Special-purpose languages

[edit]

For implementing the above-mentioned strategies, either existing markup languages (such as the TEI) can be extended or special-purpose languages can be designed.

Historical formalisms

[edit]
  • LMNL is a non-hierarchical markup language first described in 2002 by Jeni Tennison and Wendell Piez, annotating ranges of a document with properties and allowing self-overlap. CLIX, which originally stood for 'Canonical LMNL In XML', provides a method for representing any LMNL document in a milestone-style XML document.[42] It also has another XML serialisation, xLMNL.
  • MECS was developed by the University of Bergen's Wittgenstein Archive. However, it had several problems: it allowed some non-sensical documents of overlapping elements, it could not support self-overlap, and it did not have the capacity to define a DTD-like grammar. The theory of General Ordered-Descendant Directed Acyclic Graphs (GODDAGs), while not strictly a markup language itself, is a general data model for non-hierarchical markup. Restricted GODDAGs were designed specifically to match the semantics of MECS; general GODDAGs may be non-contiguous and need a more powerful language. TexMECS is a successor to MECS, which has a formal grammar and is designed to represent every GODDAG and nothing that is not a GODDAG.
  • XCONCUR (previously MuLaX) is a melding-together of XML and SGML's CONCUR, and also contains a validation language, XCONCUR-CL, and a SAX-like API.
  • Marinelli, Vitali and Zacchiroli provide algorithms to convert between restricted GODDAGs, ECLIX, LMNL, parallel documents in XML, contiguous stand-off markup and TexMECS.

None of these formalisms seem to be maintained anymore. Consensus community seems to be to employ standoff XML or graph-based formalisms.

Actively maintained standoff XML languages

[edit]
  • GrAF-XML,[51] standoff-XML serialization of the Linguistic Annotation Framework (LAF),[36] used, e.g., for the American National Corpus[52]
  • PAULA-XML,[53] standoff-XML serialization of the data model underlying the corpus management system ANNIS and the converter suite SALT[54]
  • NAF (NLP Annotation Format / Newsreader Annotation Format),[55] standoff XML format originally developed in the NewsReader project (FP7, 2013-2015[56]), currently used by NLP tools such as FreeLing[57] (with support for English, Spanish, Portuguese, Italian, French, German, Russian, Catalan, Galician, Croatian, Slovene, etc.), and EusTagger[58] (with support for Basque, English, Spanish).
  • The Charles Harpur Critical Archive is encoded using 'multi-version documents' (MVD) to represent the variant versions of documents and as a means of indicating additions, deletions and revisions using a tactical combination of multiple documents and stand-off ranges within an underlying graph-based model. MVD is presented as an application file format, requiring specialised tools to view or edit.
  • A standoff XML scheme was developed by the Odin, Intent, and XigtEdit collaboration, which is focused on a large dataset of Interlinear Glossed Text (IGT) for supporting natural language resource and documentation projects.[39]

Standoff approaches have two parts, commonly called the "content" and the "annotations." These can be expressed in unrelated representations. Simple standoff annotations per se, involve no more than a list of (location, type) pairs. Thus, in a few applications[example needed] standoff annotations are expressed in CSV, JSON(-LD, or other representations. (e.g., Web Annotation[60]) or graph formalisms grounded in string URIs (see below). However, representing and validating content in such representations is much more difficult and much less common.

Graph-based formalisms

[edit]

Standoff markup employs a data model based on directed graphs, thus complicating its representation when grounding markup information in a tree. Representing overlapping hierarchies in a graph eliminates this challenge. Standoff annotations can thus be more adequately represented as generalised directed multigraphs and use formalisms and technologies developed for this purpose, most notably those based on the Resource Description Framework (RDF). EARMARK is an early RDF/OWL representation that encompasses General Ordered-Descendant Directed Acyclic Graphs (GODDAGs). The theory of GODDAGs, while not strictly a markup language itself, is a general data model for non-hierarchical markup.

RDF is a semantic data model that is linearization-independent, and it provides different linearisations, including an XML format (RDF/XML) that can be modeled to mirror standoff XML, a linearisation that lets RDF be expressed in XML attributes (RDFa), a JSON format (JSON-LD), and binary formats designed to facilitate querying or processing (RDF-HDT,[64] RDF-Thrift[65]). RDF is semantically equivalent to graph-based data models underlying standoff markup; it does not require special-purpose technology for storing, parsing and querying. Multiple interlinked RDF files representing a document or a corpus constitute an example of Linguistic Linked Open Data.

An established technique to link arbitrary graphs with an annotated document is to use URI fragment identifiers to refer to parts of a text and/or document, see overview under Web annotation. The Web Annotation standard provides format-specific 'selectors' as an additional means, e.g., offset-, string-match- or XPath-based selectors.[66]

Native RDF vocabularies capable to represent linguistic annotations include:[67]

  • Web Annotation[68]
  • NLP Interchange Format (NIF)[69]
  • LAPPS Interchange Format (LIF)[70]

Related vocabularies include

  • POWLA, an OWL2/DL serialization of PAULA-XML[71]
  • RDF-NAF, an RDF serialization of the NLP Annotation Format[72]

In early 2020, W3C Community Group LD4LT has launched an initiative to harmonize these vocabularies and to develop a consolidated RDF vocabulary for linguistic annotations on the web.[73]

  1. ^ Renear, Mylonas & Durand 1993.
  2. ^ HTML, § 8.2.8 An introduction to error handling and strange cases in the parser.
  3. ^ Text Encoding Initiative, § 20.3 Fragmentation and Reconstitution of Virtual Elements.
  4. ^ Text Encoding Initiative, § 20.4 Stand-off Markup.
  5. ^ a b "ISO 24612:2012". ISO.
  6. ^ "Standoff: Annotation microstructure · Issue #1745 · TEIC/TEI". GitHub.
  7. ^ a b Xia, F., Lewis, W.D., Goodman, M.W. et al. Enriching a massively multilingual database of interlinear glossed text. Lang Resources & Evaluation 50, 321–349 (2016). https://doi.org/10.1007/s10579-015-9325-4
  8. ^ Sperberg-McQueen & Huitfeldt 2000, 2.6. Standoff Markup. sfn error: no target: CITEREFSperberg-McQueenHuitfeldt2000 (help)
  9. ^ DeRose 2004, Standoff markup.
  10. ^ DeRose 2004, CLIX and LMNL.
  11. ^ "ISO GrAF". 7 March 2015.
  12. ^ "Home". anc.org.
  13. ^ "PAULA XML: Interchange Format for Linguistic Annotations". Archived from the original on 2020-08-17.
  14. ^ Zipser, Florian (2016-11-18). "Salt". corpus-tools.org. doi:10.5281/zenodo.17557. Retrieved 2022-09-11.
  15. ^ "NAF". GitHub. 30 June 2021.
  16. ^ "Building structured event indexes of large volumes of financial and economic data for decision making". Community Research and Development Information Service (CORDIS).
  17. ^ "Home - FreeLing Home Page". Archived from the original on 2012-04-29. Retrieved 2020-04-06.
  18. ^ "Text Analysis | HiTZ Zentroa".
  19. ^ "Web Annotation Data Model". 23 February 2017.
  20. ^ "Home". rdfhdt.org.
  21. ^ "RDF Binary using Apache Thrift". afs.github.io.
  22. ^ "Selectors and States". 23 February 2017.
  23. ^ Cimiano, Philipp; Chiarcos, Christian; McCrae, John P.; Gracia, Jorge (2020). Linguistic Linked Data. Representation, Generation and Applications. Cham: Springer.
  24. ^ Verspoor, Karin; Livingston, Kevin (2012). "Towards Adaptation of Linguistic Annotations to Scholarly Annotation Formalisms on the Semantic Web". Proceedings of the Sixth Linguistic Annotation Workshop, Jeju, Republic of Korea: 75–84. Retrieved 6 April 2020.
  25. ^ "NLP Interchange Format (NIF) 2.0 - Overview and Documentation".
  26. ^ "LIF Overview".
  27. ^ "POWLA". January 2022.
  28. ^ "NLP Annotation Format | Background information on NAF".
  29. ^ "Towards a consolidated LOD vocabulary for linguistic annotations". GitHub. 7 September 2021.
联系我们 contact @ memedata.com