Practical Grammar 2: Difference between revisions
Line 54: | Line 54: | ||
S, NP, N, VP, V, PP, P, AP, A, D | S, NP, N, VP, V, PP, P, AP, A, D | ||
== The first example sentence == | |||
* Go to the xlfg window. | |||
* Click on "Sentences". | |||
Under "Sentences to parse" you see all the test sentences for the grammar. Our first example sentence is already listed. Eventually, you will have to enter the other example sentences as well. | |||
The example sentences is "John disappeared" and on the right we have told the program that this sentence is grammatical in English. | |||
We will now test this example against the our grammar. To this end, | |||
* Click on the blue "Parse" button right below the name of our project. "to parse" in German means "Daten analysieren". | |||
This instructs xlfg to inspect all test sentences to see whether the grammar licenses them. | |||
The result is diappointing: a new window opens and we see our test sentence in red. This means that the grammar could find a well formed constituent structure for the sentence and predicts that it is ungrammatical in English. This prediction is wrong, which means we need to change the grammar. | |||
* Click on "Input" to get back to the editor window. | |||
Let us find out why the grammar cannot parse the sentence "John disappeared". Let us inspect the grammar! | |||
* Click on "Lexicon". There is only one line: | |||
John N; | |||
This says that there is a lexical entry spelled "John" and that its syntactic category is "N". |
Revision as of 15:09, 5 November 2020
xlfg
Your first grammar in xlfg
Please do the following:
You first log onto xlfg:
- Go to https://xlfg.labri.fr/ and log in.
Then you locate our workshop:
- Choose Workshops|All Workshops.
- Look for the workshop "Practical Grammar".
- In the column "Action", click the button "Consult the workshop".
Now you find a project of the workshop:
- On the right side of the screen is the list of projects of our workshop.
- Look for "Practical_Grammar 1" and click on "Create your own version".
- Now click on "Edit your version".
You have now arrived in the grammar editor for the grammar "Practical_Grammar 1", where you can make changes to the grammar.
Look around a bit, but leave the buttons "Output Parameters" and "Output" alone for now.
Clicking on the buttons in the row beginning with "Sentences". Whenever you do, a window will open where you can enter or change information. Do not make any changes yet. To get to a different input window, just click on its button.
The four input buttons have the following functions:
- Sentences: here you can type in example sentences that you want to test.
- Declarations: here you can enter information that determines the behavior of the program.
- Grammar: this where you add phrase structure rules.
- Lexicon: the place to write lexical entries.
Exercise 2
We are now going to write a first grammar. The goal of the grammar is to recognize all the sentences from Exercise 1 in Week 1. Here they are one more time, together with the syntactic categories we want to use in the exercise:
Sentences
(1) John [disappeared].
(2) The bottle [broke].
(3) Martha [stayed at the hospital].
(4) Fred [resides in Chicago].
(5) Robert [went to the hospital].
(6) Alice [moved into the room].
(7) Joe [saw Fred].
(8) Alice [broke the bottle].
(9) We [moved it into the room].
(10) Fred [took Alice to the hospital].
(11) John [sent Martha a check].
(12) We [gave Fred a wastebasket].
Syntactic Categories
S, NP, N, VP, V, PP, P, AP, A, D
The first example sentence
- Go to the xlfg window.
- Click on "Sentences".
Under "Sentences to parse" you see all the test sentences for the grammar. Our first example sentence is already listed. Eventually, you will have to enter the other example sentences as well.
The example sentences is "John disappeared" and on the right we have told the program that this sentence is grammatical in English.
We will now test this example against the our grammar. To this end,
- Click on the blue "Parse" button right below the name of our project. "to parse" in German means "Daten analysieren".
This instructs xlfg to inspect all test sentences to see whether the grammar licenses them.
The result is diappointing: a new window opens and we see our test sentence in red. This means that the grammar could find a well formed constituent structure for the sentence and predicts that it is ungrammatical in English. This prediction is wrong, which means we need to change the grammar.
- Click on "Input" to get back to the editor window.
Let us find out why the grammar cannot parse the sentence "John disappeared". Let us inspect the grammar!
- Click on "Lexicon". There is only one line:
John N;
This says that there is a lexical entry spelled "John" and that its syntactic category is "N".