Ling187: Grammar Engineering

Homework Assignment for Week 1

Due: Friday, January 23 (by noon)
Submit assignments electronically to all three teachers (ron.kaplan "at" microsoft.com, tracy.king "at" microsoft.com, mforst "at" parc.com)


Turn in for PART 1: 1. the final walkthrough grammar you end up with; please name it lastname-eng-walkthrough.lfg
2. a list of 10 sentences that your augmented walkthrough grammar can parse
Turn in for PART 2: 3. the final grammar you end up with (eng-week1.lfg); please name it lastname-eng-week1.lfg
4. a paragraph discussing the monkey/sheep example

PART 1: XLE Walkthrough

EXERCISE 1: Basic Walkthrough

Do the XLE "walkthrough". Do not do the transfer walkthrough that is at the very end (we will talk about transfer at the end of the course).

The walkthrough (and all the XLE documentation) is on-line at:

  1. http://www2.parc.com/istl/groups/nltt/xle/doc/xle_toc.html
  2. Choose: Walkthrough

The walkthrough has two parts:

  1. where you type in a grammar yourself
  2. where you use an existing file. This file can be found in:
    /afs/ir.stanford.edu/class/linguist187/assignments/week1/
    or
    /afs/ir.stanford.edu/data/linguistics/XLE/SunOS/doc/

You need to do both parts of the walkthrough.

EXERCISE 2: Augmenting your lexicon

You should augment this grammar by adding to the lexicon:

Turn in: This augmented grammar, named lastname-eng-walkthrough.lfg.

EXERCISE 3: Sentences

Create a list of 10 sentences that your augmented grammar can parse.

Turn in: This list of sentences.


PART 2: Rule annotation, Subcategorization and Constraining equations

Start from the grammar eng-week1.lfg

Do not use punctuation or capital letters; in later grammars we will add these in.

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

  create-parser eng-week1.lfg

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

EXERCISE 1 -- Missing Entries

If the problem is that a word is not listed in the lexicon, a message to this effect will appear in the XLE window, in addition to the morphology window appearing:

    
% parse "a monkey in the garden devours a banana"
parsing {a monkey in the garden devours a banana}  

 Chart unconnected because of unknown words
 Word possibly causing problem: garden 
0 solutions, 0.01 CPU seconds, 0 subtrees
0
%
Add the missing entry.

Try the sentences:

    a monkey sees the banana
    a girl is devouring the orange

Add the missing entries with the relevant PRED and TENSE features.

EXERCISE 2 - Extending c-structure rules to cover more adjuncts

Extend the lexicon and the S and VP-rules to cover the temporal adverbs yesterday and today:

       the girl saw the monkey yesterday
       the girl saw the monkey yesterday in the park
       yesterday the girl saw the monkey

You will need a new c-structure category to do this. In terms of f-structure, their contribution should end up in the same set as those of local PPs modifying verbs (e.g., in the park in the girl saw the monkey in the park).

When you make a change to the rule, you must restart XLE for it to take effect. XLE should warn you if you forgot to restart:

Warning: File /tilde/thking/eng-week1.lfg containing non-lexicon
section has been changed.  
Non-lexicon changes will not take effect until exit from XLE and restart.

EXERCISE 3 - New verbs with different subcategorization

3.1 Add a treatment of ditransitive verbs to the grammar and the lexicon. Classically in LFG the second object is analyzed as OBJ2.

          the girl gave the monkey a banana
          the girl gives the monkey a banana
          the girls give the monkey a banana
          the girl is giving the monkey a banana

Make sure that the grammatical functions you are using are defined in the CONFIG section under GOVERNABLERELATIONS.

Your analysis should avoid adding a spurious ambiguity to ordinary transitive sentences:

     the monkey devoured the banana

should still have only one analysis.

3.2 Add verbs taking a prepositional object. The standard LFG analysis assumes a function OBL for these (OBL stands for "oblique").

    the monkey thought about a banana

How do you have to modify the f-annotation of the PPs in the verb rule? Again, don't forget to add the new grammatical function in the CONFIG section.

EXERCISE 4 - Constraining equations and underspecification

In the current version of the grammar, subject-verb number agreement is checked by a constraining equation like:

   (^ SUBJ NUM) =c sg

or

   (^ SUBJ NUM) =c pl

Can you explain the difference in the grammar's behaviour for the following two sentences?

       the monkey sleeps
       the sheep sleeps

What are the options for fixing the problem? Implement your preferred solution so that both sentences get only one parse.

Turn in: When you turn in your final grammar (named lastname-eng-week1.lfg), include in the email a paragraph discussing the difference.


If you have any questions, you can send us email (ron.kaplan "at" microsoft.com, tracy.king "at" microsoft.com, mforst "at" parc.com), call us (Ron: 650-245-6865; Tracy: 415-8487276, Martin: 650-812-4788), or set up office hours with us.