Grammar Writing: Week 2: Difference between revisions

From English Grammar
Jump to navigation Jump to search
 
(38 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<font face="Arial, Helvetica, sans-serif">
<font size="3">


= A Grammar for Cars =


= The Grammar '''dt-01-FirstWords''' =
[[File:Taxonomy-example.png|center|Types of cars]]


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.
 
 
= Defining a Car Type Hierarchy =
[[File:typehierarchy.png|center|Types of cars]]
 
<span style="color: blue>Task 1</span>
Load an empty signature.
In DesktopTrale, click on: ''Type Hierarchy -> Load TRALE Signature ->'' select the "signature" file in the directory ''grammars/dd-00-empty-signature''.
The type "'''bot'''" should appear. (You can center the visualization by '''right-clicking''' on the panel.)
 
<span style="color: blue>Task 2</span>
Add subtypes to "bot".
In DesktopTrale, expand and right-click the '''"bot"''' node in the TypeHierarchy tree navigation on the lefthand side.
Add appropriate subtypes. '''Note that only lower case letters and the underscore (_) are allowed as valid characters.'''
 
<span style="color: blue>Task 3</span>
Add features to the type '''car''' for fuel consumption and acceleration.
In DesktopTrale, add appropriate types for '''extent''' and '''speed''' as shown in the visualization.
Add features, by clicking on "Edit TH". The focused type should be '''car'''(!).
 
Click on +feature, and select type '''extent'''. Name the feature fuel_consumption.
 
Click on +feature, and select type '''speed'''. Name the feature acceleration.
 
Click on the "Type Hierarchy" node in the "Your Grammar" tab. Your visualization should look like the one above.
 
= The Grammar '''dt-00-empty-signature''' =
 
You received a grammar with the name above. When you open the grammar (click on ''Type Hierarchy'' -> ''Load TRALE Signature'' -> open the "signature" file in the folder), 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.
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.
Line 13: Line 44:


Now we have a first type in the grammar that we can do something useful with.
Now we have a first type in the grammar that we can do something useful with.
(Make your changes to the type hierarchy effective by clicking on ''Type Hierarchy'' -> ''Update Type Hierarchy''!)


  <span style="color: blue>Task 2</span>
  <span style="color: blue>Task 2</span>
Line 19: Line 51:
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!
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!


  <span style="color: blue>Task 3</span>
   
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!
If everything went well, then you have just successfully written your first grammar. Congratulations!
Line 34: Line 61:


  <span style="color: blue>Task 2</span>
  <span style="color: blue>Task 2</span>
  # Add the types noun and verb as subtypes of syntax.
  a. Add the types noun and verb as subtypes of syntax.
  # To the type word, add the feature SYNTAX of type syntax.
  b. To the type word, add the feature SYNTAX of type syntax.


   <span style="color: blue>Task 3</span>
   <span style="color: blue>Task 3</span>
   Add the two words lilly and smokes. Give them the SYNTAX value that is appropriate for them.
   Add the two words lilly and smokes. Give them the SYNTAX value that is appropriate for them.
= The Grammar '''dt-03-POSFeatures''' =
So far, your grammar treats all nouns alike. It says about every one of them that it is [SYNTAX ''noun'']. But not all nouns behave alike. For instance, some can function as subjects, but not all of them can, as you can see below:
<u>Subjects</u>:
(1) <u>Lilly</u> danced.<br>
(2) <u>She</u> danced.<br>
(3) *<u>Her</u> danced.<br>
(4) <u>I </u>danced.<br>
(5) *<u>Me</u> danced.<br>
(6) *<u>Him</u> danced.<br>
(7) <u>It</u> danced.<br>
We see that the following words can act as subjects: ''Lilly, she, I, it.''
Let us now test what happens when we try to use these words as direct objects and objects of prepositions:
<u>Direct objects</u>:
(8) Fido likes <u>Lilly</u>.<br>
(9) *Fido likes <u>she</u>.<br>
(10) Fido likes <u>her</u>.<br>
(11) *Fido likes <u>I</u>.<br>
(12) Fido likes <u>me</u>.<br>
(13) Fido likes <u>him</u>.<br>
(14) Fido likes <u>it</u>.<br>
<u>Objects of prepositions</u>:
(15) Fido talks about <u>Lilly</u>.<br>
(16) *Fido talks about <u>she</u>.<br>
(17) Fido talks about <u>her</u>.<br>
(18) *Fido talks about <u>I</u>.<br>
(19) Fido talks about <u>me</u>.<br>
(20) Fido talks about <u>him</u>.<br>
(21) Fido talks about <u>it</u>.<br>
This data shows that the following words can act as objects: ''Lilly, her, me, him, it.''
So we see that not all nouns behave alike. Some can occur only in subject position ''(I, he, she)'', some only in object position ''(her, him, me),'' and a third group can serve both as subject and as object ''(Lilly, it).'' When we look at contrasting pairs such as ''I-me, he-him, she-her,'' it is clear that the form of the word decides its use in sentences: the first form in each pair can act only as a subject and the second one only as an object. Following traditional grammar, we will account for this as follows:
<span style="color: blue>'''Case Principle 1''' English nouns belong to one of two grammatical cases: nominative and accusative.</span><br>
<span style="color: blue>'''Case Principle 2''' Only nominative nouns can act as subjects and only accusative nouns can act as objects.</span>
This accounts for the words that can only serve in one function. But what about the words like ''Lilly'' and ''it'' which can equally well act as subjects and objects? The answer is simple. We will say that these words can be both nominative and accusative!
Another noteworthy aspect of the observations above is that they only apply to words of part of speech ''noun''. For verbs, adjectives, etc. it simply makes no sense to ask what grammatical case they carry.
This discussion leads us to introduce the concept of <span style="color: blue>part of speech features </span> and their possible values. We will say that <span style="color: blue>
the part of speech ''noun'' has the feature CASE with the possible values ''nom(inative)'' and ''acc(usative)''.</span> Moreover, we will require that whenever a word belongs to part of speech ''noun'', it must have the feature CASE and the feature must have one of the possible case values.  words we tested above as follows:
(22) Lilly, noun,[CASE ''case'']<br>
(23) she, noun, [CASE ''nom'']<br>
(24) her, noun, [CASE ''acc'']<br>
(25) I, noun, [CASE ''nom'']<br>
(26) me, noun, [CASE ''acc'']<br>
(27) him, noun, [CASE ''acc'']<br>
(28) it, noun, [CASE ''case'']<br>
Example (24) can be used to illustrate how each of these lines is to be understood. It says three things: a. the word under discussion is ''her'', b. the word belongs to the part of speech ''noun'' and c. for the noun feature CASE the word carries the value ''acc''. The other words where the value of the feature is either ''nom'' or ''acc'' are interpreted in the same way. This leaves the words ''Lilly'' and ''it'' in (22) and (28): [CASE ''case''] is our way of saying that a word is compatible with any possible specific case in English. Since there are only the two cases ''nom'' and ''acc'', this means that (22) is a short way of writing the following two lines instead:
(22a) Lilly, noun,[CASE ''nom'']<br>
(22a) Lilly, noun,[CASE ''acc''].<br>
<span style="color: blue>Exercise</span>
<span style="color: blue>Task 1</span>
Add the types ''word'' and ''syntax'' as subtypes of ''bot''.
<span style="color: blue>Task 2</span>
1. Add the types ''noun'' and ''verb'' as subtypes of ''syntax''.
2. To the type ''word'', add the feature SYNTAX of type ''syntax''.
<span style="color: blue>Task 3</span>
1. Add the types ''case'', ''nom'', and ''acc'' to your type hierarchy. (Add the types ''nom'' and ''acc'' as subtypes of ''case''.)
2. To the type ''noun'', add the feature CASE of type ''case''.


  <span style="color: blue>Task 4</span>
  <span style="color: blue>Task 4</span>
  Upload your grammar to the server and parse the following strings and inspect the result:
  Add all the words from examples (22)-(28) to your grammar. Give each word the SYNTAX value that will correctly predict the data in (1)-(22) in accordance with Case Principles 1 and 2! Give only a single lexical entry to words like ''Lilly'' and ''it''. Leave their CASE value unspecified.
  # lilly
 
  # smokes




Line 138: Line 242:




-->




Line 155: Line 258:




<!--


== Illustration: Words ==
== Illustration: Words ==
Line 174: Line 276:
[[Grammar-Writing/Universal-Types|Universal Types]]
[[Grammar-Writing/Universal-Types|Universal Types]]


-->


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:
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:
Line 323: Line 424:
Navigation:  
Navigation:  
<div align="center">
<div align="center">
   [[Grammar-Writing|'''Main Page''']] &nbsp; '''Week 1''' &nbsp; '''Week 2''' &nbsp;&nbsp; '''Week 3''' &nbsp;&nbsp; '''Week 4''' &nbsp;&nbsp; '''Week 5''' &nbsp;&nbsp; '''Week 6''' &nbsp;&nbsp; '''Week 7''' &nbsp; '''Week 8''' &nbsp;&nbsp;   
   [[Grammar_Writing|'''Main Page''']] &nbsp; [[Grammar_Writing:_Week_2| '''Week 2''']] &nbsp;&nbsp; [[Grammar_Writing:_Week_3| '''Week 3''']] &nbsp;&nbsp; [[Grammar_Writing:_Week_4| '''Week 4''']] &nbsp;&nbsp; [[Grammar_Writing:_Week_5| '''Week 5''']] &nbsp;&nbsp; [[Grammar_Writing:_Week_6| '''Week 6''']] &nbsp;&nbsp; [[Grammar_Writing:_Week_7| '''Week 7''']] &nbsp; [[Grammar_Writing:_Week_8| '''Week 8''']] &nbsp;&nbsp; [[Grammar_Writing:_Week_9| '''Week 9''']]  
</div>
</div>



Latest revision as of 16:05, 17 December 2017

A Grammar for Cars

Types of cars


Defining a Car Type Hierarchy

Types of cars

Task 1

Load an empty signature. 

In DesktopTrale, click on: Type Hierarchy -> Load TRALE Signature -> select the "signature" file in the directory grammars/dd-00-empty-signature. The type "bot" should appear. (You can center the visualization by right-clicking on the panel.)

Task 2

Add subtypes to "bot".

In DesktopTrale, expand and right-click the "bot" node in the TypeHierarchy tree navigation on the lefthand side. Add appropriate subtypes. Note that only lower case letters and the underscore (_) are allowed as valid characters.

Task 3

Add features to the type car for fuel consumption and acceleration.

In DesktopTrale, add appropriate types for extent and speed as shown in the visualization. Add features, by clicking on "Edit TH". The focused type should be car(!).

Click on +feature, and select type extent. Name the feature fuel_consumption.

Click on +feature, and select type speed. Name the feature acceleration.

Click on the "Type Hierarchy" node in the "Your Grammar" tab. Your visualization should look like the one above.

The Grammar dt-00-empty-signature

You received a grammar with the name above. When you open the grammar (click on Type Hierarchy -> Load TRALE Signature -> open the "signature" file in the folder), 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. (Make your changes to the type hierarchy effective by clicking on Type Hierarchy -> Update Type Hierarchy!)

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!


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
a. Add the types noun and verb as subtypes of syntax.
b. 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.

The Grammar dt-03-POSFeatures

So far, your grammar treats all nouns alike. It says about every one of them that it is [SYNTAX noun]. But not all nouns behave alike. For instance, some can function as subjects, but not all of them can, as you can see below:

Subjects:

(1) Lilly danced.
(2) She danced.
(3) *Her danced.
(4) I danced.
(5) *Me danced.
(6) *Him danced.
(7) It danced.

We see that the following words can act as subjects: Lilly, she, I, it.

Let us now test what happens when we try to use these words as direct objects and objects of prepositions:

Direct objects:

(8) Fido likes Lilly.
(9) *Fido likes she.
(10) Fido likes her.
(11) *Fido likes I.
(12) Fido likes me.
(13) Fido likes him.
(14) Fido likes it.

Objects of prepositions:

(15) Fido talks about Lilly.
(16) *Fido talks about she.
(17) Fido talks about her.
(18) *Fido talks about I.
(19) Fido talks about me.
(20) Fido talks about him.
(21) Fido talks about it.

This data shows that the following words can act as objects: Lilly, her, me, him, it.

So we see that not all nouns behave alike. Some can occur only in subject position (I, he, she), some only in object position (her, him, me), and a third group can serve both as subject and as object (Lilly, it). When we look at contrasting pairs such as I-me, he-him, she-her, it is clear that the form of the word decides its use in sentences: the first form in each pair can act only as a subject and the second one only as an object. Following traditional grammar, we will account for this as follows:

Case Principle 1 English nouns belong to one of two grammatical cases: nominative and accusative.
Case Principle 2 Only nominative nouns can act as subjects and only accusative nouns can act as objects.

This accounts for the words that can only serve in one function. But what about the words like Lilly and it which can equally well act as subjects and objects? The answer is simple. We will say that these words can be both nominative and accusative!

Another noteworthy aspect of the observations above is that they only apply to words of part of speech noun. For verbs, adjectives, etc. it simply makes no sense to ask what grammatical case they carry.

This discussion leads us to introduce the concept of part of speech features and their possible values. We will say that the part of speech noun has the feature CASE with the possible values nom(inative) and acc(usative). Moreover, we will require that whenever a word belongs to part of speech noun, it must have the feature CASE and the feature must have one of the possible case values. words we tested above as follows:

(22) Lilly, noun,[CASE case]
(23) she, noun, [CASE nom]
(24) her, noun, [CASE acc]
(25) I, noun, [CASE nom]
(26) me, noun, [CASE acc]
(27) him, noun, [CASE acc]
(28) it, noun, [CASE case]

Example (24) can be used to illustrate how each of these lines is to be understood. It says three things: a. the word under discussion is her, b. the word belongs to the part of speech noun and c. for the noun feature CASE the word carries the value acc. The other words where the value of the feature is either nom or acc are interpreted in the same way. This leaves the words Lilly and it in (22) and (28): [CASE case] is our way of saying that a word is compatible with any possible specific case in English. Since there are only the two cases nom and acc, this means that (22) is a short way of writing the following two lines instead:

(22a) Lilly, noun,[CASE nom]
(22a) Lilly, noun,[CASE acc].

Exercise

Task 1
Add the types word and syntax as subtypes of bot.
Task 2
1. Add the types noun and verb as subtypes of syntax.
2. To the type word, add the feature SYNTAX of type syntax.
Task 3
1. Add the types case, nom, and acc to your type hierarchy. (Add the types nom and acc as subtypes of case.)
2. To the type noun, add the feature CASE of type case.
Task 4
Add all the words from examples (22)-(28) to your grammar. Give each word the SYNTAX value that will correctly predict the data in (1)-(22) in accordance with Case Principles 1 and 2! Give only a single lexical entry to words like Lilly and it. Leave their CASE value unspecified.














Navigation: