Grammar Writing: Week 2
The Grammar dt-01-FirstWords
You received a grammar with the name above. When you open the grammar, you will see that it just contains one type in the type hierarchy, namely the type bot. This is the most general type in all of grammars All other types that we define are its subtypes. The only purpose of bot is to allow us to define our own more specific subtypes that do some real work for us.
The goal of the first grammar is to write lexical entries for the two words lilly and smokes. All this grammar will then do is to recognize the two strings lilly and smokes and tell us that they represent words.
Before, we can write lexical entries or add anything else to a grammar, we first need to define the type hierarchy! We will do this together.
Task 1
Add the type word as a subtype of bot.
Now we have a first type in the grammar that we can do something useful with.
Task 2
Add the two words lilly and smokes!
Here, you can check what your grammar can do at this point: it recognises lilly and smokes and says that they are words. No more and no less!
Task 3
Upload your grammar to the server and parse the following strings and inspect the result:
# lilly
# smokes
# fido
# danced
If everything went well, then you have just successfully written your first grammar. Congratulations!
The Grammar dt-02-FirstFeature
Task 1
Add the types word and syntax as subtypes of bot.
Task 2
# Add the types noun and verb as subtypes of syntax.
# To the type word, add the feature SYNTAX of type syntax.
Task 3
Add the two words lilly and smokes. Give them the SYNTAX value that is appropriate for them.
Task 4
Upload your grammar to the server and parse the following strings and inspect the result:
# lilly
# smokes
Illustration: Words
Recall that we said above that a grammar consists of a lexicon of words and rules for making phrases, i.e. phrase structure rules. Let us begin by defining some English words.
If we want to begin entering words into our lexicon, then we must first tell the grammar that we want to make use of things of type word. Conceptually speaking, this means that we add the type word to the type hierarchy. The following video shows you how to do that in DesktopTrale:
How to add types to the type hierarchy
After this simple step, we are now ready to add our first words to the lexicon. How to do that is shown in the following video:
How to add lexical entries to the lexicon
So, go ahead and add the words Lilly and smokes to your grammar!
-->
In the grammar fire that you receive, some types have already been defined for you. These types are used in every grammar and you should not change their definitions. There are 7 types:
- The type bot. This is the most general type in all of our hierarchies of grammatical objects. All other types are its subtypes. Its only purpose is to allow us to define more specific subtypes that do some real work for us.
- The type list, which is a subtype of bot.
- The type e_list, which is a subtype of list.
- The type ne_list, which is a subtype of list.
- The type bool.
- The type plus, which is a subtype of bool.
- The type minus, which is a subtype of bool.
The best way to think of bot is as the type of grammatical objects. Since every other type is a subtype of bot, this means that every other object we define is a grammatical object. Lists (= list) and boolean objects (= bool) thus are the first two grammatical objects that we introduce and they will be part of every grammar we write. These concepts are explained in the next two subsections.
The Notation for Declaring Types and Subtypes in this Wiki
type1 type2 (= first immediate subtype of type1) type21 (= first immediate subtype of type2) type22 (= second immediate subtype of type2) type23 (= third immediate subtype of type2) type3 (= second immediate subtype of type1)
The Notation for Declaring Features in this Wiki
To declare that type23 has the features feature1, feature2, ..., feature5 with values type1, type2, ..., type5, we write:
type23 feature1:type1 feature2:type2 ... feature5:type5
Types That Appear in Every Grammar
bool(ean)
This type is named after the English logician George Boole, who developed what is now called Boolean algebra. According to Wikipedia, this is the branch of algebra in which the values of the variables are the truth values true and false ...
In linguistics, it is customary to use plus and minus instead of true and false.
Formal Definition
bot bool plus minus
Informally: bool is an immediate subtype of bot and has the two immediate subtypes plus and minus. None of the three types bool, plus, and minus introduces any features.
Example
The type is used as the value of the feature AUX to distinguish between main and auxiliary verbs:
auxiliaries: [AUX plus]
main verbs: [AUX minus] .
list
A list is an ordered collection of elements. There are two types of lists:
- The empty list (e_list): it has no elements in it.
- The non-empty list (ne_list): it consists of two parts, a head (hd)element (which can be an any type) and a tail (tl) (the rest of the list, which is also a list).
Formal Definition
bot list e_list ne_list hd:bot tl:list
Informally: list is an immediate subtype of bot and has the two immediate subtypes e_list and ne_list. The types list and e_list introduce no features. The type ne_list introduces the features hd with value bot and tl with value list.
Notational simplifications
a. < > is short for e_list.
b. <A> is short for (hd:A, tl:e_list).
c. <A,B> is short for (hd:A, tl:(hd:B, tl:e_list)) .
Example
The type is used as the value of the valence features SUBJ, SPR, and COMPS.
- a SUBJ list that is empty: [SUBJ < >] .
- a COMPS list that contains an NP and a PP: [COMPS <NP,PP>].
Illustration: Words
Recall that we said above that a grammar consists of a lexicon of words and rules for making phrases, i.e. phrase structure rules. Let us begin by defining some English words.
If we want to begin entering words into our lexicon, then we must first tell the grammar that we want to make use of things of type word. Conceptually speaking, this means that we add the type word to the type hierarchy. The following video shows you how to do that in DesktopTrale:
How to add types to the type hierarchy
After this simple step, we are now ready to add our first words to the lexicon. How to do that is shown in the following video:
How to add lexical entries to the lexicon
So, go ahead and add the words Lilly and smokes to your grammar!
-->
Navigation:
Main Page Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 Week 8