Professional Documents
Culture Documents
Parsing
Parsing
Ambiguity
NP VP
Pro Verb NP
a Nom PP
Noun from LA
flight
Ambiguity
Ambiguity
NP VP
Pro Verb NP PP
a Noun
flight
Ambiguity
Combinatorial explosion
1600
800
400
0
1 2 3 4 5 6 7 8
Phrase structure trees
S root (top)
NP VP leaves (bottom)
Pro Verb NP
a Nom Noun
Noun flight
morning
Basic concepts of parsing
• Basic idea
• Start at the root node, expand tree by
matching the left-hand side of rules
• Derive a tree whose leaves match the input
• Potential problems:
• Uses rules that could never match the input
• May loop on recursive rules: VP → VP PP!
Bottom-up parsing
• Basic idea:
• Start with the leaves, build tree by matching
the right-hand side of rules
• Build a tree with S at the root
• Potential problems
• Builds structures that could never be in a tree
• May loop on epsilon productions: NP → ɛ!
Dealing with ambiguity
A sample PCFG
Rule Probability
S → NP VP 1
NP → Pronoun 1/3
NP → Proper-Noun 1/3
VP → Verb NP 8/9
VP → Verb NP PP 1/9
PP → Preposition NP 1
Probabilistic context-free grammar
S 1/1
NP 1/3 VP 8/9
a Nom 2/3 PP
Noun from LA
flight
Probability: 16/729
Probabilistic context-free grammar
S 1/1
NP 1/3 VP 1/9
a Noun
flight
Probability: 6/729
Independence assumption