Dependency Parsing CMSC 723 / LING 723 / INST 725 M ARINE C ARPUAT marine@cs.umd.edu Slides credit: Joakim Nivre & Ryan McDonald
T oday’s Agenda • Formalizing dependency graphs • Formalizing transition-based parsing most material based on Kubler, McDonald & Nivre
Dependencies Typed: Label indicating relationship between words ● prep pobj dobj nsubj det det I saw a girl with a telescope Untyped: Only which words depend ● I saw a girl with a telescope
Data-driven dependency parsing Goal: learn a good predictor of dependency graphs Input: x Output: dependency graph/tree G Can be framed as a structured prediction task - very large output space - with interdependent labels
INT NTUITIO TION: N: SHI HIFT-RED REDUCE UCE PAR ARSE SER + C + CLASS ASSIFIER IFIER
Shift-Reduce ● Process words one-by-one left-to-right ● Two data structures ● Queue of unprocessed words ● Stack of partially processed words ● At each point choose one action ● shift: move one word from queue to stack ● reduce left: top word on stack is head of second word ● reduce right: second word on stack is head of top word ● Learn how to choose each action with a classifier
Shift Reduce Example Stack Queue Stack Queue I saw a girl saw a girl shift I I saw a girl r left shift saw girl I saw a girl shift I a r left r right saw a girl saw I I girl shift saw a girl a I
Classification for Shift-Reduce Given a state: ● Stack Queue saw a girl I Which action do we choose? ● ? r left ? r right ? shift saw a girl a girl saw girl saw a I I I Correct actions → correct tree ●
FOR ORMA MALIZ IZING ING DE DEPE PENDENC NDENCY Y REPRE PRESENT SENTATIO TIONS NS
Dependency Graphs
Dependency Graph Notation
Properties of Dependency Trees
Non-Projectivity • Most theoretical frameworks do not assume projectivity • Non-projective structures are needed to represent – Long-distance dependencies – Free word order
TR TRAN ANSITIO ITION-BASED BASED DE DEPE PENDENC NDENCY Y PAR ARSER SER
Dependency relations: Formal representation
Transition-based parsing
Transition-based parsing
Deterministic parsing with an oracle
Stack-based transition system
Transitions & Preconditions
Let’s try it out…
A few steps illustrated…
A few steps illustrated…
Answer: Full sequence of transitions 1. Shift: economy1 9. Shift: on6 2. Left-Arc: news2 -> economy1 10. Shift: financial7 3. Shift: news2 11. Left-Arc: markets8->financial7 4. Left-arc: had3->news2 12. Right-Arc: on6->markets8 5. Shift: had3 13. Right-Arc: on6->effect5 6. Shift: little4 14. Right-Arc: had3-> effect5 7. Left-arc: effect5->little4 15. Right-Arc: root->add3 8. Shift: effects5 16. Left-arc: period->root 17. Shift
Theoretical Results • Time & Space Complexity - O(n), where n = input sentence length! - Assuming oracle & transition functions can be computed in constant time
Recommend
More recommend