CS 351 Lisp and Symbolic Computation
Homework 5: Natural Language Parsing
Due: May 4, 2000, 3:15PM
The basic syntactic parsing code from Norvig is in
/u/mooney/cs351-code/syntax1.lisp. Make sure you compile and load all
of the needed auxiliary files. Your assignment only involves adding to the
grammar *grammar4* in the file to make a new grammar (*grammar5*)
which can handle the additional aspects of English described below. No change
to the parser itself is required.
You should submit the final grammar you write electronically using turnin. Clearly indicate
your additions to the grammar with comments marked with: "; **".
You can use the Common Lisp function pprint to force Allegro to
print out complete parse trees instead of printing only part and
indicating the rest with "#"s.
Declarative and Interogative "to be" sentences
Enhance the grammar to handle statements and questions using the special verb
"to be". For example, you should be able to produce exactly one parse tree for
each of the following sentences. This parse tree should give a meaningful
structure for the sentence. Note: do not include punctuation in the actual
Lisp form.
- The ball is green.
- I am blue.
- Is the ball green?
- Is the ball on the table?
- Is the ball on the table green?
- Was the ball green?
- Am I old?
The following sentence should have exactly two parse trees, both of
which are meaningful:
- Is the ball on the table by the orange?
Explain the alternative semantic interpretations represented by these two
parses.
It should not parse the following
- * The ball hit green.
- * Is the ball green on the table?
- * Hit the ball green?
Adverbs
Enhance the grammar to handle adverbs. Adverbs can appear in various places in
a verb phrase. For example, you should be able to produce at least one parse
tree for each of the following sentences. Each parse tree should give a
meaningful structure for the sentence.
- John softly hit the orange with the ball.
- John hit the orange softly with the ball.
- John hit the orange with the ball softly.
- John quietly hit the orange softly with the ball.
It should not parse the following
- * John hit softly the orange with the ball.
It may parse the following but does not have to.
- John quietly softly hit the orange with the ball.
It does not have to handle adverbs outside of the verb phrase, such as:
- Softly, John hit the orange with the ball.
Which of these sentences produce multiple parses in your grammar? Explain the
alternative semantic interpretations represented by different parses of the
same sentence. Does each parse correspond to a semantically distinct
interpretation? Why or why not? Discuss any general problems with writing a
grammar with adverbs that avoids "redundant" parses that do not reflect true
semantic distinctions.
Include all additional discussion as comments in a trace of the full output of
your parser for each the relevant cases above. Submit this commented trace as
a separate file in addition to your grammar file.