6 Parsing 1

J.-C. Chappelier
ÉC O L E P O L Y T E C H N I Q U E
FÉ DÉR A L E D E L A U S A N N E
6
& M. Rajman
I NTRODUCTION TO NLP
Exercises
Parsing 1
Exercise X
Consider using a parser with the following (partial) grammar:
S
NP
NP
NP
->
->
->
->
NP VP
Det N
N
NP PP
VP
VP
VP
PP
->
->
->
->
V
VP PP
VBP VBG PP
P NP
and (also partial) lexicon:
2012
Switzerland
USA
are
exports
exports
N
N
N
VBP
N
V
from
in
increasing
the
to
P
P
VBG
Det
P
Using the CYK algorithm, parse the following sentence with the above lexicon/grammar:
the exports from the USA to Switzerland are increasing in 2012
Provide both the complete, fully filled, data structure used by the algorithm, as well as the result of
the parsing in the form of a/the parse tree(s).
Exercise XI
À Give the result of the CYK algorithm applied to the following sentence:
the cat is looking at the mouse
using the following grammar:
S
VP
VP
VP
V
PP
->
->
->
->
->
->
NP VP
VBe Adj
V
VP PP
VBe
Prep NP
NP
NP
N
Adj
Adj
->
->
->
->
->
Det N
NP PP
Adj N
Adj PP
Ving
and the following lexicon:
10/31
J.-C. Chappelier
ÉC O L E P O L Y T E C H N I Q U E
FÉ DÉR A L E D E L A U S A N N E
& M. Rajman
at:Prep
black:Adj
cat:N
former:Adj
I NTRODUCTION TO NLP
is:VBe
looking:Ving
mouse:N
nice:Adj
Exercises
old:Adj
the:Det
under:Prep
with:Prep
Á Draw all the parse trees that could be obtained from the previous question.
 What is an “Earley item”? Provide one typical example using the above sentence and grammar.
à The above grammar over-generates. One reason is that some adjectives, e.g. former, can only
occur before a noun. For instance
the cat is former
is incorrect in English (but accepted by the above grammar).
Another reason for over-generation is that PPs do not combine with adjectives occurring before a noun. For instance:
the looking at the mouse cat is black
is incorrect in English (but accepted by the above grammar).
Explain how the above grammar might be modified to prevent these two types of over-generation.
Ä This grammar also accepts the following examples, which are (either syntactically or semantically) incorrect in English:
the cat is old at the mouse
the cat is nice under the mouse
the cat is nice at the mouse at the mouse
In the first example, attaching “at the mouse” to “old” is incorrect in English because some
adjectives (e.g. “old”) may not have a PP; the second example is incorrect because “nice” can
only take PPs where the preposition is limited to a certain subset (e.g. “at”, but not “under”);
and the third example is incorrect because adjectives may not combine with more than one PP.
Propose modifications to the grammar in order to prevent these types of over-generation.
11/31