Yliopiston etusivulle In English
Helsingin yliopisto
clt361: Grammar Engineering - lukuvuosi 2009-2010


Nykykielten laitos

PL 24 (Unioninkatu 40)

Puhelin +358 (09) 1911 (vaihde)
Faksi +358 (09) 191 28313

Typed Feature Structures

  • Make a new subdirectory lkb-cfg-2 for this exercise. Copy all the files from ~gwilcock/delphin/lkb/src/data/itfs/g2agr into your lkb-cfg-2 directory. These files define the different parts (lexicon, types, rules, etc) of a simple context-free grammar.
  • Start LKB, use Load->Complete grammar, and select the script file from your lkb-cfg-2 directory to load the grammar. Study the type hierarchy which is displayed in the type hierarchy window. Note that the type word has two subtypes sg-word (singular word) and pl-word (plural word).

Agreement and unification

  • Parse this dog sleeps and these dogs sleep. Then try these dogs sleeps, which fails because this grammar requires agreement between subject and verb. View the file rules.tdl in your lkb-cfg-2 directory and check which rule requires this kind of agreement, and how the agreement is specified in the rule.
  • Also try these dog sleeps, which fails because the grammar requires agreement between determiner and noun. View the file rules.tdl and check which rule requires this kind of agreement, and how the agreement is specified in the rule.

Lexical entries and the type hierarchy

  • Using a text editor, edit the lexicon lexicon.tdl in your lkb-cfg-2 directory. Add lexical entries for that, those, cat, cats, walks, walk, taking care with the difference between sg-word and pl-word. Reload the grammar and try parsing that cat walks, that cat walk, those cats walk, those cats walks.
  • Try parsing the cat walks and the cats walk. Is the determiner the singular, or is it plural? Compare the lexical entry for the with the entries for this and these. Note that the is of type word, and is not restricted to sg-word or to pl-word.
  • Add a lexical entry for the past tense verb walked. Reload the grammar and try parsing the cat walked and the cats walked. They should both be allowed.
  • Add a lexical entry for the noun moose. The plural form of moose is also moose, the same in singular and plural. Reload the grammar and parse this moose walks and these moose walk. Both should be allowed, but the resulting feature structures should be different. Parse the moose walks and the moose walk and compare the feature structures. Finally, parse the moose walked. Is it singular or plural?

Lists as feature structures

  • In LKB, lists are feature structures of type *list*. Non-empty lists (type *ne-list*) have two attributes FIRST and REST. The value of FIRST is the first item in the list. The value of REST is a list of all the other items in the list. Empty lists have a special type *null* and do not have FIRST and REST.
  • A list of one item aaa is a feature structure
    [ FIRST aaa, REST *null* ].
  • A list of two items aaa, bbb is
    [ FIRST aaa, REST [ FIRST bbb, REST *null* ]].

Grammar rules as feature structures

  • In LKB, grammar rules are also feature structures. Check how the grammar rules are represented in rules.tdl in lkb-cfg-2.
  • The left-hand side (mother) of a rule is a feature structure of type phrase, which has an attribute ARGS (arguments) of type *list*.
  • The right-hand side daughters of a rule are represented as a list. This list of daughters is the value of the mother's ARGS attribute.
  • Grammar rules usually have one daughter, or two daughters, or three daughters. Both of the rules in your lkb-cfg-2 grammar have two daughters.
  • Extend your grammar to include three different verb subtypes: the intransitive verb walked, the transitive verb chased, and the ditransitive verb gave. Include three different VP grammar rules for VP -> V, VP -> V NP, and VP -> V NP NP. Test the extended grammar with the cat walked, this dog chased that cat, and this moose gave that moose the dog.
© 2006-2010 Graham Wilcock

Hae laitoksen sivuilta:

Laitoksen etusivulle | Tiedekunnan etusivulle | Yliopiston etusivulle

Copyright © 2003-2005 Helsingin yliopisto. Kaikki oikeudet pidätetään.