Exercise 4, Grammar Development

For this exercise you can work with grammar3.lfg, which contains first rules for adjectives and more complex rules for PPs. The grammar also makes a start on integrating punctuation. Note that XLE is set up to use a default tokenizer if nothing else is specified. At the moment, this does not seem to be working right. Our grammar3.lfg thus integrates the tokenizers provided as part of the ParGram Starter Grammar. From there, you need to download eng-pargram-morph.fst and basic-parse-tok.fst and store them in the same place as your grammar (or store them elsewhere and adjust the paths in the MORPHOLOGY section of your grammar accordingly).

Adjectives and Adverbs

Expand your grammar so that it includes Adjectives and Adverbs. That is, the following sentences should also work (and provide sound linguistic analyses).

You will need to add adverbs to your lexicon and make sure that you expand your rules to allow adverbs. Note that you should also change your treatment of adjectives, so that you have something like the following:

NP --> (D)
       AP*: ! $ (^ ADJUNCT);
       N. 

AP --> Adv*: ! $ (^ ADJUNCT);
      A.

That is, you should introduce an Adjective Phrase (AP) and allow adverbs to modify adjectives within this AP.

PPs and constraining equations

The grammar grammar3.lfg already contains a start on implementing PPs. Overall, you should be able to treat three kinds of PPs: Adjuncts (with semantic Ps), OBLs with both semantic and non-semantic Ps.

The following sentences should work. Note that some of them will get more than one possible reading. This is okay as long as the correct one is among them. We will learn next time how to constrain the space of possibilities.

Note that in addition to the PPs in the VP, which are already there to some extent in grammar5.lfg, you are required to provide for the possibilities of PPs within an NP.

Punctuation

The grammar has made a start on integrating punctuation. You can add in more types. Here are some sample lexical entries. You will need to add them to appropriate places in the c-structure rules. Note that STMT-TYPE stands for "Statment Type".

.  PERIOD  * (^ STMT-TYPE) = declarative.

,  COMMA * . 

!  EXCL * (^ STMT-TYPE) = exclamation. 

?  QM * (^ STMT-TYPE) = interrogative. 

Change your grammar so that the following sentence works:


Relevant Reading Material