Due: Wednesday, May 3 (by midnight)
Submit assignments electronically to both professors
(kaplan "at" parc.com and thking "at" parc.com)
| Turn in: | 1. the final grammar you end up with (eng-week4.lfg); each part uses the same grammar |
| One again, please name your grammar with name-eng-week4.lfg |
| Exercises on: | |
| PART 1: | coordination |
| PART 2: | ambiguity |
| PART 3: | subordinate clauses |
There is one grammar this week; try to do Part 1 before the others since otherwise the grammar will have too much spurious ambiguity (Parts 2 and 3 are not crucially ordered):
Do not use capital letters; in later grammars we will add these in. 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-week4.lfg
then whenever you start xle in that directory, it will automatically load eng-week4.lfg. This will save a lot of time when making and testing changes.
This grammar has been poorly engineered and contains a number of spurious ambiguities. The task is to remove them.
Parse the sentences:
he saw her. he saw the telescope.
These sentences both get two parses; they should only get one. Note that the lower right xle window has two blank boxes; this is usually, but not always, a sign that something is wrong since it indicates two identical f-structures. Alter the grammar so that they each get only one parse. Make sure that you can still parse:
they ate. he gave her a telescope.
Parse the sentences:
he eats. he sees her. he gives her the telescope.
These sentences all get two parses; they should only get one. Alter the grammar so that they only get one parse. [Hint: try parsing some sentences plural subjects and see how they behave.]
Count nouns in English either need to be plural or to have a specifier; this grammar was meant to encode that generalization. This was done by having count nouns like girl and banana call COUNT-NOUN-SG and COUNT-NOUN-PL.
Parse:
the girls ate. she ate the bananas.
These both get two parses; they should only get one. Compare them to sentences with plurals without determiners (girls ate.) and with singulars with determiners (the girl ate.). Alter the grammar so that they only get one parse and you can still parse:
girls ate. the girl ate.
But you should not be able to parse:
girl ate.
For this part, you should use the grammar you got as a result of doing Part 1. This grammar has two basic coordination macros already defined:
SC-COORD(_CAT) NP-COORD(_CAT)
Put in a call to NP-COORD in the NP rule. To do this, you will need to create a disjunction between what the rule currently has as its right hand side and the call. The call will look like:
@(NP-COORD NP)
The value NP is passed in because this is the category you are going to be coordinating at this level. If you had been putting this in another nominal rule, like Nbar (no, there is not one in this grammar), then the call would have been:
@(NP-COORD Nbar)
Your grammar should be able to parse:
the monkey and the girl devoured a banana.
Note: Do not get over-zealous and start putting this in for all the nominals; the third exercise will have you do this via the METARULEMACRO. The same goes for SC-COORD.
Put in a call to SC-COORD in the PP rule. As with the NP coordination, you will need to create a disjunction in the PP rule. Your grammar should be able to parse:
they laughed in the park and in the garden.
Make sure you can still parse non-coordinated PPs like:
they laughed in the park.
Many meaning oriented applications want to know what c-structure level the coordination occurred at. This information can be stored as a feature in the f-structure (instead of having to look back at the c-structure to derive it).
Alter NP-COORD and SC-COORD so that they assign a feature COORD-LEVEL to every coordination. This feature should appear at the same level as the CONJ-FORM feature. So, a sentence like:
the girl and the monkey devoured the banana.
Should look roughly like:
[ PRED 'devour' SUBJ [ { [ PRED 'girl' SPEC def ] [ PRED 'monkey' SPEC def ] } CONJ-FORM and COORD-LEVEL NP NUM pl ] ]
As discussed last week, METARULEMACRO is a predefined macro that applies to all of the rules in the grammar. Currently, it is set to just give back the right hand side of the rule that you already defined.
Add a disjunct to METARULEMACRO that calls SC-COORD. You will need to pass in _CAT to the template:
@(SC-COORD _CAT)
Comment out the call to SC-COORD that is currently in the PP rule. (Don't remove it since we want to make sure you got the call right for exercise 1.)
Parse the following sentences to see if things are working right (the second one will have two parses):
the monkey ate in the park and in the garden. the monkey ate and devours a banana. the monkey ate a banana and devours a orange.
With this formulation, NPs will be affected by both NP-COORD which is called in the NP and by SC-COORD which is called by METARULEMACRO. It is also applying to N, which should be going through NP-COORD. This can be constrained in METARULEMACRO by adding a constraint in the disjunct:
e: _CAT ~$ { N NP };
@(SC-COORD _CAT)
Finally, add another disjunct into METARULEMACRO for NP-COORD. This should be restricted to only apply to NP and N. To do this, you need set notation similar to that above only instead of a negative condition, this is positive condition with $ (instead of ~$ for SCCOORD).
Parse the testsuite eng-week4-coord-test.lfg with your grammar. Make sure that everything parses. If you look at the comments in the grammar, you will see that some of the examples will get more than one parse (it is possible that the way you did the assignment will result in slightly different parse statistics).
When you coordinate NPs, the PERS of the coordinated NP depends on the PERS feature of the conjuncts. The rules are basically:
Mary and I saw ourselves in the mirror.
You are Mary saw yourselves in the mirror.
John and Mary saw themselves in the mirror.
The goal of this task is to encode this in the grammar in the NP-COORD macro so that the coordinated NP has a PERS feature with the correct value. What you are going to want to do is have a set of equations on the _CAT in NP-COORD (you will want to keep the @IN-SET part as is). These equations will look down into the _CAT (!) to determine its PERS and then sometimes assign a PERS feature to the coordinated NP (^). You will probably need a combination of constraining and defining equations to do this properly. The same set of equations can go on both instances of _CAT; you can put these in a template (NP-COORD-PERS) and call it from NP-COORD so that you don't have to keep retyping the equations in both places.
Some NPs to try:
NP: the girl and the monkey NP: the girl and I NP: you and the girl NP: you and I
Note: The equations are likely to be quite ugly. Don't worry about
this.
Also don't worry about getting the constraints on why it is the
girl and I instead of I and the girl (it is unclear whether
this should be done in the syntax at all).
The goal of this part is to add in that clauses like:
the girl knows that the monkey slept.
Verbs like this take a SUBJ and COMP; there is a template V-COMP for this. The f-structure you want should look roughly like:
[ PRED 'know' SUBJ [ PRED 'girl' ] COMP [ PRED 'slept ' COMP-FORM that SUBJ [ PRED 'monkey' ] ] ]
To do this, you will need to:
You should be able to put any sentence you could parse before as the complement of the that. Put in a comment in your new rule a couple of sentences you can now parse. You should also be able to have nested versions such as:
the girl knows that the girl knows that the monkey slept
If it does not already parse them, modify your new that clause rule to allow sentences like:
the girl knows the monkey slept
Turn in: The new version of your grammar.
The .new version of your testsuite from the coordination section.
If you have any questions, you can send us emailor call us (Ron: 812-4348; Tracy: 812-4808)