Dependency Syntax and Universal Dependencies

Michael BrenndoerferMay 5, 202552 min read

Learn how dependency syntax and Universal Dependencies represent grammatical relations as head-dependent arcs, with projectivity and CoNLL-U tree validation.

Language AI HandbookAll chapters
Part 7 of 67Linguistic Form: Morphology and Syntax
Chapter 47Dependency Syntax and Universal Dependencies
Reading the full chapter · 13 sections · 52 min13 sections · 52 min

All 13 sections · 52 min read

Dependency Syntax and Universal DependenciesFull chapter · Sections in this chapter1 / 13 ↓
Reading tools Definitions, links & notes

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Notes & comments

Dependency Syntax and Universal Dependencies

Changing dog bites man to man bites dog changes the subject and object even though the words stay the same. Part-of-speech tags identify word categories, and morphological features describe properties such as number and tense. Neither layer by itself records which noun is the subject of bites. A dependency analysis makes that grammatical relationship explicit.

Syntax is the level of linguistic representation that connects word-level information to sentence-level meaning. A tagger can tell you that a token is a verb, and a morphological analyzer can tell you that it is past tense and third-person singular, but neither tells you that the verb is the main predicate of the clause, that a particular noun is its subject, or that another noun is its direct object. Those relational facts identify grammatical roles and attachments. They can support an interpretation of who acted or what was given to whom, but a syntactic subject is not always an agent, and syntax alone does not recover the full event meaning. This chapter is about a representation that makes the grammatical relations explicit.

In the previous chapter we met one representation of syntax: constituency trees. Words group into phrases (NP, VP, S), and phrases nest inside larger phrases. Context-free grammars describe this kind of phrase structure. But it is not the only option. This chapter is about a competing representation, dependency syntax, in which every word is a node and every grammatical relation is a directed edge from a head to a dependent.

The dependency view asks which word is the head of each other word. In She gave him a book., the verb gave has four direct dependents: She (nsubj), him (iobj), book (obj), and the period (punct). The determiner a depends on book. Reordering the words can leave these grammatical relations unchanged, though information structure and annotation conventions still matter. Dependency representation separates attachment from linear position without assuming that every reordering preserves the same analysis.

Dependency trees are the backbone of Universal Dependencies (UD), a community project for cross-linguistically consistent morphological and syntactic annotation. Its common inventories and CoNLL-U format support comparisons across treebanks, while language-specific guidelines and extensions preserve distinctions that a single universal label cannot settle. A shared label inventory helps make analyses comparable; it does not make different languages or annotation decisions identical. UD's introduction describes that balance.

The rest of the chapter builds up the representation from first principles. We define what a dependency tree is, what makes a word a head, what projectivity means, and how labels encode grammatical roles. Then we look at UD itself: its design choices, word-level annotations, and its data format. Finally we read a bounded CoNLL-U sample, check its basic-tree constraints, draw two of its trees, and test projectivity. These checks make the representation precise enough to use in a later parsing or extraction workflow.

From Constituency to Dependency

A constituency tree groups words into nested phrases. For She gave him a book a small phrase-structure grammar might derive a sentence node S with two children, an NP and a VP. The NP contains the single word She. The VP contains a verb V, which contains gave, and two noun phrases. The first noun phrase contains him, and the second contains a book. Internal nodes include phrase categories (S, NP, VP) and a preterminal word category (V); leaves are words. The structure asserts that him and a book are separate noun phrases, that gave him a book is a verb phrase, and that the whole thing is a sentence.

The grouping records grammatical units. The constituency tree says that gave him a book behaves as a unit, that him and a book are two distinct noun phrases, and that She is outside the verb phrase. Those claims matter for agreement, movement, coordination, and any grammatical process that refers to phrases rather than individual words. Constituency trees also have the advantage of being directly compatible with context-free grammars, which come with a mature parsing toolkit.

Constituency has a long tradition in English annotation, including the Penn Treebank. Ordinary context-free grammars (CFGs) directly describe continuous phrase structure. They support a rich parsing toolkit, including Earley and CYK algorithms and probabilistic grammars.

But constituency analyses have drawbacks for cross-linguistic work and for downstream NLP:

  • Phrase structure depends on the theory. Different theories can analyze the big dog as NP or DP, changing its internal structure and head choice.
  • Flexible word order requires an ordering account. A constituency analysis must specify how it represents material that does not form one continuous surface span. Movement is one option; discontinuous constituents and separate ordering constraints are others. Flexible order does not by itself rule out constituency analysis.
  • Long-distance relations require an explicit account. In Who do you think she saw? the object of saw appears at the front. Constituency frameworks may represent this relation with empty categories, nonlocal features such as SLASH, or other mechanisms.
  • An application may need direct relations. Dependency paths can be useful for relation extraction. Semantic role labeling and coreference may also require phrase spans, semantic roles, or discourse context; their needs do not reduce to finding subjects.

These representation choices matter when selecting an analysis for multilingual or application-oriented work. A parser that has to decide whether a phrase is an NP or a DP must commit to a theoretical choice that may not transfer well across languages or annotation projects. A parser that records a subject relation can avoid that projection choice: it says that this noun is the subject of that verb.

Dependency syntax gives a compact way to record head-dependent relations directly. In a basic tree with nn syntactic words, there are nn word nodes and n−1n-1 word-to-word arcs; including the artificial root adds one node and one arc. Phrase-category nodes are absent. This does not eliminate linguistic theory choices or make discontinuous constructions trivial, but it makes a chosen attachment, such as the iobj relation from gave to him, explicit.

The representations retain different information. A dependency subtree rooted at book can identify the words a book, so dependency trees do preserve some groupings. They do not explicitly store all phrase categories and intermediate projections from a constituency tree. Recovering a constituency analysis requires additional conventions; converting a constituency tree into dependencies likewise requires head-selection rules. The appropriate representation depends on the task and its annotation requirements.

The two representations emphasize different information:

  • Constituency is optimized for grouping: it tells you which words form phrases and how those phrases nest.
  • Dependency is optimized for linking: it tells you which word is the syntactic governor of which other word and what role the dependent plays.

Many sentences can be represented either way, but the representations are not informationally identical, and converting between them requires making decisions that one representation leaves implicit.

The Dependency Tree

A dependency structure is a labelled directed graph over the syntactic words of a sentence. Here we first define the basic-tree representation. Enhanced UD graphs, introduced later, need not be trees. The axioms are not arbitrary formalities. They are the conditions that guarantee the structure can be read as a hierarchy of heads and dependents, with no word belonging to two places at once and no word floating outside the sentence.

Nodes and Arcs

The nodes here are syntactic words, not necessarily whitespace-delimited strings or language-model subword pieces. UD can split an orthographic contraction into multiple syntactic words. It records inflectional morphology on the word rather than creating a node for every morpheme. The code below uses the name tokens for lists of syntactic-word records; it does not apply an LLM tokenizer. UD word segmentation defines that boundary.

Given a sentence with syntactic words w1,…,wnw_1, \ldots, w_n, a dependency tree is a set of arcs

A⊆{(h,d,ℓ):h∈{0,1,…,n}, d∈{1,…,n}, h≠d, ℓ∈L}A \subseteq \{ (h, d, \ell) : h \in \{0, 1, \ldots, n\},\ d \in \{1, \ldots, n\},\ h \neq d,\ \ell \in \mathcal{L} \}

where L\mathcal{L} is a finite label set. The special index 00 denotes the artificial root, a virtual node that sits above the sentence and has no word of its own. Every token wdw_d has exactly one incoming arc, called its head arc: hh is the head and dd is the dependent.

