# Linguistics 471: Grammar Engineering

## Lab 4 Due 5/2

Read all the way through the assignment once before starting it. Once again I'll be asking for write ups, differing slightly depending on which pieces of this assignment are relevant to your language. Watch for the flag "write-up" (in red) as you read the assignment.

### Background

The goal of this lab is to be able to parse the two sentences I can eat glass. It doesn't hurt me., and assign them appropriate semantics. You have already done some of the work: from previous labs, your grammar should already handle pronouns, case (if applicable), and transitive verbs. You should already have most of the vocabulary required (except can and not). You may need to add the appropriate verb forms, and may get inspired to add some lexical rules for verbal agreement in the process (if applicable, and if you haven't already).

You will need to add a treatment of however your language expresses the modal meaning {\it can} and of sentential negation. The instructions below outline several possibilities. If none of them fit what's going on in your language, contact me (preferably by email before Wednesday's lab).

### Semantic representations

Your semantic representations for the two sentences should look approximately like this. Acceptable forms of deviation would be: different quantifier relations (since not everyone has the same inventory), the variables (e's, x's, and h's) showing up with different numbers, and the SEMSORT information showing up in different places (it goes on the first instance of the variable, not on any particular relation, so depending on your word order, it might look different). The representations given here are copied from what the menu option "indexed MRS" produces.

• I can eat glass.
< h1,u2:SEMSORT,
{h3:pronoun_n_rel(x4:SEMSORT:FIRST:SG),
h5:pronoun_q_rel(x4, h7, h6),
h8:_can_v_rel(e9:SEMSORT:TENSE:ASPECT:MOOD, h10),
h10:_eat_v_rel(e11:SEMSORT:TENSE:ASPECT:MOOD, x4, x12:SEMSORT:THIRD:SG)
h13:_glass_n_rel(x12),
h14:indef_q_rel(x12,h16,h15)}
{h6 qeq h3,
h15 qeq h13} >


Things to note about this representation: _can_v_rel is a one-place relation, taking the handle of the _eat_v_rel as its argument. The _eat_v_rel is a two-place relation taking x4 (the index from the first-person pronoun) and x12 (the ARG0 of _glass_n_rel) as its arguments. Both _can_v_rel and _eat_v_rel have an additional slot of their event variables (e9 and e11).

• It doesn't hurt me.
< h1,u2:SEMSORT,
{h3:pronoun_n_rel(x4:SEMSORT:THIRD:SG),
h5:pronoun_q_rel(x4, h7, h6),
h8:_neg_r_rel(u10:SEMSORT, h9),
h11:_hurt_v_rel(e12:SEMSORT:TENSE:ASPECT:MOOD, x4, x13:SEMSORT:FIRST:SG),
h14:pronoun_n_rel(x13),
h15:pronoun_q_rel(x13, h17, h16)},
{h6 qeq h3,
h9 qeq h11,
h16 qeq h14} >


Things to note about this representation: The _neg_r_rel takes a handle as its argument, which is related through a qeq to the handle of the _hurt_v_rel. The qeq quantifiers to scope above or below _neg_r_rel so that I can't eat some cheese can either mean 'There is some cheese that I can't eat', or 'I can't eat just some cheese (I end up eating more)'. (The relationship between the _can_v_rel and the _eat_v_rel above should similarly be mediated by a qeq. However, the way the Matrix is written, this will only happen when we add our representation of illocutionary force. Rather than overwrite what's in the Matrix, we'll just live with the inaccuracy for now.)

### can as an auxiliary verb

Use this version if in your language the morpheme expressing the same notion as can is a separate word which takes a VP complement and a subject.

• Define a verb type (parallel to trans-verb-lex etc from Lab 1), which inherits from basic-verb-lex and trans-first-arg-raising-lex-item (and take a look at the definition of these types in matrix.tdl so you know what they're doing).
• In addition to inheriting from these types, your new type should put appropriate constraints on the values of ARG-S and the valence features.
• Make sure that it constrains the part of speech of each argument.
• If all of your verb types have constraints in common, consider moving those to a (new) supertype, say verb-lex, and inheriting from there.
• Define a lexical entry (with PRED value '_can_v_rel which inherits from your new type.
• Create the appropriate form of the verb meaning eat, either directly as a lexical entry, or via a lexical rule.
• Ensure that only that form of eat can appear as the complement of can (and add whatever items you use to test this to your master testsuite), and that the new form of eat can or can't appear in matrix clauses (as appropriate).
• In English, this involves defining a feature FORM on verb (subtype of head), somewhat similar to CASE on noun. At the moment, I have two possible values of FORM, fin (for finite verbs) and base (for base form verbs), as well as the underspecified value form. The lexical rules which create the various inflected forms (3sg, non-3sg, and base) specify a FORM value. Raising verbs require a [FORM base] complement. The root condition (roots.tdl) requires [FORM fin].
• Parse your translation of I can eat glass, and examine the chart for extra edges. Are they legitimate, or spurious? If they're spurious, try to rule them out (and then rerun your master testsuite to see if they were, in fact, spurious :-). Write-up: Describe in a paragraph or so either a spurious edge and how you ruled it out, or an edge which isn't used in the parse of the sentence but is nonetheless legitimate, and why it is legitimate.
• Parse your translation of I can eat glass and see if you get the right semantics. Debug as necessary.

### can as a bound morpheme

Use this version if the morpheme expressing the same meaning as can in your language attaches morphologically to the main verb of the sentence.

• The lexical rule you'll need to write adds a semantic relation (through C-CONT). Since the CONT of the mother is made up of the DTR..CONT and the C-CONT, it will be different from the CONT of the DTR. This means that we're changing SYNSEM information, and we can't inherit from lexeme-to-word-rule. On the other hand, we're not changing anything in CAT or NON-LOCAL, so we'll want to copy up some information. Furthermore, the HOOK of the mother comes from the HOOK of the C-CONT (courtesy of the type phrase-or-lex-rule defined in matrix.tdl and inherited by all lexical rules). So, we'll need to fill in some of the HOOK information on C-CONT. Taking all of this into consideration, here is the start of a definition of the lexical rule type:
potential-form-lex-rule := infl-ltol-rule &
[ SYNSEM [ LOCAL.CAT #cat,
NON-LOCAL #non-loc ],
DTR.SYNSEM [ LOCAL [ CAT #cat,
CONT.HOOK [ INDEX #ind,
XARG #xarg ]],
NON-LOCAL #non-loc ],
C-CONT [ HOOK [ INDEX #ind,
XARG #xarg ]]].

• In addition to the information above, you'll need to add the following constraints:
• The lexical rule's C-CONT.HCONS is empty (< ! ! >).
• The lexical rule's C-CONT.RELS contains a single relation of type arg1-ev-relation. The PRED value of that relation should be '_can_v_rel, the LBL should be identified with the C-CONT.HOOK.LTOP, and the ARG1 should be identified with the daughter's LTOP.
• Add an instance for your lexical rule to irules.tdl, with the appropriate spelling change information.
• Constrain your lexical rule to apply only to verbs, and test this. Add the sentences you used to test it to your master testsuite file. Write-up: Include in your write up a paragraph describing how you tested this.
• If you have other verbal inflection in your language, determine which lexical rule has to go first, and constrain the rules to only apply in that order. Make up nonsense forms with the affixes attached the other way around, and make sure that they don't parse. Add these sentences to your master testsuite file. If your other affixes attach to the other end of the verb, you'll want to constrain the order anyway, or you will end up getting double parses. Write-up: Include in your write up a paragraph describing how you tested this.
• Parse your translation of I can eat glass and see if you get the right semantics. Debug as necessary.

### Negation as an adverb modifier

Use this version if your language expresses sentential negation via an adverb which modifies the V, VP or S.

(Note: English has two forms of sentential negation "contracted", which is actually an affix on the verb, cf. Zwicky and Pullum 1983, and the full-form adverb. This adverb is not actually treated syntactically as a modifier in sentential negation, but rather selected by auxiliary verbs, including the do of do-support. For the details of this analysis, see Sag, Wasow and Bender 2003 chapter 13 and Kim and Sag 1995. I would be surprised if another language being treated in this class had a system very similar to the English one, as it seems like a pretty quirky part of English grammar. Further, it's a subtle matter to establish what is actually going on in English, and I don't think anyone would have time in one week to show the same about another language.)

• Determine where your negative adverb attaches: to V, VP or S and whether it attaches to the left or to the right of the node it attaches to.
• For testing purposes, develop a set of sentences contrasting the correct attachment with the incorrect attachments.
• Negative adverbs are scopal modifiers, so even if you did adverbs in the previous lab, you'll need to add some machinery:
• Define an instance of either adj-head-scop-phrase or head-adj-scop-phrase in rules.tdl. (These types are fairly fully specified, which is why we're skipping the step of putting anything in esperanto.tdl.) Which one you pick depends on whether your negative adverb is prehead or posthead. Look at the type definitions in matrix.tdl to decide which is appropriate.
• Create a type scopal-adverb-lex, as follows:
scopal-adverb-lex := basic-scopal-adverb-lex &
[ MOD < [ LOCAL [ CAT.HEAD verb,
CONT.HOOK [ LTOP #larg ]]]>],
VAL [ SPR < >,
SUBJ < >,
COMPS < >,
SPEC < > ]],
CONT.HCONS < ! qeq &
[ HARG #harg,
LARG #larg ] ! > ],
LKEYS.KEYREL.ARG1 #harg ] ].


NB: The type basic-scopal-adverb-lex is only defined in the new version of matrix.tdl. If you did adverbs last week, you'll need to update what you've done to take advantage of the new adverb types in the Matrix. Look at the types in the matrix (basic-scopal-adverb-lex and basic-int-adverb-lex) and let me know if you have any questions.

• Create a lexical entry which inherits from scopal-adverb-lex and introduces a relation with the PRED value 'neg_r_rel.
• Further constrain the MOD value of your lexical entry to ensure that the adverb only attaches to the right type of node (V, VP, or S, as appropriate). Write-up: Include in your write-up a paragraph describing the facts of your language that pertain to this point, and how you implemented the constraint.
• If you have already introduced adverbs into your grammar, you might need to do some work to make sure that your new adverb attaches to the correct side of its node. Test to find out, and debug as necessary.
• Test your grammar. Does the adverb show up only where it's supposed to? Do you get the right semantics for It doesn't hurt me.? Debug as necessary.

### Negation as a verbal affix

Use this version if your language expresses sentential negation by adding a morpheme to the main verb.

• The lexical rule for a negative verb will add a semantic relation in much the same way as the potential form (for can as verbal inflection) described above, so we can start from the same constraints (explained above):
negation-lex-rule := infl-ltol-rule &
[ SYNSEM [ LOCAL.CAT #cat,
NON-LOCAL #non-loc ],
DTR.SYNSEM [ LOCAL [ CAT #cat,
CONT.HOOK [ INDEX #ind,
XARG #xarg ]],
NON-LOCAL #non-loc ],
C-CONT [ HOOK [ INDEX #ind,
XARG #xarg ]]].


(In fact, if you're doing both of these rules, you might want to put this information in a supertype called meaning-adding-lex-rule and inherit it.)

• This time, the C-CONT RELS and HCONS lists, will each have one item on them:
RELS < ! adv-relation &
[ PRED '_neg_r_rel,
ARG1 #harg ] ! >

HCONS < ! qeq &
[ HARG #harg,
LARG #larg ] !>

• In addition, the C-CONT.HOOK.LTOP should be identified with the LBL of the adv-relation.
• Add an instance for your lexical rule to irules.tdl, with the appropriate spelling change information.
• Constrain your lexical rule to apply only to verbs, and test this. Add the sentences you used to test it to your master testsuite file. Write-up: Include in your write up a paragraph describing how you tested this.
• If you have other verbal inflection in your language, determine which lexical rule has to go first, and constrain the rules to only apply in that order. Make up nonsense forms with the affixes attached the other way around, and make sure that they don't parse. Add these sentences to your master testsuite file. If your other affixes attach to the other end of the verb, you'll want to constrain the order anyway, or you will end up getting double parses. Write-up: Include in your write up a paragraph describing how you tested this.
• Parse your translation of It doesn't hurt me. and see if you get the right semantics. Debug as necessary.

### Two-part negation

Use this version if your language expresses negation with both an affix on the verb and an adverb (e.g., French ne ... pas). If both elements are arguably affixes, you probably just want to write a pair of lexical rules, i.e., take the "Negation as a verbal affix" route, but write two rules and make sure you can require that they both apply or neither apply.

• The strategy here is going to be add the affix with a lexical rule similar to the one above, but to have it change the COMPS value and not add any semantics. The COMPS list will be the same as the input's COMPS list, with the addition of a negative adverb.
• We're assuming that the second part of the negation has an independent life as a negative adverb for constituent (i.e., not sentential) negation. This seems to work for French at first glance, I'd be curious about other languages. That adverb will have to have constraints on its MOD value that keep it from modifying finite verbs (which would give sentential negation). However, if you don't have any head-modifier rules in your grammar, you don't need to worry about that yet.
• The negative adverb needs some kind of distinguished value (the value of HEAD might be a good candidate) so that the rule won't license verbs just picking up any adverb as a complement.
• The inflected verb will "hand" its LTOP value to the negative particle, and adopt the negative particle's LTOP value as its own. Regular semantic composition should take care of the rest.
• Here's a start (untested -- sorry!), which assumes that the negative adverb is the first complement:
negation-lex-rule := infl-ltol-rule &
VAL [ SPR #spr,
SUBJ #subj,
[ MOD < [ LOCAL.CONT.HOOK.LTOP #larg ]>],
CONT.LTOP #ltop ],
REST #comps ],
SPEC #spec ]],
CONT [ RELS #rels,
HCONS #hcons,
HOOK [ INDEX #index,
XARG #xarg,
LTOP #ltop ]],
NON-LOCAL #non-loc ],
VAL [ SPR #spr,
SUBJ #subj,
COMPS #comps,
SPEC #spec ]]
CONT [ RELS #rels,
HCONS #hcons,
HOOK [ INDEX #index,
XARG #xarg,
LTOP #larg ]],
NON-LOCAL #non-loc ]].

• Test your grammar: Try parsing your translation of It doesn't hurt me. and see if you're getting the right semantics. Test sentences with each of the two parts of the negation independently, and verify that they don't parse. Try putting the two part negation on a non-verb, and verify that it doesn't parse. Add these sentences to your master testsuite file. Debug as necessary.
• Write-up: Describe what it took to go from these directions to a working analysis.

### Test your grammar and try generating!

• Use your master testsuite file to make sure you haven't lost any coverage from previous labs. Debug as necessary.
• Try parsing I can eat glass. and It doesn't hurt me. and then generating from the semantic representations your grammar produced.
• (If you see the error "probable circular lexical rule", it means your lexical rule is morphosyntactically capable of applying to its own output. Since the generator isn't constrained by any surface forms, it can keep adding inflectional endings...)
• To receive full credit on this lab, your grammar will need to be able to generate back the input string for these two sentences, and do so without generating too much other garbage.

### Write up

• In your write-up, describe how the meanings of can and sentential negation are expressed in your language.
• Describe how you implemented this in your grammar, being sure to include the information requested in the instructions above.
• Account for any overgeneration you see under "Test your grammar" above (at would you need to add to get rid of it?).