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.
  1. The ball is green.
  2. I am blue.
  3. Is the ball green?
  4. Is the ball on the table?
  5. Is the ball on the table green?
  6. Was the ball green?
  7. Am I old?
The following sentence should have exactly two parse trees, both of which are meaningful:
  1. 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

  1. * The ball hit green.
  2. * Is the ball green on the table?
  3. * 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.
  1. John softly hit the orange with the ball.
  2. John hit the orange softly with the ball.
  3. John hit the orange with the ball softly.
  4. John quietly hit the orange softly with the ball.
It should not parse the following
  1. * John hit softly the orange with the ball.
It may parse the following but does not have to.
  1. John quietly softly hit the orange with the ball.
It does not have to handle adverbs outside of the verb phrase, such as:
  1. 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.