Natural Language Processing (CSEP 517): Dependency Syntax and Parsing
Noah Smith
c 2017 University of Washington nasmith@cs.washington.edu
May 1, 2017
1 / 96
Natural Language Processing (CSEP 517): Dependency Syntax and - - PowerPoint PPT Presentation
Natural Language Processing (CSEP 517): Dependency Syntax and Parsing Noah Smith 2017 c University of Washington nasmith@cs.washington.edu May 1, 2017 1 / 96 To-Do List Online quiz: due Sunday Read: K ubler et al. (2009, ch.
1 / 96
2 / 96
3 / 96
4 / 96
5 / 96
6 / 96
7 / 96
8 / 96
9 / 96
10 / 96
11 / 96
root sbj dobj prep pobj
12 / 96
13 / 96
14 / 96
15 / 96
16 / 96
◮ Stanford dependencies are a popular example (de Marneffe et al., 2006).
17 / 96
18 / 96
19 / 96
20 / 96
21 / 96
22 / 96
23 / 96
24 / 96
25 / 96
26 / 96
27 / 96
28 / 96
29 / 96
30 / 96
31 / 96
32 / 96
33 / 96
◮ shift the word at the front of the buffer B onto the stack S. ◮ right-arc: u = pop(S); v = pop(S); push(S, v → u). ◮ left-arc: u = pop(S); v = pop(S); push(S, v ← u).
34 / 96
◮ shift the word at the front of the buffer B onto the stack S. ◮ right-arc: u = pop(S); v = pop(S); push(S, v → u). ◮ left-arc: u = pop(S); v = pop(S); push(S, v ← u).
35 / 96
36 / 96
37 / 96
38 / 96
39 / 96
40 / 96
41 / 96
42 / 96
43 / 96
44 / 96
45 / 96
46 / 96
47 / 96
48 / 96
49 / 96
root
50 / 96
51 / 96
52 / 96
53 / 96
◮ E.g., beam search, which we’ll discuss in the context of machine translation later.
◮ As yet, no principled solution to this problem, but see “dynamic oracles” (Goldberg
54 / 96
55 / 96
56 / 96
57 / 96
58 / 96
59 / 96
60 / 96
61 / 96
◮ Arborescences can’t have cycles, so some edge in C needs to be kicked out. ◮ We also need to find an incoming edge for C. ◮ Choosing the incoming edge for C determines which edge to kick out. 62 / 96
63 / 96
64 / 96
◮ contract the nodes in C into a new node vC
◮ Edges incoming to any node in C now get destination vC ◮ For each node v in C, and for each edge e incoming to v from outside of C: ◮ Set e.kicksOut to bestInEdge[v], and ◮ Set e.s to be e.s − e.kicksOut.s ◮ Edges outgoing from any node in C now get source vC
65 / 96
66 / 96
V1 ROOT V3 V2 a : 5 b : 1 c : 1 f : 5 d : 11 h : 9 e : 4 i : 8 g : 10
67 / 96
V1 ROOT V3 V2 a : 5 b : 1 c : 1 f : 5 d : 11 h : 9 e : 4 i : 8 g : 10
68 / 96
V1 ROOT V3 V2 a : 5 b : 1 c : 1 f : 5 d : 11 h : 9 e : 4 i : 8 g : 10
69 / 96
V1 ROOT V3 V2 a : 5 − 10 b : 1 − 11 c : 1 f : 5 d : 11 h : 9 − 10 e : 4 i : 8 − 11 g : 10
70 / 96
V4 ROOT V3 b : −10 c : 1 f : 5 a : −5 h : −1 e : 4 i : −3
71 / 96
V4 ROOT V3 b : −10 c : 1 f : 5 a : −5 h : −1 e : 4 i : −3
72 / 96
V4 ROOT V3 b : −10 c : 1 f : 5 a : −5 h : −1 e : 4 i : −3
73 / 96
V4 ROOT V3 b : −10 − −1 c : 1 − 5 f : 5 a : −5 − −1 h : −1 e : 4 i : −3
74 / 96
V5 ROOT b : −9 a : −4 c : −4
75 / 96
V5 ROOT b : −9 a : −4 c : −4
76 / 96
77 / 96
V5 ROOT b : −9 a : −4 c : −4
78 / 96
V5 ROOT b : −9 a : −4 c : −4
79 / 96
V4 ROOT V3 b : −10 c : 1 f : 5 a : −5 h : −1 e : 4 i : −3
80 / 96
V4 ROOT V3 b : −10 c : 1 f : 5 a : −5 h : −1 e : 4 i : −3
81 / 96
V1 ROOT V3 V2 a : 5 b : 1 c : 1 f : 5 d : 11 h : 9 e : 4 i : 8 g : 10
82 / 96
V1 ROOT V3 V2 a : 5 b : 1 c : 1 f : 5 d : 11 h : 9 e : 4 i : 8 g : 10
83 / 96
84 / 96
ROOT ATT ATT SBJ PU VC TMP PC ATT 85 / 96
86 / 96
87 / 96
◮ As a matter of preprocessing, for each p, c, keep only the top-scoring labeled edge. 88 / 96
◮ As a matter of preprocessing, for each p, c, keep only the top-scoring labeled edge.
89 / 96
90 / 96
91 / 96
◮ Specialized algorithm that efficiently solves your problem, under your assumptions.
◮ General-purpose method that solves many problems, allowing you to test the effect
92 / 96
◮ Specialized algorithm that efficiently solves your problem, under your assumptions.
◮ General-purpose method that solves many problems, allowing you to test the effect
◮ Fast (linear-time) but greedy ◮ Model-optimal but slow 93 / 96
◮ Specialized algorithm that efficiently solves your problem, under your assumptions.
◮ General-purpose method that solves many problems, allowing you to test the effect
◮ Fast (linear-time) but greedy ◮ Model-optimal but slow ◮ Dirty secret: the best way to get (English) dependency trees is to run
94 / 96
95 / 96
96 / 96