Lecture 08
Lecture 08
Processing
Lecture 8: Dependency Parsing
11/13/2020
COMS W4705
Yassine Benajiba
Dependency Structure
nsubj dobj
det det
det advmod amod
• Function words
Dependency Structure
• Long history in linguistics (Starting with Panini’s Grammar of
Sanskrit, 4th century BCE).
girl likes
dependent head
PC
OBJ
ATT SBJ ATT ATT ATT
set of nodes
Vs= {root, Economic, news, had, little, effect, on, financial, markets, . }
set of edges/
A = {(root, PRED, had), (had, SBJ, news), (had, OBJ, effect),(had, PU, .),
arcs
(news,ATT,Economic),(effect,ATT,little),(effect,ATT,on), (on,PC,markets),
(markets, ATT, financial)}
Another Example
had
news effect .
Economic little on
markets
financial
G = (V, A)
A = {(root, PRED, had), (had, SBJ, news), (had, OBJ, effect),(had, PU, .),
(news,ATT,Economic),(effect,ATT,little),(effect,ATT,on), (on,PC,markets),
(markets, ATT, financial)}
Different Dependency
Representations
• How to deal with prepositions?
nmod
pobj
case
nmod amod amod
Source: http://universaldependencies.org/u/dep/
Dependency Trees
• Dependency structure is typically assumed to be a tree.
hearing scheduled
A on
today
issue
the
structural constraints
Dependency Parsing
• What information could we use?
• bi-lexical affinities
• Intervening words
• subcategorization/valency of heads.
Subcategorization/Valency
• Verbs may take a different number of arguments of
different syntactic types in different positions:
• Grammar-based
• Data-based
ATT
A:
Economic news
news
σ:
root β: [had, little, effect, on, financial, markets,.]
t0 t1 t2 tn-1
c0: ([w0]σ, [w1, w2, ... ,wm]β, {}A) c1 c2 ... cn-1 cT: ([σ,
[ ]β, A)
initial state transitions terminal state
(for any σ and A)
ATT
A:
Economic news
news
σ:
root β: [had[little,
,little, effect, on, financial, markets,.]
Transition-Based Parsing -
Transitions
• Arc-leftr
Build an edge from the next word on the buffer to the top
word on the stack.
(σ | wi, wj | β, A) => (σ, wj | β, A ∪ {wj, r, wi})
Not allowed if i=0 (root may not have a parent)
ATT
A:
Economic news
Econonomic
σ:
root β: [news, little, effect, on, financial, markets,.]
OBJ
ATT SBJ ATT
A:
Economic news had little effect
had
σ:
root β: [effect,
[had, on, financial, markets,.]
note: wi is moved from the top of the stack back to the buffer!
Transition-Based Parsing -
Some Observations
• Does the transition system contain dead ends? (states from which a
terminal state cannot be reached)? No!
• Once a word disappears from the buffer and the stack it cannot be
part of any further edge!
Another Example
PU
PRED
PC
OBJ
ATT SBJ ATT ATT ATT
G = (Vs, A)
Vs= {root, Economic, news, had, little, effect, on, financial, markets, . }
A = {(root, PRED, had), (had, SBJ, news), (had, OBJ, effect),(had, PU, .),
(news,ATT,Economic),(effect,ATT,little),(effect,ATT,on), (on,PC,markets),
(markets, ATT, financial)}
Transition-Based Parsing -
Complete Example
initial state
next transition: shift (these are all predicted by discriminative ML classifier)
A:
A:
Economic
σ: root β: [ news, had, little, effect, on, financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: shift
A:
ATT
Economic news
A:
ATT
Economic news
news
σ: root β: [ had, little, effect, on, financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: shift
A:
ATT SBJ
A:
ATT SBJ
had
σ: root β: [ little, effect, on, financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: Left-ArcSBJ
A:
ATT SBJ
little
had
σ: root β: [ effect, on, financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: shift
A:
had
σ: root β: [ effect, on, financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: shift
A:
effect
had
σ: root β: [ on, financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: shift
A:
on
effect
had
σ: root β: [ financial, markets,.]
Transition-Based Parsing -
Oracle Example
next transition: Left-ArcATT
A:
financial
on
effect
had
σ: root β: [ markets,.]
Transition-Based Parsing -
Oracle Example
next transition: Right-ArcPC
A:
on
effect
had
σ: root β: [ markets,.]
Transition-Based Parsing -
Oracle Example
next transition: Right-ArcOBJ
A:
PC
ATT SBJ ATT ATT
effect
had
σ: root β: [on,.]
Transition-Based Parsing -
Oracle Example
next transition: Right-ArcOBJ
A:
PC
ATT SBJ ATT ATT ATT
had
σ: root β: [effect,.]
Transition-Based Parsing -
Oracle Example
next transition: shift
A:
PC
OBJ
ATT SBJ ATT ATT ATT
σ: root β: [had,.]
Transition-Based Parsing -
Oracle Example
next transition: Right-ArcPU
A:
PC
OBJ
ATT SBJ ATT ATT ATT
had
σ: root β: [.]
Transition-Based Parsing -
Oracle Example
next transition: Right-ArcPRED PU
A:
PC
OBJ
ATT SBJ ATT ATT ATT
σ: root β: [had]
Transition-Based Parsing -
Oracle Example
next transition: shift PU
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
σ: β: [root]
Transition-Based Parsing -
Oracle Example
terminal PU
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
σ: root β: []
Properties of the Transition
System
• The time required to parse w1,..., wm with an oracle is O(m).
Why?
• Could use perceptron, log linear model, SVM, Neural Network, ...
• If the classifier takes O(1), the runtime for parsing is still O(m) for m words.
• Questions:
• Reduce
Remove a completed node from the stack.
(σ | wi , β, A) => (σ, β , A)
A:
ATT SBJ
PRED
A:
ATT SBJ
had
σ: root β: [ little, effect, on, financial, markets,.]
Arc-Eager Example
next transition: LeftArcATT
PRED
A:
little
had
σ: root β: [effect, on, financial, markets,.]
Arc-Eager Example
next transition: RightArcOBJ
PRED
A:
OBJ
ATT SBJ ATT
effect
little
had
σ: root β: [on, financial, markets,.]
Arc-Eager Example
next transition: shift
PRED
A:
OBJ
ATT SBJ ATT ATT
on
effect
little
had
σ: root β: [financial, markets,.]
Arc-Eager Example
next transition: LeftArcATT
PRED
A:
OBJ
ATT SBJ ATT ATT
financial
on
effect
little
had
σ: root β: [markets,.]
Arc-Eager Example
next transition: RightArcPC
PRED
A:
OBJ
ATT SBJ ATT ATT ATT
on
effect
little
had
σ: root β: [markets,.]
Arc-Eager Example
next transition: Reduce
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
markets
on
effect
little
had
σ: root β: [.]
Arc-Eager Example
next transition: Reduce
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
on
effect
little
had
σ: root β: [.]
Arc-Eager Example
next transition: Reduce
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
effect
little
had
σ: root β: [.]
Arc-Eager Example
next transition: Reduce
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
little
had
σ: root β: [.]
Arc-Eager Example
next transition: Reduce
PRED
A:
PC
OBJ
ATT SBJ ATT ATT ATT
had
σ: root β: [.]
Graph-Based Approach
• Transition Based Parsing can only produce projective dependency
structures? Why?
• Basic idea:
saw saw
30 30 30 30
20 0 20 0
11 11
total score: 70
Computing the MST
• For undirected graphs, there are two common algorithms: