Exercise 7, Grammar Development

Adding a Finite-State Morphological Analyzer


In this exercise, you will practice integrating a morphological analyzer into your grammar. Up to now you have been working with a full form lexicon. This means you have full control over the lexical entries within your grammar, but it is also very tedious as you have to write a separate lexical entry for each inflected (or derived) form.

In this exercise we will work with a version of the finite-state morphological analyzer that is part of the English ParGram grammar. It is called english.infl.patch.full.fst and can be found in the "prelex" folder of the English ParGram grammar. The English ParGram grammar is available to you via the XLE license.

Alternatively, you can also build your own finite-state morphological analyzer and hook it up, or use a different type of analyzer altogether. Details as to the morphology-grammar interface can be found in the Starter Notes and in the XLE Morphology Section.

You can use grammar6.lfg as a starting point. It already contains a sublexical rule for verbs as well as several entries for morphological tags.

Extending the Grammar: Nouns and Adjectives

grammar6.lfg already interacts with the morphological analyzer with respect to verbs.

Now expand the grammar so that nouns and adjectives are also coming out of the morphological analyzer.

Generally proceed in the following way:

  1. In this exercise, we are working with a morphological analyzer that is a "black box" for us. That is, we know what the input is, but we don't know the inner workings of the morphological analyzer. In order to see what the output of the morphological analyzer is from within XLE, type "morphemes some-word". For example:
    % morphemes bananas
    analyzing {bananas}
    {bananas "+Token"|banana "+Noun"  "+Pl"}
  2. If this works, it is a sign that the morphological analyzer is part of the grammar.
  3. The "morphemes" command shows oen what the output of the morphological analyzer is. Use this knowledge to integrate the relevant information into the grammar.
    1. Make sure you have an entry for all the tags that are produced as output, i.e., "+Noun" and "+Pl" in the example above. If not, add the missing ones in.
    2. Decide what functional information you want associated with any given tag. Where possible, use existing templates from your grammar.
    3. You can also decide to have no information associated with a tag, for example: "+Verb V-POS XLE ."
    4. Now write sublexical rules that can parse all the tags in the right order.
  4. You should make sure that the following sentences work, with the nouns and the verbs coming from the morphological analyzer:

The unknown entry

In the MORPHOLOGY section there is an "unknown" entry which allows the morphological analyzer to pass its knowledge about lexical items into the grammar.

-unknown  ADJ-S XLE (^ PRED) = '%stem';
	  N-S XLE (^ PRED) = '%stem'.

This entry has the effect that any word not present in the Lexicon section of grammar6.lfg will be guessed to be either a noun or an adjective. If this word follows the sublexical rules specified in the grammar, then it can be parsed by the grammar.

You do need to write lexical entries for those words which do not have guessable functional annoations. For example, the morphological analyzer does not know whether a verb is intransitive, transitive, ditransitive, etc. So for verbs you need to specify the head word (lemma) and the relevant subcatgorization information in the lexicon.

For nouns and adjectives, this is not necessary, as the "unknown" guesser in guesses words not in the lexicon to be either nouns or adjectives. So, unless you wanted to specify extra information for a particular lemma, you do not need to have extra entries for nouns and adjectives in your lexicon. Try deleting (or commenting out) all the ones you have entered and see if your testsuite still works.

Lexicon Edit Entries

You have several entries in your grammars that could be several different Parts-of-Speech (for example "dog" has been encoded as a verb and as a noun). When you delete your noun entry for "dog", you need to make sure that the remaining entry interacts properly with the -unknown entry in the morph-lex-10.lfg file. The way to do this is to specify that the verb entry is not the only entry.

dog 	  +V-S XLE @(TRANS dog);

Read more about the interactions between lexical entries and lexicons in XLE Lexicon Entries and Lookup Model.

The Grammar Writer's Cookbook, Ch. 12 (finite-state morphologies)

Kaplan, Ron, John T. Maxwell III, Tracy Holloway King and Richard Crouch. 2004. Integrating Finite-state Technology with Deep LFG Grammars. In Proceedings of the ESSLLI04 Workshop on Combining Shallow and Deep Processing for NLP.

Starter Notes

XLE Morphology Section

XLE Lexicon Entries and Lookup Model