The arc labels come from a closed vocabulary. In UD the core set has 37 universal relations, with language-specific subtypes permitted. A shared vocabulary supplies targets for supervised label learning and direct comparison. Unrelated one-off labels would require an additional mapping before they could serve those purposes. An inventory gives annotators shared categories; applying them consistently also requires definitions and construction-specific guidance.

The Single-Head Axiom

For every word d∈{1,…,n}d \in \{1, \ldots, n\}, there must be exactly one incoming labelled arc (h,d,ℓ)∈A(h,d,\ell) \in A, counting the head and label together. This is the single-head axiom, and it is a necessary condition for a basic dependency tree. It does not by itself exclude cycles or guarantee a single root.

The axiom rules out multi-parent structures in the basic tree. In She wants to leave, for example, She is the subject of wants in that tree, while an enhanced graph can also relate it to leave as an externally supplied subject. We will meet this enhanced dependency layer later. An ordinary fronted wh-object is different: in Who did you see?, Who can already be the obj dependent of see in the single-headed basic tree. No additional filler-to-specifier arc is part of that UD analysis. The basic tree gives parsers a well-defined object to predict and evaluators a well-defined object to score.

Single-Head Axiom

Every syntactic word has one incoming arc in the representation that includes artificial node 0. Exactly one word has head 0; this is the sentence root. If the artificial node and its arc are omitted from a drawing, that word appears to have no parent.

The Root

Exactly one token has head 00. Call it the root drd_r. The sentence root is typically its main predicate, which may be verbal or nonverbal. Ellipsis and fragments need construction-specific choices, including promotion when a predicate is missing.

Root selection is not always obvious. In She is a doctor the root is doctor (a predicate nominal), not is, because UD treats the copula as a dependent (cop). In Who came? the root is came even though who is prominent. In Hello! the root is Hello. Root selection affects the structural targets used for parser training. For two analyses of the same sentence with different roots, every root-to-leaf path begins with a different word; the remaining attachments need not all change. A parser trained under different root conventions may learn different structural priors.

The root also serves as the anchor for connectivity. Once the root is fixed, every other word must be reachable from it along head-to-dependent arcs. That requirement is what turns a collection of local head decisions into a single connected structure.

Acyclicity and Connectivity

Two more axioms ensure the structure really is a tree:

  • Acyclicity. No token is its own ancestor. Following head pointers from any token must terminate.
  • Connectivity. Every word is reachable from artificial node 0 by following head-to-dependent arcs. Equivalently, following parent pointers from any word eventually reaches 0.

Connectivity follows from single-head plus acyclicity plus a finite sentence: if you follow heads from any token you cannot loop forever, so you eventually hit artificial node 0, the only node without an incoming arc. This argument assumes that every head index is a valid word index or 0. The extra requirement that exactly one word has head 0 is UD's sentence-root convention.

It is worth seeing why these conditions matter in practice. Without acyclicity, a parser could produce a cycle such as a heads b, b heads c, and c heads a. Such a structure has no natural root and cannot be drawn as a hierarchy. Without connectivity, a token could be attached to a head that is not connected to the rest of the sentence, producing a forest rather than a tree. UD treebanks are required to be connected, so a validation check for connectivity is a useful sanity check on any parser output.

Basic Tree Constraints

These conditions specify the basic tree used here. Projectivity is an additional restriction on the relationship between tree structure and word order, not a requirement for all UD basic trees.

What Makes a Head?

The single-head axiom tells you that each token has exactly one head. It does not tell you which head. That is a linguistic question, and linguists have developed several tests. The tests are diagnostics rather than mathematical definitions. They can point toward a head, but they do not always agree, and when they disagree, an annotation project has to adopt a convention.

Tests for Headhood

Several diagnostics can motivate a head choice, but none replaces a stated annotation convention:

  • Distribution. A head often helps determine where the phrase can occur. The noun dog is central to the nominal expression the big dog. This is a diagnostic, not a proof that all theories must choose the same head.
  • Omission. Removing big leaves the dog, but removing dog does not preserve that same ordinary noun-phrase reading. Ellipsis and nominalized adjectives can license exceptions, as in the rich.
  • Selection and agreement. A predicate constrains its argument pattern, while agreement can reveal dependencies in languages that mark it. English big does not agree with dog in number, and him is an objective pronoun form rather than a distinct dative inflection.
  • Meaning. In big dog, the noun identifies the entity being described and the adjective contributes a property. A different construction can make semantic and syntactic headhood diverge, so meaning alone is not a universal head-selection algorithm.

Moving a whole phrase is evidence about constituency, rather than a test that uniquely identifies its head. In the rich are getting richer, UD treats rich as the head of the nominal expression and the as a determiner dependent. Such examples show why an annotation scheme must explain its conventions instead of treating head choice as self-evident.

UD's Content-Head Convention

UD separates word-level morphology from syntax and generally places content words at the center of dependency structures. Function words normally depend on the related content word; the guidelines include exceptions. This matters because many syntactic theories treat determiners, auxiliaries, and complementizers as heads of their own functional projections. UD does not. The lexicalist choice keeps the basic tree close to the words that carry the main lexical content, and it avoids introducing a large amount of abstract functional structure into every sentence.

In the examples below, UD uses the following head-dependent choices:

  • Determiners are dependents. In the dog, dog is head and the is a det dependent.
  • Auxiliaries are dependents. In she will go, go is head and will is an aux dependent.
  • Copulas are dependents. In she is a doctor, doctor is head and is is a cop dependent.
  • Adpositions are dependents. In the dog of the neighbor, of is a case dependent of neighbor.
  • Complementizers are dependents. In that she left surprised him, left is head of the embedded clause, and that is a mark dependent.

The rationale is cross-linguistic. A grammatical distinction expressed by an independent function word in one language may be expressed by inflection in another. Keeping content words as the syntactic backbone increases parallelism without inventing a dependency node for every suffix. Bound morphology remains a property of its word, such as Case=Ins; a separate adposition can appear as a case dependent. See the UD syntax principles and case guidance.

Content-Word Heads

The principle is simple: content words (nouns, verbs, adjectives, adverbs) carry the syntactic relations. Function words normally attach to the related content word. Fixed expressions, coordination of function words, modifiers, and head elision require additional rules; this principle is a default rather than an exceptionless constraint.

Projectivity

Not every tree can be drawn without crossing arcs. Projectivity is the geometric constraint that rules out crossers. It is a property of the tree relative to the surface order of the words, so it is sensitive to word order even though the dependency relations themselves may be stable across word order changes.

Crossing Arcs

Place the words of a valid basic tree on a horizontal line, with artificial node 0 to their left and its arc included. The tree is projective exactly when it admits an above-line drawing without crossing arcs. Here a crossing means strictly interleaved distinct endpoints, such as a<c<b<da<c<b<d for arcs joining aa to bb and cc to dd; shared endpoints are not crossings. Omitting the artificial-root arc can hide a violation, so the descendant test below is the safer definition.

Projectivity

An arc (h,d,ℓ)(h, d, \ell) with h≠0h \neq 0 is projective if for every token kk with min⁡(h,d)<k<max⁡(h,d)\min(h,d) < k < \max(h,d), token kk is a descendant of hh (equivalently, kk is in the subtree rooted at hh). A dependency tree is projective if all its arcs are projective.

In plain language: the arc from hh to dd is projective if every word between hh and dd is governed (directly or indirectly) by hh. If it spans a word outside hh's subtree, a crossing is unavoidable when the artificial-root arc is included. The test concerns the whole subtree, rather than just each intervening word's immediate head.

