chart parsing - umass amherstmccallum/courses/cl2006/... · 2006-02-19 · andrew mccallum, umass...
TRANSCRIPT
![Page 1: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/1.jpg)
Andrew McCallum, UMass Amherst
Chart ParsingLecture #6
Computational LinguisticsCMPSCI 591N, Spring 2006
University of Massachusetts Amherst
Andrew McCallum
(Including slides from Jason Eisner)
![Page 2: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/2.jpg)
Andrew McCallum, UMass Amherst
Today’s Main Points
• Hand back In-class Exercise #2• Motivations and applications of Parsing.• Dynamic Programming for Parsing: CYK
– Some hands-on practice
• Discuss Programming Assignment #3“Implement CYK and build a grammar”
![Page 3: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/3.jpg)
Andrew McCallum, UMass Amherst
Programming languages
printf ("/charset [%s", (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
assert (p + *p < pend);
for (c = 0; c < 256; c++) if (c / 8 < *p && (p[1 + (c/8)] & (1 << (c % 8)))) { /* Are we starting a range? */ if (last + 1 == c && ! inrange) { putchar ('-');
inrange = 1; } /* Have we broken a range? */ else if (last + 1 != c && inrange) { putchar (last); inrange = 0; }
if (! inrange) putchar (c);
last = c; } Easy to parse.
Designed that way!
![Page 4: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/4.jpg)
Andrew McCallum, UMass Amherst
Natural languages
No {} () [] to indicate scope & precedence Lots of overloading (arity varies)
Grammar isn’t known in advance!
Context-free grammar not best formalism
printf "/charset %s", re_opcode_t *p - 1 == charset_not ? "^" : "";assert p + *p < pend; for c = 0; c < 256; c++ if c / 8 < *p && p1 + c/8& 1 << c % 8 Are we starting a range? if last + 1 == c && ! inrangeputchar '-'; inrange = 1; Have we broken a range? else if last + 1 != c&& inrange putchar last; inrange = 0; if ! inrange putchar c; last =c;
![Page 5: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/5.jpg)
Andrew McCallum, UMass Amherst
The parsing problem
PARSER
Grammar
scorer
correct test trees
testsentences
accuracy
![Page 6: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/6.jpg)
Andrew McCallum, UMass Amherst
Applications of parsing (1/2)
• Machine translation (Alshawi 1996, Wu 1997, ...)
English Chinesetree
operations
• Speech synthesis from parses (Prevost 1996) The government plans to raise income tax. The government plans to raise income tax the imagination.
• Speech recognition using parsing (Chelba et al 1998)
Put the file in the folder. Put the file and the folder.
![Page 7: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/7.jpg)
Andrew McCallum, UMass Amherst
Applications of parsing (2/2)
• Grammar checking (Microsoft)
• Indexing for information retrieval (Woods 1997) ... washing a car with a hose ... vehicle maintenance
• Information extraction (Hobbs 1996) (Miller et al 2000)
NY Timesarchive
Database
pattern
![Page 8: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/8.jpg)
Andrew McCallum, UMass Amherst
Parsing State of the Art
• Recent parsers quite accurate, e.g.,• A Maximum-Entropy-Inspired Parser
Eugene CharniakProceedings of NAACL-2000.
• Three Generative, Lexicalised Models for StatisticalParsingMichael CollinsProceedings of ACL, 1997.
• Most sentences parsed correctly, or with oneerror
![Page 9: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/9.jpg)
Andrew McCallum, UMass Amherst
Last class…
• We defined a CFG,where it sits in the Chomsky hierarchy
• Talked about parsing as search……through an exponential number of possible trees
• Gave examples of bottom-up and top-down search.• Discussed problems:
– Infinite loop with left-recursive rules– Much duplicated work in exponential space… backtracking
![Page 10: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/10.jpg)
Andrew McCallum, UMass Amherst
Dynamic Programming for Parsing
• Given CFG in Chomsky Normal Form,and an input string, we want to search forvalid parse trees.
• What are the intermediate sub-problems?• What would the dynamic programming table
look like?
![Page 11: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/11.jpg)
Andrew McCallum, UMass Amherst
CKY algorithm, recognizer version
Input: string of n words Output: yes/no (since it’s only a recognizer)
Data structure: n x n table rows labeled 0 to n-1 columns labeled 1 to n cell [i,j] lists possible constituents spanning words
between i and j
![Page 12: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/12.jpg)
Andrew McCallum, UMass Amherst
CKY algorithm, recognizer version
for i := 1 to n Add to [i-1,i] all (part-of-speech) categories for the ith word
for width := 2 to n for start := 0 to n-width
Define end := start + width for mid := start+1 to end-1
for every constituent X in [start,mid] for every constituent Y in [mid,end] for all ways of combining X and Y (if any) Add the resulting constituent to
[start,end] if it’s not already there.
![Page 13: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/13.jpg)
N 84Det 13
P 2V 52
NP 4VP 41
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5 NP → time Vst → time NP → flies VP → flies P → like V → like Det → an N → arrow
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 14: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/14.jpg)
N 84Det 13
P 2V 52
NP 4VP 41
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 15: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/15.jpg)
N 84Det 13
P 2V 52
NP 4VP 41
NP 10NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 16: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/16.jpg)
N 84Det 13
P 2V 52
NP 4VP 41
NP 10S 8
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 17: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/17.jpg)
N 84Det 13
P 2V 52
NP 4VP 41
NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 18: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/18.jpg)
N 84Det 13
_P 2V 52
_NP 4VP 41
NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 19: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/19.jpg)
N 84NP 10Det 13
_P 2V 52
_NP 4VP 41
NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 20: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/20.jpg)
N 84NP 10Det 13
_P 2V 52
_NP 4VP 41
NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 21: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/21.jpg)
N 84NP 10Det 13
PP 12_P 2V 52
__NP 4VP 41
_NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 22: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/22.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
__NP 4VP 41
_NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 23: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/23.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
__NP 4VP 41
_NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 24: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/24.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18__NP 4VP 41
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 25: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/25.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21
__NP 4VP 41
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 26: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/26.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 27: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/27.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 28: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/28.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 29: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/29.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 30: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/30.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 31: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/31.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 32: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/32.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
___NP 4VP 41
NP 24S 22S 27NP 24
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 33: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/33.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 34: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/34.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 35: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/35.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
![Page 36: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/36.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
SFollow backpointers …
![Page 37: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/37.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
S
NP VP
![Page 38: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/38.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
S
NP VP
VP PP
![Page 39: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/39.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
S
NP VP
VP PP
P NP
![Page 40: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/40.jpg)
N 84NP 10Det 13
PP 12VP 16
_P 2V 52
NP 18S 21VP 18
__NP 4VP 41
NP 24S 22S 27NP 24S 27S 22S 27
__NP 10S 8S 13
NP 3Vst 3
0
time 1 flies 2 like 3 an 4 arrow 5
1 S → NP VP6 S → Vst NP2 S → S PP
1 VP → V NP2 VP → VP PP
1 NP → Det N2 NP → NP PP3 NP → NP NP
0 PP → P NP
S
NP VP
VP PP
P NP
Det N
![Page 41: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/41.jpg)
Andrew McCallum, UMass Amherst
CMPSCI 591N In-class Exercise #3 Name: __________________ Student ID: ____________
Fill in the CYK dynamic programming table to parse the sentence below. In the bottom right corner, draw the two parse trees.
she eats fish with chop-sticks
0 1 2 3 4 5
0
1
2
3
4
S → NP VP NP → NP PP VP → V NP VP → VP PP PP → P NPNP
NP → she NP → fish NP → fork NP → chopsticks V → eats V → fish P → with
![Page 42: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/42.jpg)
Andrew McCallum, UMass Amherst
CMPSCI 591N In-class Exercise #3 Name: __________________ Student ID: ____________
Fill in the CYK dynamic programming table to parse the sentence below. In the bottom right corner, draw the two parse trees.
she eats fish with chop-sticks
0 1 2 3 4 5
0
1
2
3
4
S → NP VP NP → NP PP VP → V NP VP → VP PP PP → P NPNP
NP → she NP → fish NP → fork NP → chopsticks V → eats V → fish P → with
V
NPV
P
NP
VP V NP
PP P NP
S NP,VP
NP NP PP
VP V NP
VP VP PP
S NP VP
S NP VP
![Page 43: Chart Parsing - UMass Amherstmccallum/courses/cl2006/... · 2006-02-19 · Andrew McCallum, UMass Amherst Today’s Main Points •Hand back In-class Exercise #2 •Motivations and](https://reader030.vdocuments.us/reader030/viewer/2022040212/5e8b9d7f9f696a001c0455b8/html5/thumbnails/43.jpg)
Andrew McCallum, UMass Amherst
Homework #3
• Implement CYK• Create a grammar• Experiment with it...
• No class next Tuesday.• Homework still due Thursday.