Dependency Parsing

Dependency Parsing #

Dependency parsing connects words directly. In “Aisha booked a room”, booked heads the clause, Aisha is its subject, and room is its object. The determiner a depends on room. A constituency parse groups a room into a phrase, while a dependency tree identifies the head and its relation to the other words.

HeadDependentExample label
ROOTbookedroot
bookedAishansubj
bookedroomobj
roomadet

1. Trees and treebanks #

In a basic dependency tree every token has one incoming head arc, arcs have no cycles, and every token can be reached from the root. In a projective tree, the subtree under each head occupies a contiguous span. A crossing between arcs drawn above the sentence signals a non-projective structure. Treebanks supply annotated examples and specify choices such as which word is the head of a coordination. Universal Dependencies is one widely used annotation scheme.

2. Transition-based parsing ☆ #

The parser builds arcs by moving through configurations containing a stack, a buffer of unread tokens and the arcs built so far. In the arc-eager system:

ActionEffect
ShiftMove the first buffer word onto the stack
Left-ArcAdd an arc from the first buffer word to the stack top and pop the stack top
Right-ArcAdd an arc from the stack top to the first buffer word and move that buffer word onto the stack
ReducePop a stack word that already has a head

Starting with ROOT on the stack, shift Aisha. With booked at the front of the buffer, Left-Arc creates booked → Aisha. Right-Arc then creates ROOT → booked. Shift a, apply Left-Arc when room is at the front of the buffer, then apply Right-Arc to attach room to booked. Reduce the remaining headed stack words. A model predicts legal actions from the configuration. Greedy action selection is fast, and an early bad decision can limit the remaining options.

3. Graph-based parsing ☆ #

Score each possible directed head–dependent arc, then choose a valid tree with the highest total score. Choosing each dependent’s best arc independently can create a cycle. Chu–Liu/Edmonds resolves this for a maximum spanning arborescence by contracting cycles and expanding them as it recovers the tree. Eisner’s algorithm uses dynamic programming to find a highest-scoring projective tree. Enforce the treebank’s root constraints when decoding.

Neural parsers can encode each word in context and learn separate head and dependent representations. A scoring layer estimates how compatible the two roles are, and a decoder assembles the tree. The learned scorer and tree-building algorithm solve different parts of the problem.

4. Checking a parse #

Unlabelled attachment score (UAS) counts tokens with the correct head. Labelled attachment score (LAS) also requires the correct relation label. If all four words in the example have the right heads but room is assigned the wrong relation, UAS is 100% and LAS is 75% under the same four-token scoring policy.


Home | Natural Language Processing