This definition is worth reading slowly, because it is easy to confuse projectivity with a simpler condition such as "the head and dependent are adjacent." Adjacency is not required. An arc can span many words and still be projective, as long as all of the words it spans belong to the head's subtree. What projectivity forbids is an arc that reaches over a word that is not under the head's control.

A Non-Projective Example

Consider the sentence:

I saw a dog yesterday which was a Yorkshire Terrier.

The relative clause which was a Yorkshire Terrier modifies dog. In UD, the root of the relative clause (Terrier, with which as its nsubj and was as its cop) attaches to dog as acl:relcl. That arc goes from token 4 (dog) to token 10 (Terrier), spanning tokens 5 through 9. Only token 5, yesterday, is outside the subtree rooted at dog: it depends on saw. Tokens 6 through 9 belong to the relative clause headed by Terrier, which is itself a dependent of dog. One outside word is enough to violate the condition. So the arc from dog to Terrier is non-projective.

The example adapts the non-projective sentence in McDonald and Pereira (2006), Figure 2, using I in place of John and supplying UD labels here. It illustrates extraposition rather than a corpus frequency. Its non-projectivity follows from this particular attachment and word order. Moving yesterday outside the span of the relative-clause attachment would remove this particular violation without changing the clause's head-dependent relation.

Projectivity Depends on the Analysis and Word Order

Non-projectivity can arise when a dependent is separated from its head by material outside that head's subtree. The extraposed relative clause above is one such analysis. Different languages, genres, word orders, and annotation conventions can yield different amounts of non-projectivity, so a rate should always name its treebank release, the included sentences, and whether the denominator is words, arcs, or sentences. The three hand-written analyses in this chapter demonstrate structural possibilities; they do not estimate a language's frequency.

Why Projectivity Matters

Projectivity restricts the trees that a parser is allowed to produce. A system restricted to projective outputs cannot recover our non-projective analysis exactly, even if its word representations are excellent. It must change at least one attachment. The next chapter studies how decoding algorithms enforce or relax this constraint.

The computational trade-off depends on the scoring model, rather than on a general rule that non-projective parsing is slower. Under an arc-factored score, a tree's score is the sum of its individual arc scores. Projective and unrestricted decoding then become different constrained optimization problems. For a fixed set of candidate trees, interactions among selected arcs change the score's factorization when their combined contribution cannot be reduced to individual arc scores plus a constant shared by all candidates. The effect on decoding depends on the interaction structure. We will keep those algorithms separate from the representation and annotation rules developed here.

Dependency Labels

A dependency tree without labels tells you which word governs which, but not how. The labels encode the grammatical role, and in UD they are drawn from a carefully standardized inventory. The head pointer gives the skeleton, and the label gives the edge its meaning. Without labels, a parser could recover the shape of the tree but not distinguish a subject from an object, or a determiner from an adjectival modifier.

Core Arguments

The relations in this group describe the subject and objects of a predicate:

  • nsubj: nominal subject. A syntactic relation rather than a semantic role: the subject can be an agent (She sleeps) or a patient (She was seen, with subtype nsubj:pass). Expletive it in It rains is instead labelled expl.
  • obj: object, a nominal core argument other than the subject. The label follows the language's syntactic analysis, rather than simply numbering semantic participants.
  • iobj: indirect object. A nominal core argument that is neither the subject nor the direct object. The recipient in She gave him a book is an example: him is iobj and book is obj. Recipient meaning alone does not determine this syntactic label across languages.
  • csubj: clausal subject. The subject is a clause, as in That she left surprised him.
  • ccomp: clausal complement. A core clausal argument, as in She said that he left. It can be finite or nonfinite; its subject is not obligatorily inherited in the manner required for xcomp.
  • xcomp: open clausal complement. A core predicative complement without its own subject, whose subject interpretation is necessarily supplied by an external argument, as in She wants to leave. Nonfiniteness alone does not determine the label.

The distinction is obligatory subject inheritance, not simply whether a subject word is visibly present. A ccomp can have an unexpressed subject whose interpretation is not fixed by an argument of the higher predicate. An xcomp requires that inherited interpretation. The ccomp and xcomp guidelines give contrasts that separate control from mere omission.

Function Words

UD treats function words as dependents. These relations record them:

  • aux: auxiliary. A function word expressing categories such as tense, aspect, mood, voice, or evidentiality. will in she will go is an English example; the universal relation also permits nonverbal markers.
  • cop: copula. is in she is a doctor.
  • mark: marker. Complementizers and subordinating conjunctions. that in that she left.
  • case: case marker. A case-marking element treated as a separate syntactic word, such as of in the neighbor of the man. A bound case suffix is recorded through morphology, not as its own case node.
  • det: determiner. the in the dog.
  • cc: coordinating conjunction. and in cats and dogs.
  • clf: classifier. Mandarin numeral classifiers provide examples; the presence of numeral classifiers in a language does not by itself determine their UD relation.
  • aux:pass: passive auxiliary, a subtype of aux used in passive constructions.

These labels are the direct consequence of UD's lexicalist convention. The function word is not discarded. It is attached to the content word with a label that records its grammatical contribution. That design keeps the content word as the head while still preserving the information that a determiner, auxiliary, or case marker was present.

Modifiers and Nominals

  • amod: adjectival modifier. big in big dog.
  • advmod: adverbial modifier. quickly in she ran quickly.
  • acl: adnominal clause. A clause modifying a noun. acl:relcl is the relative clause subtype.
  • appos: appositional modifier. my brother in John, my brother, arrived.
  • nmod: nominal modifier. A nominal dependent of another nominal, except when it modifies a predication. the neighbor's in the neighbor's dog (with nmod:poss in English).
  • nummod: numeric modifier. three in three dogs.
  • compound: compound. Yorkshire in Yorkshire Terrier.
  • flat: flat structure. Names and titles where no word clearly heads the others.
  • fixed: fixed multiword expression.

Several additional relations complete the examples in this chapter:

  • obl marks an oblique nominal, such as a temporal or locative phrase that is not a core object.
  • advcl marks an adverbial clause, such as when she arrived in she left when she arrived.
  • expl marks expletive or impersonal pronouns, such as the it in it rains.
  • discourse marks grammatically distinctive discourse elements, such as interjection well or filler um. An English connective adverb such as however instead receives advmod.
  • vocative marks a direct address like John in John, come here.
  • parataxis links juxtaposed units, often clauses, where the annotation does not use ordinary coordination or subordination. The precise construction must be checked against its guidelines.
  • punct marks punctuation.
  • root marks the sentence root.

These labels are part of the same inventory. A supervised parser trained to predict that full inventory needs targets for these relations alongside the argument labels.

Coordination

Coordination is one of the trickiest areas of UD annotation because the analysis depends on what is shared between conjuncts:

  • conj: a conjunct. In a flat coordination, the later conjuncts attach to the first conjunct with conj.
  • cc: a coordinating conjunction normally attaches to the conjunct it introduces, such as dogs in cats and dogs.
  • Shared dependents attach to the first conjunct in the basic representation. In They buy and sell books, books is obj of buy (the first conjunct), and the enhanced representation adds an obj arc from sell to books.

This convention can look surprising at first. A reader might expect the conjunction and to be the head of the coordination, or expect shared material to attach to the nearest conjunct. UD chooses the first conjunct as the structural anchor, which gives the basic tree a consistent shape. The enhanced layer then records the fact that the shared object also belongs semantically to the second conjunct.

Language-Specific Subtypes

