Algorithm Search⌘K

Definitionintro

Dependency tree

Also called dependency structure, dependency graph of a sentence.

A rooted tree over the words of a sentence with a labeled arc from each head word to each of its dependents.

A dependency tree describes the syntax of a sentence by links between its words. Each word has exactly one head, the word that it modifies or completes, and the link from the head to the word carries a label, the grammatical relation, such as subject or determiner. An artificial root word 0 is the head of the main word of the sentence. The links form a tree rooted at 0, so every word reaches the root by following heads. Dependency trees are the output of dependency parsing, the unit of the dependency treebanks, and the structure that attachment scores compare.

Definition

A sentence is a sequence of words w1⋯wnw_1 \cdots w_n. We add an artificial root w0w_0 at the left edge. Let RR be a finite set of relation labels.

A dependency tree of the sentence is a set AA of labeled arcs (h,d,r)(h, d, r) with head h∈{0,…,n}h \in \{0, \ldots, n\}, dependent d∈{1,…,n}d \in \{1, \ldots, n\} and label r∈Rr \in R, such that:

  1. Single head. Each word d∈{1,…,n}d \in \{1, \ldots, n\} is the dependent of exactly one arc. No arc enters the root 0.
  2. Connected to the root. For each word dd, the chain d,h(d),h(h(d)),…d, h(d), h(h(d)), \ldots reaches 0, where h(d)h(d) is the head of dd.

The two conditions say that the arcs form a spanning arborescence rooted at 0 of the complete directed graph on {0,…,n}\{0, \ldots, n\}: there are exactly nn arcs, there is no cycle, and there is exactly one directed path from 0 to each word. Without the labels, the tree is its head function hh, and the code on these pages stores it as a list heads of length n+1n + 1 with heads[0] = -1 and heads[d] =h(d)= h(d).

The words dd with h(d)=kh(d) = k are the dependents of kk. The subtree of kk is kk and all the words whose chain of heads passes through kk; its set of positions is the yield of kk. A word kk dominates a word dd when dd is in the subtree of kk.

The children of the root. In the definition above the root may have more than one child. The Universal Dependencies treebanks require exactly one child of the root, the word with the relation root; many parsers allow several. Each page of this group says which convention it uses.

Counting. Over nn words there are (n+1)n−1(n + 1)^{n - 1} dependency trees without labels: they are the spanning trees of the complete graph on the n+1n + 1 nodes {0,…,n}\{0, \ldots, n\}, each directed away from 0, and Cayley's formula counts those. This gives 1, 3, 16, 125, 1296 for n=1n = 1 to 5. With exactly one child of the root there are nn−1n^{n - 1} trees (1, 2, 9, 64, 625): by the degree form of Cayley's formula, the trees on NN labeled nodes in which a fixed node has degree 1 number (N−1)N−2(N - 1)^{N - 2}, and here N=n+1N = n + 1. With ∣R∣|R| labels each count is multiplied by ∣R∣n|R|^n, or by ∣R∣n−1|R|^{n - 1} when the single root arc must carry the label root.

Examples and non-examples

A small tree. For the cat sat on the mat, in the style of Universal Dependencies:

dd word h(d)h(d) label
1 the 2 det
2 cat 3 nsubj
3 sat 0 root
4 on 6 case
5 the 6 det
6 mat 3 obl

The head list is [-1, 2, 3, 0, 6, 6, 3]. The root has one child, sat. The subtree of mat is on the mat, positions 4 to 6. Other annotation schemes make the preposition on the head of mat. The definition allows either choice, and the treebank fixes it.

All trees over two words. With n=2n = 2 the head lists are (h(1),h(2))=(0,0)(h(1), h(2)) = (0, 0), (0,1)(0, 1) and (2,0)(2, 0), three trees as (n+1)n−1=3(n + 1)^{n - 1} = 3 says. The first one gives the root two children, so only two of them satisfy the one-child rule, as nn−1=2n^{n - 1} = 2 says. The pair (2,1)(2, 1) is not a tree: the two words head each other and neither reaches the root.

A tree with crossing arcs. In A hearing is scheduled on the issue today, with the head list [-1, 2, 3, 0, 3, 2, 7, 5, 4], the phrase on the issue modifies hearing and today modifies scheduled. The arc from hearing (2) to on (5) passes over is (3) and scheduled (4), which hearing does not dominate. The set of arcs is still a dependency tree. It is not a projective tree.

Non-examples.

  • A word with two heads. Enhanced representations, for example the enhanced graphs of Universal Dependencies, add arcs so that a word can have several heads. The result is a directed graph, not a dependency tree.
  • A set of arcs in which some word has no head. That is a forest, a partial analysis; the transition parsers of this group pass through such forests before they finish.
  • A cycle such as h(1)=2h(1) = 2, h(2)=1h(2) = 1: each word has one head, but neither is connected to the root.
  • A parse tree of a constituency grammar. It has phrase nodes above the words. Head rules turn it into a dependency tree by choosing a head child in each phrase.
  • Projective dependency tree: a dependency tree in which no two arcs cross when they are drawn above the sentence.
  • Arborescence: the graph form of the definition. The maximum spanning arborescence of a weighted complete graph is the best tree under arc scores.
  • Attachment score: the fraction of words whose head (and label) in a predicted tree is the same as in the gold tree.
  • Dependency parsing: the problem of finding the dependency tree of a sentence.
  • Rooted tree: a dependency tree is a rooted tree on the positions 0,…,n0, \ldots, n whose nodes also have a linear order, the word order.
  • Dependency model with valence: a probability model over dependency trees, used for learning them without a treebank.

References

  1. Sandra Kübler, Ryan McDonald and Joakim Nivre, Dependency Parsing, Synthesis Lectures on Human Language Technologies, Morgan and Claypool, 2009, Chapter 2, Dependency Parsing (dependency graphs, the artificial root, well-formed dependency trees and projectivity)
  2. Joakim Nivre, Algorithms for deterministic incremental dependency parsing, Computational Linguistics 34(4), 513-553, 2008, the definitions of dependency graphs and dependency trees at the start of the article
  3. Universal Dependencies, the annotation guidelines, the basic dependency tree with one root word and the list of universal relations

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/4W6YMS/text.yaml