Ling187/287: Grammar Engineering

Homework Assignment for Week 6

Due: Wednesday, May 17 (by midnight)
Submit assignments electronically to both professors (kaplan "at" parc.com and thking "at" parc.com)


Turn in: the final grammar you end up with (eng-week6.lfg)
Please name your grammars with name-eng-week6.lfg
Exercises on:
PART 1: infinitives
PART 2: relative clauses and interrogatives

There is one grammar this week:

Do not use capital letters. You can use an ending period and some pronouns (see the lexicon).

If you put a file called .xlerc in the directory with your grammar and in .xlerc you put:

  create-parser eng-week6.lfg

then whenever you start xle in that directory, it will automatically load eng-week6.lfg. This will save a lot of time when making and testing changes.

This grammar has a fragment grammar in it, but the OT marks are set so that it is never triggered: debugging with fragments on is close to impossible.


PART 1: Infinitives

EXERCISE 1 -- Subcategorized Infinitives

In a previous assignment, we added in finite clauses as COMP to parse things like:

  the girl said that the monkey ate a banana.

This exercise adds in infinitival complements. First, create a rule VPinf which take the initival marker to followed by a VP. There is already an entry for the infinitival marker in the lexicon. Try parsing:

  VPinf: to laugh

You should not get a well-formed f-structure because the verb is missing its SUBJ, but make sure there is no TENSE feature and that there is an INF feature.

Alter the VP rule to allow VPinf as an XCOMP. At this point, the c-structure should be all set for parsing things like:

   he wants to laugh.

although the f-structure will not be built correctly because the template for V-XCOMP and V-OBJ-XCOMP goes to TRUE instead of having the appropriate equations associated with it.

Create templates for these verbs. First do V-XCOMP. This should take a SUBJ and an XCOMP. In addition, it needs to state that the verb's SUBJ is its XCOMP SUBJ. You want an f-structure roughly like:

    [ PRED  'want'
      SUBJ  [ PRED 'he' ]=1
      XCOMP [ PRED 'laugh'
              SUBJ [ ]=1 ] ]

where the =1 indicate that the SUBJ are identical. You should be able to parse things like:

  he wants to laugh.
  he want to eat a banana.
  he wants to want to laugh.
  I know that he wants to laugh.

Now do the same thing for V-OBJ-XCOMP. For these verbs, it is the OBJ that controls the XCOMP SUBJ. You should be able to parse things like:

   I want her to laugh.
   he knows that I want her to eat a banana.

Note that the case on the pronouns will reflect the surface form even when playing the role of SUBJ in the infinitive.

EXERCISE 2 -- Purpose-Clause Infinitives

In addition to infinitival arguments, there are infinitival adjuncts in things like:

   he ate a banana (in order) to laugh.

Add another call to VPinf in VP which puts the infinitive in an ADJUNCT and provides a null subject for it (similar to the object drop and the fragment rule nulls). You should be able to parse:

  he laughed to laugh.
  he ate a banana to laugh.
  he wants to eat a banana to laugh.

The last of these should have two parses: one with the to laugh ADJUNCT modifying wants and one modifying eat.

PART 2: Relatives Clauses and Interrogatives

For this part, you should use the grammar you created for Part I. If you did not get the infinitives to work quite right, some of the sentences in the examples may not parse correctly.

EXERCISE 1 -- Relative Clauses

The NP rule allows for an optional relative clause:

  NP --> { (D)
 	    AP*: @(ADJUNCT NP); 
 	    Nmod*: @MOD; "noun noun compounds"
 	    N
 	    PP*: @(ADJUNCT NP);
	    (RelCL)
 	   |PRON}.  

   RelCL --> "relative clause rule"
	  RelPRON
 	  S.

Add equations so that you can parse relative clauses like:

   NP: the girl who laughed
   NP: the girl who devoured the banana
   NP: the banana that the girl devoured
   NP: the banana that the monkey thought about

You will also need to modify the c-structure rules slightly to allow for the "gaps".

Do not worry about when that and when who is used.

You want to have an f-structure that looks roughly like:

[ PRED 'girl'
  ADJUNCT { [ PRED 'laugh'
              SUBJ [PRED 'who'] ] } ]

Note that there is no overt connection (for example, no functional control) between the head noun girl and the relative pronoun who.

Now expand your equations to allow for these to be embedded so that you can parse relative clauses like:

   NP: the girl who he said laughed
   NP: the girl who wanted to devour the banana
   NP: the banana that the girl reported the monkey devoured
   NP: the banana that she said that the monkey wanted to think about

If relative clauses with want to in them get two parses, put a comment in the grammar saying where the two parses are coming from.

Do not worry about the fact that some relative clauses are linguistically bad if you have that in the subordinate clauses.

EXERCISE 2 -- Matrix Questions

The goal of this exercise is to add basic wh questions to the grammar: subject, object, oblique object. There are two basic types of these: ones with subject-auxiliary inversion and ones without.

No subject-auxiliary inversion:

   who laughed?
   who said that he laughed?

Subject-auxiliary inversion:

   who did they see?
   what did they devour?
   
   what did they think about?

   who did they say laughed?
   who did they want to laugh?
   what did they want to think about?
This exercise will be in four steps:
  1. Add questions with no subject-auxiliary inversion
  2. Add questions with subject-auxiliary inversion but only one clause
  3. Allow subject-auxiliary questions with multiple clauses
  4. Allow question marks

Note: the goal here is not to write a grammar that captures all of English questions; you don't have to have it do any more than is indicated here.

STEP 1

Modify the grammar to allow sentences like:

   who laughed
   who said that he laughed

There is already a lexical entry for who.

Make sure that you modifications do not parse (you can set up the rules so that these do not even get a valide c-structure, but if you prefer to block this in the f-structure, that is fine):

   they said that who laughed
   they requested that who said that he laughed

Add a new feature to clauses called STMT-TYPE. STMT-TYPE should have a value of interrogative for questions and declarative for non-questions. This feature should appear at the same level of the f-structure as TNS-ASP.

STEP 2

This step will require the most changes to the c-structure of the grammar. The c-structure rules need to be changed to allow subject-auxiliary inversion in questions like:

   who did they see
   what did they devour
   
   what did they think about

There is already a lexical entry for the auxiliary did. To see how it works, you can parse declaratives such as:

   he did laugh.

You will want the progressive auxiliary is to also be able to appear in questions (only the main verb will be a -ing form instead of a base form). Note that only some of the verbs have -ing forms and so if something does not parse, check that it has the appropriate form.

STEP 3

Modify the grammar to allow sentences like:

  who did they say laughed
  who did they want to laugh
  what did they say he thought about

This should not involve having to write new c-structure rules, assuming you got steps 1 and 2 to work. Do not worry if your grammarcan parse things like:

  who did they say that laughed

You may end up with double parses for things like:

  who did they want to laugh

If this is the case, you can either fix this or put a comment in the grammar saying where the two parses are coming from.

STEP 4

Make a lexical entry for the question mark ? and make sure that it can only occur with questions.

Turn in: The new version of your grammar.


If you have any questions, you can send us email, call us (Ron: 812-4348; Tracy: 812-4808), or talk to us during office hours.