UD allows subtypes of the universal relations where cross-linguistically relevant distinctions exist. Subtypes are written with a colon: nsubj:pass, obl:unmarked, obl:agent, nmod:poss, acl:relcl. All relations must be documented. Globally documented subtypes need no additional page; other subtypes require language-specific documentation and registration. Consult the treebank's documentation for the conventions it uses. The subtype system gives annotators a way to record finer distinctions without expanding the universal label set without limit.

These examples illustrate English subtypes:

  • nsubj:pass: passive subject. She in She was seen.
  • obl:unmarked: an adpositionless nominal oblique, as in yesterday in I saw her yesterday. In English UD, release 2.15 merged the older temporal subtype obl:tmod and non-temporal obl:npmod into this relation; older treebanks can retain those labels.
  • obl:agent: agentive oblique in a passive. by the doctor in She was seen by the doctor.
  • nmod:poss: possessive nominal modifier. John's in John's book.
  • acl:relcl: relative clause. which was a Yorkshire Terrier in the dog which was a Yorkshire Terrier.

A subtype refines a universal relation, but the scoring protocol determines how it is evaluated. Some protocols compare full strings; others remove subtypes before scoring. Do not infer the evaluation rule from the colon notation alone. The parsing evaluation chapter examines that choice explicitly.

Universal Dependencies

Universal Dependencies provides a shared framework for cross-linguistic annotation. Its design principles and file format let you interpret a treebank using common categories, while its language-specific guidance records how those categories apply to particular constructions.

Here, "universal" refers to the shared annotation categories. UD does not claim that all languages have the same syntax. It aims to describe the syntax of different languages using comparable categories. Shared categories provide a basis for cross-lingual training and evaluation; consistent application and annotation coverage still matter.

A Shared Annotation Framework

UD combines treebanks with annotation guidelines and common inventories for parts of speech, morphological features, and dependency relations. This chapter uses the version 2 guidelines. The official introduction explains the project's goals, including multilingual parsing and language analysis. Counts of languages and treebanks change with releases and are not needed to understand the representation.

Cross-linguistic consistency is a design objective, not a claim that all languages share identical syntax. Language-specific documentation is part of using a treebank correctly. A relation called obj should be read together with the universal definition, the language's grammatical facts, and the treebank's annotation decisions.

Design Principles

The UD guidelines give annotators shared principles. The most important ones for understanding this representation are:

  • Typologically universal. UD aims to use the same relation name (nsubj, obj, amod) for the same grammatical function across languages, even when that function is expressed through different morphology. A separate adposition or case clitic can be a case dependent; a bound genitive suffix is represented in a word's features, not as a separate dependency node.
  • Shallow representation. UD annotates surface syntax, not deep structure. There is no movement, no traces, and no abstract empty categories in the basic layer. Enhanced dependencies can record additional relations that the basic tree leaves implicit.
  • Explicit annotation commitments. UD uses a dependency-based, lexicalist framework with stated head-selection and relation definitions. Comparable annotation requires applying those shared conventions.
  • Surface-oriented. The annotation reflects what is actually written or spoken, not what would be underlying. Disfluencies, typos, and unusual constructions are annotated as they appear.
  • Content-headed by default. Content words normally anchor the syntactic backbone and related function words depend on them. The exceptions described earlier remain part of the scheme.

The basic tree records word-level syntactic relations. The enhanced layer can add links for constructions such as control and ellipsis. An application still needs to decide whether those layers supply the information it requires.

The 17 Universal POS Tags

UD defines a closed set of 17 universal part-of-speech tags. Every treebank uses these tags for the UPOS column:

Universal POS categories used in the UPOS field, with illustrative word uses.
TagMeaningExample
ADJadjectivebig
ADPadpositionof, in
ADVadverbquickly
AUXauxiliarywill, is
CCONJcoordinating conjunctionand, or
DETdeterminerthe, a
INTJinterjectionhello
NOUNnoundog
NUMnumeralthree
PARTparticlenot, 's
PRONpronounshe, which
PROPNproper nounLondon
PUNCTpunctuation, , .
SCONJsubordinating conjunctionthat, if
SYMsymbol$, %
VERBverbgave
Xotherunanalyzed material, including foreign words whose POS cannot be analyzed

These tags are coarse by design. They are chosen so that the same tag applies across languages even when the morphology is radically different. The optional XPOS column holds a language- or treebank-specific tag, sometimes retained from a source annotation scheme. English treebanks may use Penn Treebank tags and German treebanks may use the Stuttgart-Tübingen Tagset; a treebank's documentation specifies its choice. XPOS is _ when unavailable. The two columns serve different purposes: UPOS supports cross-lingual comparison, while XPOS can preserve finer distinctions from a particular annotation scheme.

Morphological Features

UD also standardizes the FEATS column, which holds morphological features as key-value pairs. Features describe word-level morphology. Examples you will encounter include:

  • Nominal features: Case, Gender, Number, Person, Definite, PronType, Animacy.
  • Verbal features: Tense, Aspect, Mood, Voice, VerbForm, Polarity, Evident.

A typical English noun might carry Number=Sing, while a German noun might carry Case=Acc|Gender=Masc|Number=Sing. The shared feature inventory makes these bundles easier to compare, while language-specific definitions and annotation coverage still matter.

The features make the word-level comparison more explicit. English dog and German Hund have identical nsubj relations in structurally parallel sentences, but the German noun may carry case information the English one lacks. A parser can use annotated features as inputs when its configuration supports them. However, a case value alone does not determine a dependency relation across languages, and no transfer-performance claim follows from these two illustrative bundles.

Enhanced Dependencies

The DEPS column can carry an optional enhanced dependency graph. Basic trees are obligatory in UD treebanks; enhanced annotation is not available in every treebank. The enhanced graph adds arcs that are absent from the basic tree because of control, ellipsis, relative clauses, and similar phenomena.

Some of the constructions the enhanced layer handles:

  • Relative clauses. In the dog which was a Terrier, the basic tree has acl:relcl from dog to the clause root, and which is nsubj inside the clause. In the detailed enhanced analysis, dog has a ref arc to which, and dog replaces which as the nsubj dependent of Terrier. This makes the antecedent's role inside the relative clause explicit.
  • Control and raising. In She wants to leave, the basic tree has leave as xcomp of wants. The current detailed enhanced guidelines add an arc from leave to She labelled nsubj:xsubj, marking an externally supplied subject. Older annotations and the general syntax overview may use bare nsubj, so check the treebank's convention.
  • Gapping. In She ate fish and he pasta, the basic tree connects the overt words using the ellipsis conventions. If the treebank supplies this enhancement, the enhanced graph can add an empty node for the elided predicate and its argument links.
  • Shared coordination arguments. An argument that depends on the first conjunct in the basic tree can receive an additional relation to another conjunct in the enhanced graph.

Enhanced dependencies can make useful interpretation links explicit, but they require additional annotation decisions. They may add edges, alter a basic relation, and introduce empty nodes for ellipsis. The result is not necessarily a tree or even a strict supergraph of the basic tree. Which enhancement types are supplied must be checked in the treebank documentation. The enhanced syntax guidelines describe these constructions.

The CoNLL-U Format

UD treebanks are distributed in a plain-text tabular format called CoNLL-U. The format is simple enough that you can read it with split('\t') and rich enough to carry lemma, part of speech, features, both layers of dependencies, and miscellaneous metadata.

The format is line-oriented. A sentence is a block of lines, and sentences are separated by blank lines. Comment lines begin with #, and word records contain exactly ten tab-separated fields. A text editor displays those rows directly; a complete reader must also handle the range rows, empty nodes, and field constraints described below.

