Shift-Reduce Parsing: Natural Language Processing: Jordan Boyd-Graber
Shift-Reduce Parsing: Natural Language Processing: Jordan Boyd-Graber
Boulder
Shift-Reduce Parsing
1 of 17
Shift-Reduce Parsing
Boulder
Shift-Reduce Parsing
2 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Example
Boulder
Shift-Reduce Parsing
3 of 17
Components
Boulder
Shift-Reduce Parsing
4 of 17
Components
Boulder
Shift-Reduce Parsing
4 of 17
Components
Boulder
Shift-Reduce Parsing
4 of 17
Components
Boulder
Shift-Reduce Parsing
4 of 17
Initially the stack has root, the buer has the sentences words,
Boulder
Shift-Reduce Parsing
5 of 17
Action: Left
Boulder
Shift-Reduce Parsing
6 of 17
Action: Left
Boulder
Shift-Reduce Parsing
6 of 17
Action: Right
Boulder
Shift-Reduce Parsing
7 of 17
Action: Right
Boulder
Shift-Reduce Parsing
7 of 17
Shift
Boulder
Shift-Reduce Parsing
8 of 17
Shift
Boulder
Shift-Reduce Parsing
8 of 17
Buer
Stack
[root
Boulder
Shift-Reduce Parsing
9 of 17
Buer
Stack
[root , economic
Boulder
Shift-Reduce Parsing
9 of 17
Buer
Stack
[root
Next transition:
Boulder
3. Shift
Shift-Reduce Parsing
9 of 17
Buer
Stack
[root , news
Next transition:
Boulder
4. Left
Shift-Reduce Parsing
9 of 17
Buer
Stack
[root
Next transition:
Boulder
5. Shift
Shift-Reduce Parsing
9 of 17
Buer
Stack
[root
, had
Next transition:
Boulder
6. Shift
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had , little
Next transition:
Boulder
7. Left
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had
Next transition:
Boulder
8. Shift
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had , eect
Next transition:
Boulder
9. Shift
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had , eect , on ]
Next transition:
Boulder
[financial, markets, .]
10. Shift
Shift-Reduce Parsing
9 of 17
Stack
[root , had , eect , on ,
financial ]
Next transition:
Boulder
Buer
[markets, .]
11. Left
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had , eect , on ]
Next transition:
Boulder
[markets, .]
12. Right
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had , eect
[on, .]
Next transition:
Boulder
13. Right
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had
[eect, .]
Next transition:
Boulder
14. Right
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
]
[had, .]
Next transition:
Boulder
15. Shift
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
, had]
[.]
Next transition:
Boulder
16. Right
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
]
[had]
Next transition:
Boulder
17. Right
Shift-Reduce Parsing
9 of 17
Stack
[
Buer
]
[root]
Next transition:
Boulder
18. Shift
Shift-Reduce Parsing
9 of 17
Stack
[root
Buer
]
[]
Next transition:
Boulder
Shift-Reduce Parsing
9 of 17
If the top of the stack is the child of the top of the buer, then
If the top of the buer is is a child of the top of the stack and the
top of the buer has no children that have yet to be added to the
tree, then make a right
Boulder
Shift-Reduce Parsing
10 of 17
If the top of the stack is the child of the top of the buer, then
If the top of the buer is is a child of the top of the stack and the
top of the buer has no children that have yet to be added to the
tree, then make a right
Part of Homework 6
Boulder
Shift-Reduce Parsing
10 of 17
Boulder
Shift-Reduce Parsing
11 of 17
Complexity
Boulder
Shift-Reduce Parsing
12 of 17
Complexity
Boulder
Shift-Reduce Parsing
12 of 17
Comparison
verbs)
Boulder
Shift-Reduce Parsing
13 of 17
In Class
Boulder
Shift-Reduce Parsing
14 of 17
Buer
Stack
[root
Edges
Next move: 1. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root , I
Edges
Next move: 2. Left
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root
Edges
,I
am
Next move: 3. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root , am
Edges
,I
am
Next move: 4. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root , am , the
Edges
,I
am
Next move: 5. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root , am , the , very
Edges
,I
am
Next move: 6. Left
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root , am , the
Edges
,I
am
, very
model
Next move: 7. Left
Boulder
Shift-Reduce Parsing
15 of 17
Buer
Stack
[root , am
Edges
,I
am
, very
model
, the
model
Next move: 8. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
, model
Edges
,I
am
, very
model
, the
model
Next move: 9. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
, model , of
Edges
,I
am
, very
model
, the
model
Next move: 10. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
, model , of , a ]
Edges
,I
am
, very
model
, the
model
Next move: 11. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
modern ]
, model , of , a ,
Buer
[major, general]
Edges
,I
am
, very
model
, the
model
Next move: 12. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am , model , of , a ,
modern , major]
Buer
[general]
Edges
,I
am
, very
model
, the
model
Next move: 13. Left
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
modern ]
, model , of , a ,
Buer
[general]
Edges
,
,
,
,
I
am
very
model
the
model
major
general
Next move: 14. Left
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
, model , of , a ]
[general]
Edges
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
Next move: 15. Left
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
, model , of
[general]
Edges
,
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
a
general
Next move: 16. Right
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
, model
[of, ]
Edges
,
,
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
a
general
of ! general
Next move: 17. Right
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root , am
Buer
]
[model, ]
Edges
,
,
,
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
a
general
of ! general
model ! of
Next move: 18. Right
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root
Buer
]
[am]
Edges
,
,
,
,
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
a
general
of ! general
model ! of
am ! model
Next move: 19. Right
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[
Buer
]
[root]
Edges
,
,
,
,
,
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
a
general
of ! general
model ! of
am ! model
root ! am
Next move: 20. Shift
Boulder
Shift-Reduce Parsing
15 of 17
Stack
[root
Buer
]
[]
Edges
,
,
,
,
,
,
,
,
,
,
I
am
very
model
the
model
major
general
modern
general
a
general
of ! general
model ! of
am ! model
root ! am
Boulder
Shift-Reduce Parsing
15 of 17
If the top of the stack is the child of the top of the buer, then
If the top of the buer is is a child of the top of the stack and the
top of the buer has no children that have yet to be added to the
tree, then make a right
Boulder
Shift-Reduce Parsing
16 of 17
Action
s
Head Index
Head Word
Boulder
Dep Index
Dep Word
Shift-Reduce Parsing
17 of 17
Action
s
s
Head Index
Head Word
Boulder
Dep Index
Dep Word
Shift-Reduce Parsing
17 of 17
Action
s
s
l
Head Index
Head Word
Dep Index
Dep Word
cat
fat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
s
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
s
l
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
mat
the
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
s
l
r
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
7
5
mat
on
6
7
the
mat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
s
l
r
r
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
7
5
4
mat
on
sat
6
7
5
the
mat
on
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
s
l
r
r
r
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
7
5
4
0
mat
on
sat
None
6
7
5
4
the
mat
on
sat
Boulder
Shift-Reduce Parsing
17 of 17
Action
s
s
l
l
s
l
s
s
s
l
r
r
r
s
Head Index
Head Word
Dep Index
Dep Word
3
3
cat
cat
2
1
fat
the
sat
cat
7
5
4
0
mat
on
sat
None
6
7
5
4
the
mat
on
sat
Boulder
Shift-Reduce Parsing
17 of 17