Skip to main content

TEI

Overview

TEI is an XML-based standard for encoding literary and linguistic texts. It provides extremely rich document structure modeling (divisions, paragraphs, lines, speakers, stage directions), critical apparatus for manuscript traditions, metadata headers, and both inline and stand-off annotation. TEI is the dominant format in digital humanities and historical linguistics.

Type-by-Type Mapping

Document Structure

TEI ElementLayers EquivalentNotes
<TEI>pub.layers.expression.expression (record)Root document container. TEI's @xml:id maps to the record's AT-URI.
<teiHeader>pub.layers.expression.expression metadata fields + featuresTEI header metadata (fileDesc, encodingDesc, profileDesc, revisionDesc) maps to expression-level fields and features.
<text>pub.layers.expression.expression text fieldPrimary textual content.
<body>Implicit in pub.layers.expression.expression hierarchy via parentRefThe body structure is captured by the expression hierarchy: divisions, paragraphs, and sentences are nested expressions with parentRef chains. Tokenization is handled separately via pub.layers.segmentation.segmentation.
<div> (division)pub.layers.expression.expression (kind: section)Nested divisions map to sections with kind discriminating division types (chapter, part, act, scene, etc.). TEI's nested <div> structure is flattened into sections with parent-child relationships tracked via features or section ordering.
<p> (paragraph)pub.layers.expression.expression (kind: paragraph)Paragraph-level sections.
<s> (sentence)pub.layers.expression.expression (kind: sentence)Sentence segmentation.
<w> (word)pub.layers.expression.expression (kind: word)Word-level tokenization. TEI's @lemma, @pos, @msd attributes map to separate annotation layers.
<c> (character)pub.layers.expression.expression (kind: character)Character-level tokenization.
<pc> (punctuation)pub.layers.expression.expression (kind: word) with feature isPunctuation=truePunctuation characters as tokens.

Speaker and Dialogue

TEI ElementLayers EquivalentNotes
<sp> (speech)pub.layers.expression.expression (kind: turn) with speaker via features or an annotation layer (subkind speaker)Dialogue turns with speaker identification.
<speaker>pub.layers.expression.expression features entry, or annotationLayer(kind="span", subkind="speaker")Speaker identifier.
<stage> (stage direction)pub.layers.expression.expression with kind set via kindUri (e.g., "stage-direction")Stage directions as community-defined section kinds.
<lg> (line group)pub.layers.expression.expression with kind set via kindUri (e.g., "stanza")Poetic stanzas.
<l> (verse line)pub.layers.expression.expression with kind set via kindUri (e.g., "verse-line")Individual verse lines.

Linguistic Annotation

TEI ElementLayers EquivalentNotes
<w @lemma>annotationLayer(kind="token-tag", subkind="lemma")Lemmatization.
<w @pos>annotationLayer(kind="token-tag", subkind="pos")POS tagging.
<w @msd>annotationLayer(kind="token-tag", subkind="morph")Morphosyntactic description.
<phr> (phrase)annotationLayer(kind="span") with appropriate subkindPhrase-level annotation.
<cl> (clause)annotationLayer(kind="span", subkind="discourse-unit")Clause annotation.
<name> / <persName> / <placeName> / <orgName>annotationLayer(kind="span", subkind="entity-mention")Named entity spans. TEI's entity type (persName vs placeName) maps to annotation.label.
<rs> (referring string)annotationLayer(kind="span", subkind="entity-mention")Referring expressions with @typeannotation.label.
<date> / <time>annotationLayer(kind="span", subkind="temporal-expression")Temporal expressions with @whenannotation.value (normalized form).

Critical Apparatus and Manuscript Traditions

TEI ElementLayers EquivalentNotes
<app> (apparatus entry)annotationLayer(kind="span") with subkind via subkindUri (e.g., "apparatus-entry")Variant readings. Each <rdg> (reading) is an annotation with the variant text in value and witness in features.
<rdg> (reading)pub.layers.annotation.defs#annotationIndividual manuscript readings. @wit (witness sigla) → features.
<lem> (lemma/preferred reading)annotation with feature isLemma=trueThe preferred reading among variants.
<note> (editorial note)annotationLayer(kind="span", subkind="comment")Notes and commentary.
<gap> / <unclear> / <supplied>annotationLayer(kind="span") with custom subkindTranscription uncertainty markers.
<choice> / <sic> / <corr>annotationLayer(kind="span", subkind="error") + annotationLayer(kind="span", subkind="correction") with parentLayerRefError/correction pairs linked by parentLayerRef.
<abbr> / <expan>Similar error/correction patternAbbreviation/expansion pairs.

Metadata and Bibliography

TEI ElementLayers EquivalentNotes
<fileDesc>pub.layers.expression.expression fields + featuresFile description metadata.
<sourceDesc>pub.layers.expression.sourceUrl + sourceRefSource document references.
<bibl> / <biblStruct>pub.layers.eprint.eprint with citation (pub.layers.eprint.defs#citation)Bibliographic references link to eprint records. The structured fields of <biblStruct> (<author>, <title>, <imprint>, <biblScope>) populate the CSL-JSON/DataCite citation (creators, title, container/publisher, volume/issue/page); <idno type="DOI"> maps to citation.doi and to the eprint's eprintIdentifier. See CSL-JSON, BibTeX, and DataCite.
<availability> / <licence>pub.layers.defs#licensing (and pub.layers.defs#licenseRef)Licensing and access terms. <licence target="..."> maps to licenseRef.url; an SPDX-identifiable license maps to licenseRef.spdx; multiple licenses (or component-scoped terms) use the SPDX licensing.expression. Applied where an artifact is released, e.g. the licensing field on pub.layers.corpus.corpus.
<respStmt>pub.layers.defs#annotationMetadataResponsibility statements map to annotation metadata.
<encodingDesc>pub.layers.ontology.ontology + annotation layer metadataEncoding description (tagset declarations, etc.) maps to ontology definitions.
<taxonomy> / <category>pub.layers.ontology.typeDef hierarchyClassification taxonomies.
<particDesc> / <person>pub.layers.persona.persona or featuresParticipant descriptions in spoken text corpora.

Stand-Off Annotation (TEI)

TEI supports stand-off annotation via @xml:id references and <spanGrp>/<span> elements, which map directly to Layers's stand-off architecture:

TEI Stand-Off ElementLayers EquivalentNotes
<spanGrp>pub.layers.annotation.annotationLayerGroup of stand-off spans.
<span @from @to>pub.layers.annotation.defs#annotation with anchor.textSpanStand-off span with character offsets.
<link> / <linkGrp>pub.layers.graph.graphEdgeTyped links between elements.
<interp> / <interpGrp>pub.layers.annotation.annotationLayerInterpretive annotation groups.