A sentence may begin with comment lines (starting with #), followed by the word records and any multiword-token or empty-node records. Fields are separated by single tab characters and there are exactly ten fields, in this order:

The ten CoNLL-U fields in their required order.
ColumnNameDescription
1IDToken index. Consecutive integers starting at 1, or a range for multiword tokens, or a decimal like 4.1 for empty nodes.
2FORMWord form; the surface token form on a multiword-token row.
3LEMMABase form, or the underscore if not annotated.
4UPOSUniversal part-of-speech tag.
5XPOSLanguage-specific tag.
6FEATSMorphological features as Key=Value pairs, joined by |.
7HEADIndex of the token's syntactic head, or 0 for the root.
8DEPRELDependency relation from HEAD to this token.
9DEPSEnhanced dependencies in head:label|head:label form.
10MISCMiscellaneous annotations (spaces, transliterations, etc.).

Multiword tokens are handled with a range in ID (for example, 1-2 for a contraction like don't) followed by the component words on subsequent lines. Empty nodes used in enhanced annotation get IDs like 4.1. This chapter's executable sample uses only plain integer word IDs. Other treebanks may also contain range rows and decimal empty-node rows, which require separate handling.

A complete sentence looks like this:

# sent_id = 1 # text = They buy and sell books. 1 They they PRON PRP Case=Nom|Number=Plur 2 nsubj 2:nsubj|4:nsubj _ 2 buy buy VERB VBP Number=Plur 0 root 0:root _ 3 and and CCONJ CC _ 4 cc 4:cc _ 4 sell sell VERB VBP Number=Plur 2 conj 0:root|2:conj _ 5 books book NOUN NNS Number=Plur 2 obj 2:obj|4:obj SpaceAfter=No 6 . . PUNCT . _ 2 punct 2:punct _

Two things to notice. First, UD v2 requires the # sent_id and # text comments for every sentence. sent_id identifies the sentence uniquely within the treebank, and text records its surface form. Reconstructing that text requires respecting token ranges and spacing information such as SpaceAfter=No, rather than simply joining syntactic-word forms with spaces. Second, the underscore usually marks an unspecified value. It must not be treated as an ordinary dependency label or as an empty string. The format has a special ambiguity if a word form or lemma itself is a literal underscore.

The CoNLL-U specification is more detailed than a ten-column table: it also constrains record ordering, ranges, empty nodes, and field contents. Our reader below deliberately covers only the basic integer-ID records needed for the supplied examples.

Worked Example

Let us trace a small parse by hand, using simple but realistic UD conventions.

Sentence: She gave him a book.

Step 1: tokenize. Six tokens: She, gave, him, a, book, ..

Tokenization is already a syntactic decision, because the syntactic-word boundaries determine the nodes of the tree. Here each word is a separate token, and the period is its own punctuation token. Representing don't as do + n't while retaining the surface contraction uses a multiword-token range row in CoNLL-U. The worked sentence needs no such row.

Step 2: assign UPOS.

Universal POS tags for the six syntactic words in the worked sentence.
TokenUPOS
ShePRON
gaveVERB
himPRON
aDET
bookNOUN
.PUNCT

The POS and dependency layers are related by UD's annotation guidelines, but a tag does not determine every attachment. In this worked analysis, VERB marks the predicate head, DET marks the det dependent, and the PUNCT period receives punct. Other constructions can have different tag-relation combinations.

Step 3: identify heads.

  • She is the subject of gave. Head = 2.
  • gave is the main predicate. Head = 0 (root).
  • him is the indirect object of gave. Head = 2.
  • a modifies book. Head = 5.
  • book is the direct object of gave. Head = 2.
  • The period attaches to gave. Head = 2.

The key decision is that gave is the structural center of the sentence. It is the finite verb, it determines the argument structure, and it is the natural attachment point for the subject, the objects, and the punctuation. The determiner a attaches locally to book, not to the verb, because its role is to specify the noun phrase rather than to participate in the verbal argument structure.

Step 4: assign labels.

Basic dependency heads and labels for the worked ditransitive analysis.
TokenHeadLabel
She2nsubj
gave0root
him2iobj
a5det
book2obj
.2punct

The labels distinguish the two objects. him is the recipient and is labelled iobj, while book is the thing given and is labelled obj. That distinction is not visible from the head pointers alone, which is why the label layer is essential.

Step 5: check projectivity.

  • Arc 2→1: no tokens strictly between 1 and 2. Projective.
  • Arc 2→3: no tokens strictly between 2 and 3. Projective.
  • Arc 5→4: no tokens strictly between 4 and 5. Projective.
  • Arc 2→5: token 3 (him) is between 2 and 5, and him is a dependent of 2. Projective. Token 4 (a) is between 2 and 5 and is in the subtree of 5, which is in the subtree of 2. Projective.
  • Arc 2→6: tokens 3, 4, 5 are all dominated by 2. Projective.

The tree is projective. If we draw the tokens on a horizontal line, the arcs fan out from gave: an nsubj arc to She, an iobj arc to him, an obj arc to book, and a punct arc to the period. The only arc headed by a nonroot word is the det arc from book to a, and it sits entirely inside the span of the obj arc. The tree can be drawn above this fixed word order without crossings.

And note the contrast with the non-projective example:

Sentence: I saw a dog yesterday which was a Yorkshire Terrier.

The arc from dog (token 4) to Terrier (token 10) spans yesterday, which, was, a, and Yorkshire, of which yesterday is outside the subtree of dog. The tree is non-projective, so a parser restricted to projective outputs cannot recover this analysis exactly.

Both sentences illustrate the same representational idea: every token has one head and one label, and the whole structure is a tree. Projectivity adds a restriction on the relationship between attachment and word order. It determines which analyses a projective parser can output, rather than establishing a universal ranking of parsing difficulty.

Code: Analyzing a Dependency Treebank

The following cells load a CoNLL-U sample, validate the structural axioms, draw two example trees, and check projectivity. Each step turns an earlier definition into an executable check on supplied annotations. The cells do not infer a tree from raw text.

Setup

The examples use the book's scientific Python environment and a small standard-library reader. No corpus or pretrained model is downloaded. The reader preserves all ten CoNLL-U fields as text, except for the integer ID and HEAD values used by the tree computations. It supports this chapter's basic integer-ID word records only: it explicitly rejects range IDs and empty-node IDs. It is not a general CoNLL-U parser or validator.

Loading CoNLL-U

We define a small three-sentence treebank in the CoNLL-U format. It includes a coordination example, a ditransitive example, and the non-projective relative clause example from earlier. Building the sample by hand keeps the chapter self-contained and lets us focus on structure rather than download mechanics.

PythonIn [3]
CollapseExpand
CONLLU_SAMPLE = """
# sent_id = 1
# text = They buy and sell books.
1\tThey\tthey\tPRON\tPRP\tCase=Nom|Number=Plur\t2\tnsubj\t_\t_
2\tbuy\tbuy\tVERB\tVBP\tNumber=Plur\t0\troot\t_\t_
3\tand\tand\tCCONJ\tCC\t_\t4\tcc\t_\t_
4\tsell\tsell\tVERB\tVBP\tNumber=Plur\t2\tconj\t_\t_
5\tbooks\tbook\tNOUN\tNNS\tNumber=Plur\t2\tobj\t_\tSpaceAfter=No
6\t.\t.\tPUNCT\t.\t_\t2\tpunct\t_\t_

# sent_id = 2
# text = She gave him a book.
1\tShe\tshe\tPRON\tPRP\tCase=Nom|Gender=Fem|Number=Sing|Person=3|PronType=Prs\t2\tnsubj\t_\t_
2\tgave\tgive\tVERB\tVBD\tMood=Ind|Tense=Past|VerbForm=Fin\t0\troot\t_\t_
3\thim\the\tPRON\tPRP\tCase=Acc|Gender=Masc|Number=Sing|Person=3|PronType=Prs\t2\tiobj\t_\t_
4\ta\ta\tDET\tDT\tDefinite=Ind|PronType=Art\t5\tdet\t_\t_
5\tbook\tbook\tNOUN\tNN\tNumber=Sing\t2\tobj\t_\tSpaceAfter=No
6\t.\t.\tPUNCT\t.\t_\t2\tpunct\t_\t_

# sent_id = 3
# text = I saw a dog yesterday which was a Yorkshire Terrier.
1\tI\tI\tPRON\tPRP\tCase=Nom|Number=Sing|Person=1|PronType=Prs\t2\tnsubj\t_\t_
2\tsaw\tsee\tVERB\tVBD\tMood=Ind|Tense=Past|VerbForm=Fin\t0\troot\t_\t_
3\ta\ta\tDET\tDT\tDefinite=Ind|PronType=Art\t4\tdet\t_\t_
4\tdog\tdog\tNOUN\tNN\tNumber=Sing\t2\tobj\t_\t_
5\tyesterday\tyesterday\tNOUN\tNN\tNumber=Sing\t2\tobl:unmarked\t_\t_
6\twhich\twhich\tPRON\tWDT\tPronType=Rel\t10\tnsubj\t_\t_
7\twas\tbe\tAUX\tVBD\tMood=Ind|Number=Sing|Tense=Past|VerbForm=Fin\t10\tcop\t_\t_
8\ta\ta\tDET\tDT\tDefinite=Ind|PronType=Art\t10\tdet\t_\t_
9\tYorkshire\tYorkshire\tPROPN\tNNP\tNumber=Sing\t10\tcompound\t_\t_
10\tTerrier\tterrier\tNOUN\tNN\tNumber=Sing\t4\tacl:relcl\t_\tSpaceAfter=No
11\t.\t.\tPUNCT\t.\t_\t2\tpunct\t_\t_
"""

The executable sample supplies basic dependency annotations only; DEPS is unspecified. Enhanced coordination and relative-clause links were introduced above, but this reader neither infers them nor validates a complete enhanced graph. The breed-denoting head Terrier is treated as the common noun NOUN, with lemma terrier and Penn-style tag NN; its capitalization does not establish a proper name. Keeping the supplied linguistic choices separate from the graph checks makes their limits explicit.

We now read the three sentence blocks. Blank lines terminate sentences, comments are ignored for the tree computations, and every word row must have ten nonempty tab-separated fields. Morphological features and enhanced dependencies remain literal field strings; this reader does not interpret or validate their internal syntax.

PythonIn [4]
CollapseExpand
FIELDS = (
    "id",
    "form",
    "lemma",
    "upos",
    "xpos",
    "feats",
    "head",
    "deprel",
    "deps",
    "misc",
)


def read_basic_conllu(text):
    sentences, rows = [], []
    for line in text.splitlines() + [""]:
        if not line.strip():
            if rows:
                sentences.append(rows)
                rows = []
            continue
        if line.startswith("#"):
            continue
        values = line.split("\t")
        if len(values) != 10 or any(value == "" for value in values):
            raise ValueError("Expected ten nonempty tab-separated fields")
        row = dict(zip(FIELDS, values))
        if not row["id"].isdigit() or not row["head"].isdigit():
            raise ValueError(
                "This teaching reader supports integer word IDs and HEADs only"
            )
        row["id"], row["head"] = int(row["id"]), int(row["head"])
        rows.append(row)
    return sentences


parsed = read_basic_conllu(CONLLU_SAMPLE)

Let's inspect seven selected fields of the second sentence, She gave him a book, as a DataFrame. The reader also retains XPOS, FEATS, and MISC; this display concentrates on the words and their attachments.

ConsoleOut [5]
CollapseExpand
Loaded 3 sentences into CoNLL-U records
 ID FORM LEMMA  UPOS  HEAD DEPREL DEPS
  1  She   she  PRON     2  nsubj    _
  2 gave  give  VERB     0   root    _
  3  him    he  PRON     2   iobj    _
  4    a     a   DET     5    det    _
  5 book  book  NOUN     2    obj    _
  6    .     . PUNCT     2  punct    _

The output shows the seven selected CoNLL-U fields. HEAD is an integer index into the same sentence, not a word form. Word 3 (him) has HEAD 2, meaning gave is its head. The row stores that index rather than repeating the form gave. A program can resolve the index against the word records of the same sentence.

Structural Validation

The axioms of a dependency tree are simple enough to check programmatically. We build a directed graph with a virtual node 0 for the artificial root, add one edge from each head to its dependent, and then check the basic-tree constraints together with word IDs and root labels.

PythonIn [6]
CollapseExpand
def build_graph(tokens):
    G = nx.DiGraph()
    G.add_node(0)
    for t in tokens:
        G.add_node(t["id"])
    for t in tokens:
        G.add_edge(t["head"], t["id"])
    return G


def validate_tree(tokens):
    ids = [t["id"] for t in tokens]
    well_formed = ids == list(range(1, len(tokens) + 1))
    valid_heads = all(
        t["head"] in {0, *ids} and t["head"] != t["id"] for t in tokens
    )
    root_labels = all(
        (t["head"] == 0) == (t["deprel"] == "root") for t in tokens
    )
    G = build_graph(tokens)
    return {
        "word_ids": well_formed,
        "valid_heads": valid_heads,
        "single_head": well_formed and all(G.in_degree(i) == 1 for i in ids),
        "single_root": sum(t["head"] == 0 for t in tokens) == 1,
        "root_labels": root_labels,
        "acyclic": nx.is_directed_acyclic_graph(G),
        "connected": set(nx.descendants(G, 0)) | {0} == set(G.nodes()),
    }
ConsoleOut [7]
CollapseExpand
Sentence 1: {'word_ids': True, 'valid_heads': True, 'single_head': True, 'single_root': True, 'root_labels': True, 'acyclic': True, 'connected': True}
Sentence 2: {'word_ids': True, 'valid_heads': True, 'single_head': True, 'single_root': True, 'root_labels': True, 'acyclic': True, 'connected': True}
Sentence 3: {'word_ids': True, 'valid_heads': True, 'single_head': True, 'single_root': True, 'root_labels': True, 'acyclic': True, 'connected': True}

All three hand-written examples satisfy these checks. Counting rows with HEAD=0 is essential: the graph with arcs 0 -> 1 and 0 -> 2 is an arborescence rooted at the artificial node, but it has two sentence roots and violates the basic UD single-root requirement. The root_labels check also enforces the correspondence between HEAD=0 and DEPREL=root. These checks do not replace UD's full annotation and format validators.

The validation step is worth running even when you trust the data source. Annotation errors can occur in a treebank; importing, converting, or generating head assignments is also an opportunity to check the basic-tree constraints. A quick structural check catches cycles, multiple roots, and disconnected tokens before those errors propagate into training or evaluation.

Drawing Trees

A diagram makes the head-dependent choices easier to inspect. We build a small helper that places each word on a horizontal line and draws each arc above it, labelled with its relation. Word spacing accounts for word length. Arc heights increase with their horizontal span so that nested attachments remain legible; the height is a drawing choice, not a linguistic measurement.

PythonIn [8]
CollapseExpand
def draw_dep_tree(tokens, ax, highlight=None):
    # Word spacing accounts for word length; the arcs encode attachment only.
    positions = [0.0]
    for left, right in zip(tokens, tokens[1:]):
        positions.append(
            positions[-1] + (len(left["form"]) + len(right["form"])) / 2 + 2.5
        )
    pos = {t["id"]: x for t, x in zip(tokens, positions)}
    ink = PALETTE["ink"]
    max_height = 0.0
    for t in tokens:
        ax.text(pos[t["id"]], 0, t["form"], ha="center", va="center", color=ink)
        if t["head"] == 0:
            ax.text(
                pos[t["id"]], -0.55, "root", ha="center", va="top", color=ink
            )
            continue
        xh, xd = pos[t["head"]], pos[t["id"]]
        height = 0.075 * abs(xd - xh)
        max_height = max(max_height, height)
        color = (
            PALETTE["amber"]
            if (t["head"], t["id"]) in (highlight or set())
            else ink
        )
        path = MatplotlibPath(
            [(xh, 0.25), ((xh + xd) / 2, 2 * height + 0.25), (xd, 0.25)],
            [
                MatplotlibPath.MOVETO,
                MatplotlibPath.CURVE3,
                MatplotlibPath.CURVE3,
            ],
        )
        ax.add_patch(
            FancyArrowPatch(
                path=path,
                arrowstyle="-|>",
                mutation_scale=10,
                lw=1.1,
                color=color,
            )
        )
        ax.text(
            (xh + xd) / 2,
            height + 0.32,
            t["deprel"],
            ha="center",
            va="bottom",
            fontsize=8,
            color=color,
            bbox={
                "facecolor": PALETTE["paper"],
                "edgecolor": "none",
                "alpha": 0.92,
                "pad": 0.6,
            },
        )
    ax.set_xlim(-3, positions[-1] + 3)
    ax.set_ylim(-1, max_height + 1.15)
    ax.axis("off")

Now we draw the projective sentence She gave him a book. Its local determiner attachment gives us a visual baseline for the later crossing example.

VisualizationOut [9]
CollapseExpand
Projective dependency tree with labelled arcs above the words.
A projective dependency tree for *She gave him a book*. The subject, two objects, and punctuation depend on *gave*. The determiner *a* depends on *book*, and that arc nests inside the object arc from *gave* to *book*. No two arcs cross.

The arcs fan out from gave: nsubj to She, iobj to him, obj to book, and punct to the period. The only arc headed by a nonroot word is det from book to a, and it sits entirely inside the span of obj.

Now the non-projective sentence. We highlight the offending arc from dog to Terrier in amber so the crossing is visible.

VisualizationOut [10]
CollapseExpand
Relative-clause arc crossing the main-clause attachment of yesterday.
A non-projective dependency tree for a sentence with a relative clause. The `acl:relcl` arc from *dog* (token 4) to *Terrier* (token 10) spans *yesterday*, *which*, *was*, *a*, and *Yorkshire*. Only *yesterday* is outside the subtree of *dog*. The highlighted arc crosses the arc from *saw* to *yesterday*, so a parser restricted to projective outputs cannot recover this analysis exactly.

The highlighted arc violates projectivity because yesterday belongs to the main clause. A parser restricted to projective outputs must change at least one attachment. A parser that allows non-projective outputs can represent the supplied analysis, but it still needs evidence to choose the intended attachments.

Checking Projectivity

Visual inspection is nice, but we need a computation. The definition translates directly into a loop: for every arc, look at every token strictly between the head and dependent, and check whether it belongs to the head's subtree. If any intervening token is outside, the arc is a violation.

PythonIn [11]
CollapseExpand
def projectivity_violations(tokens):
    children = defaultdict(list)
    for t in tokens:
        if t["head"] != 0:
            children[t["head"]].append(t["id"])

    subtree = {}

    def collect(tid):
        s = {tid}
        for c in children[tid]:
            s |= collect(c)
        subtree[tid] = s
        return s

    for t in tokens:
        if t["head"] == 0:
            collect(t["id"])

    pos = {t["id"]: i for i, t in enumerate(tokens)}
    violations = []
    for t in tokens:
        h, d = t["head"], t["id"]
        if h == 0:
            continue
        lo, hi = min(pos[h], pos[d]), max(pos[h], pos[d])
        for k in range(lo + 1, hi):
            k_id = tokens[k]["id"]
            if k_id not in subtree[h]:
                violations.append((h, d, k_id))
    return violations
ConsoleOut [12]
CollapseExpand
Sentence 1: projective
Sentence 2: projective
Sentence 3: non-projective (1 non-projective arc(s))
  offending arcs: [(4, 10)]

The first two sentences return no violation tuples. The third returns exactly [(4, 10, 5)]: the acl:relcl from dog to Terrier has the outside intervening word yesterday. The output loop reduces tuples to distinct (head, dependent) pairs before counting, so it reports one offending arc, (4, 10). In general, one arc can produce several tuples if several intervening words are outside its head's subtree. This counts arcs violating the descendant condition, rather than every arc that participates in a crossing. Here, 2→5 participates in the visible crossing but is itself projective: tokens 3 and 4 are descendants of 2.

The numerical check can also be read as a picture. The next cell turns each non-root arc into a horizontal segment from head to dependent. Amber segments are the arcs that violate projectivity. The map uses every non-root arc in all three sample sentences and performs no random sampling.

PythonIn [13]
CollapseExpand
projectivity_arc_rows = []
for sent_i, tokens in enumerate(parsed, 1):
    violations = {(h, d) for h, d, _ in projectivity_violations(tokens)}
    sent_rows = []
    for t in tokens:
        h, d = t["head"], t["id"]
        if h == 0:
            continue
        sent_rows.append(
            {
                "sentence": f"S{sent_i}",
                "head": h,
                "dep": d,
                "span": abs(d - h),
                "projective": (h, d) not in violations,
                "label": t["deprel"],
            }
        )
    sent_rows.sort(key=lambda row: (row["span"], row["head"], row["dep"]))
    n_arcs = len(sent_rows)
    for rank, row in enumerate(sent_rows):
        row["y"] = sent_i + (rank - (n_arcs - 1) / 2) * 0.08
        projectivity_arc_rows.append(row)

projectivity_sentence_labels = [f"S{i}" for i in range(1, len(parsed) + 1)]
projectivity_max_token = max(t["id"] for tokens in parsed for t in tokens)
VisualizationOut [14]
CollapseExpand
Horizontal arc-span plot with one highlighted non-projective arc crossing several tokens.
Arc spans in the three sample sentences. Each horizontal segment runs from a head to its dependent, and amber segments mark projectivity violations. The long amber arc in sentence 3 is the `acl:relcl` attachment from *dog* to *Terrier*, which spans one token outside the subtree of *dog*: *yesterday*. Sentences 1 and 2 contain only projective arcs, while sentence 3 shows the non-projective analysis.

For a valid tree with nn consecutively indexed words, this teaching implementation has O(n2)O(n^2) worst-case time under the usual constant-time set-membership assumption. The nested arc-and-intervening-word loop can inspect quadratically many pairs. The stored descendant sets can also contain 1+2+⋯+n1+2+\cdots+n entries across a chain-shaped tree, so constructing and retaining those sets takes O(n2)O(n^2) worst-case work and space. Recursive depth can reach nn, which is another reason to keep this implementation to short examples. These bounds describe the algorithm; they do not supply a typical operation count for natural-language sentences.

A more memory-efficient check is possible when the input is already known to be a valid tree. For each word vv, a postorder traversal can retain only the smallest descendant position pvp_v, the largest position qvq_v, and the number of words cvc_v in its subtree, including vv. That subtree occupies a contiguous interval exactly when

cv=qv−pv+1.c_v = q_v-p_v+1.

Here qv−pv+1q_v-p_v+1 counts the word positions from the leftmost member to the rightmost member. Equality says that every position in that interval belongs to the subtree, with no gap. A dependency tree is projective exactly when this holds for every word's subtree: contiguity ensures that any position between a head and its dependent is dominated by that head, and projectivity ensures that the positions along each descendant path leave no outside word inside the subtree's span. For example, the subtree of dog in our third analysis has positions {3,4,6,7,8,9,10}\{3,4,6,7,8,9,10\}, so cv=7c_v=7 while qv−pv+1=8q_v-p_v+1=8. The missing position is yesterday, at 5. Combining these three quantities once per edge gives an O(n)O(n) whole-tree check and O(n)O(n) storage, rather than an additional O(n)O(n) scan for every arc.

Annotation Checks Are Not Parsing

The code above inspects a supplied analysis. It does not infer a tree from raw text. That distinction matters: a structurally valid tree can still attach a phrase to the wrong word or choose a relation inconsistent with the sentence's interpretation. Acyclicity and projectivity are mathematical properties; annotation correctness also requires linguistic judgment.

Consider I saw the man with a telescope. If with a telescope describes the instrument used for seeing, telescope can depend on saw with obl. If it describes the man, telescope can depend on man with nmod. In both analyses, with is a case dependent of telescope. Both structures can be single-headed, connected, acyclic, and projective. The sentence alone may not settle which interpretation the writer intended.

That is why a validation routine should state what it proves. Our routine checks the chosen basic-tree constraints. It does not certify relation definitions, morphological features, the interpretation of an ambiguous sentence, or all of the CoNLL-U specification. Parser training and decoding appear in the next chapter; comparison with reference annotations and attachment metrics follow in the chapter on structured prediction and parsing evaluation.

Limitations and Impact

A dependency annotation is a linguistic analysis. The same sentence may support more than one reading, and guidelines must choose how to encode coordination, ellipsis, names, and other difficult constructions. A common inventory fixes the available relation names, but it does not remove ambiguity. Annotation disagreement is also not a hard mathematical ceiling on a parser's agreement with a particular reference: human-human agreement and system-reference agreement measure different comparisons.

Cross-linguistic consistency has limits. A shared nsubj label does not imply identical case systems, word orders, or subject diagnostics. A model transferred between languages must still handle those differences, and treebanks can differ in genre, size, and annotation coverage. A quantitative transfer claim needs a specific model, dataset release, split, and evaluation protocol. The small examples here establish none of those empirical performance claims.

Non-projectivity is a representational limitation for any parser restricted to projective trees. Its practical importance must be measured on the intended data with a stated denominator. Structural validation helps isolate that limitation, but it cannot decide whether a linguistically plausible attachment is correct. Both trees for the telescope ambiguity can satisfy the same graph constraints.

The basic tree also leaves some interpretation links implicit. Enhanced dependencies provide another layer for shared arguments, relative-clause relations, and ellipsis, but they are optional and need their own graph handling. A program that assumes every DEPS record has one head will lose precisely the information that enhancement was designed to add.

UD's practical contribution is a shared annotation framework and data format. Dependency paths can support language analysis and downstream tasks such as relation extraction, while explicit heads and labels make a system's syntactic assumptions inspectable. Their usefulness is task-dependent: an application may require phrase boundaries, semantic roles, or discourse information beyond the basic dependency tree. Keeping those boundaries clear is part of using syntax responsibly.

Summary

Dependency syntax represents grammatical relations as directed, labelled arcs between syntactic words. In the basic UD representation every word has one incoming arc when artificial node 0 is included, exactly one word has HEAD=0, and the graph is connected and acyclic. A valid graph is not automatically a correct linguistic analysis.

UD normally connects content words directly and attaches related function words to them. Bound morphology remains a property of a word, whereas a separate case-marking word can appear as a dependency node. Shared inventories increase cross-linguistic parallelism without erasing language-specific syntax or annotation conventions.

Projectivity connects dependency structure to linear word order: every word between a head and dependent must be dominated by that head. In our relative-clause example, yesterday violates that condition for the arc from dog to Terrier. The other intervening words belong to dog's subtree. Including the artificial root arc matters when using a crossing-arcs drawing as the test.

CoNLL-U separates word forms, lemmas, POS tags, morphology, basic heads and labels, enhanced dependencies, and miscellaneous annotations. Its integer words, multiword-token ranges, and decimal empty-node identifiers serve different purposes. The bounded reader in this chapter preserves ten fields for basic integer-ID records and explicitly rejects the other record types.

The executable examples read three hand-written sentence analyses, validate their basic-tree constraints, draw two of the trees, and detect projectivity violations. They inspect annotations rather than predict them. The next chapter turns to algorithms that infer structures. The following chapter examines structured prediction and parsing evaluation.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about dependency syntax and Universal Dependencies.

Dependency Syntax and Universal Dependencies

Question 1 of 80 of 8 completed
Which condition must hold for a basic UD dependency tree?
Join the discussionAsk a question or share what you learned.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

A different angle
All writing
Language AI Handbook · Vol. 3

Constituency and Dependency Parsing

Compare constituency and dependency parsing: CKY charts, Earley, transition-based and graph-based MST decoding, neural arc scoring, and key trade-offs.

48 min read
Language AI Handbook · Vol. 3

Grammars and Constituency Structure

Learn how context-free grammars formalize constituency, parse trees, and ambiguity, then build a CKY parser and compare trees with PCFG scores.

46 min read
Language AI Handbook · Vol. 3

Morphological Analysis and Generation

Explains how finite-state transducers and neural sequence-to-sequence models perform morphological analysis and generation.

46 min read

About the author

Reference

Citation details

Cite or share this article.

BIBTEXAcademic
@misc{brenndoerfer2025dependencysyntax, author = {Michael Brenndoerfer}, title = {Dependency Syntax and Universal Dependencies}, year = {2025}, url = {https://mbrenndoerfer.com/writing/dependency-syntax-universal-dependencies-nlp}, organization = {mbrenndoerfer.com}, note = {Accessed: 2026-11-13} }
APAAcademic
Michael Brenndoerfer (2025). Dependency Syntax and Universal Dependencies. Retrieved from https://mbrenndoerfer.com/writing/dependency-syntax-universal-dependencies-nlp
MLAAcademic
Michael Brenndoerfer. "Dependency Syntax and Universal Dependencies." 2026. Web. November 13, 2026. <https://mbrenndoerfer.com/writing/dependency-syntax-universal-dependencies-nlp>.
CHICAGOAcademic
Michael Brenndoerfer. "Dependency Syntax and Universal Dependencies." Accessed November 13, 2026. https://mbrenndoerfer.com/writing/dependency-syntax-universal-dependencies-nlp.
HARVARDAcademic
Michael Brenndoerfer (2025) 'Dependency Syntax and Universal Dependencies'. Available at: https://mbrenndoerfer.com/writing/dependency-syntax-universal-dependencies-nlp (Accessed: November 13, 2026).
SimpleBasic
Michael Brenndoerfer (2025). Dependency Syntax and Universal Dependencies. https://mbrenndoerfer.com/writing/dependency-syntax-universal-dependencies-nlp
Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy