Lab 2 (due 1/13 11:59 pm)
The goal of this lab is to test out an initial grammar, based on the automatically constructed grammar specification ("choices file"), and then improve on that choices file for two phenomena. Along the way, you will get your first experience with [incr tsdb()] and also do a small amount of testsuite development. You'll also begin to get familiar with the resources for your language.
This lab entails the following general steps:
- Read the full lab instructions, so you have a sense of where you're going.
- Get access to the resources (descriptive grammar, data files, choices file) for your language. Emily is working on preparing and providing these to everyone. Your job is to download them and familiarize yourselves with them. (In a couple of cases, there are alternative versions of the choices file. It's fine to just pick one and use it, or you can compare them if you like.)
- Upload the choices file into the customization system and refine it if necessary until you are able to produce a grammar.
- Document any fixes you had to make until you could get something working
- Process the test corpus, using [incr tsdb()], the LKB, and the initial grammar
- Examine the results of the test run for coverage, accuracy and ambiguity.
- Choose two phenomena to improve in the choices file
- Read up on how those phenomena work in the prose descriptive grammar
- Document those phenomena in a testsuite
- Process the test corpus and your testsuite using [incr tsdb()], the LKB, and the initial grammar.
- Examine the results of the second test run for coverage, accuracy and ambiguity, including as a diff to the original test run.
- Write it all up :)
Back to top
Preliminaries
Canvas Discussion
In order to encourage people to get started early, this assignment
requires that you post a question
to the discussion on the course Canvas
by Tuesday night. Examples: A question about something in these
instructions that's unclear, a question about something in your
grammar resources that's unclear, or a question about something in the
customization system that's unclear. Or all of the above! Ask away :)
Please use version control for your work in this class. You may use
any system you are comfortable with. Please negotiate this with your partner. If neither of you already have experience with version control systems, please post to Canvas for guidance ASAP.
Back to top
Starter grammar
The first task is to take the auto-generated choices file we have prepared and upload it into the Grammar Matrix customization questionnaire. Once you've done so, there may be some red asterisks indicating sections that need further answers. Please answer those sections (ask lots of questions on Canvas!) on the basis of your descriptive materials as best you can.
In the word order section, you can skip the auxiliaries if it's not
already filled out, by saying "no" on that question for now. You may
of course revise this answer (and any others) later.
Once you are free of red asterisks, download the grammar.
Back to top
Initial testsuite run
This requires access to [incr tsdb()], which means access to the software on linux. It is really preferable for everyone to be able to do this, but bare minimum at least one member of each group must have access. If that's not true for your group, please post to Canvas for advice ASAP.
Create a test suite skeleton
- Look at the contents of your grammar directory and locate the
subdirectory called tsdb.
- Make a subdirectory called corpus inside
tsdb/skeletons for your test suite.
- Edit tsdb/skeletons/Index.lisp to include a line for this
directory, e.g.:
(
((:path . "matrix") (:content . "matrix: A test suite created automatically from the test sentences given in the Grammar Matrix questionnaire."))
((:path . "corpus") (:content . "IGT provided by the linguist"))
)
- Copy the item file that will be available in the Google drive folder for your language to tsdb/skeletons/corpus/item.
- Note: If your item file has more than 1000 lines it, it is recommended to break it into several smaller profiles. You can make one skeleton for each. You can also choose to work with just one of them if you prefer! It might be fun to test from time to time though and see how much of the data your grammar can parse.
- Copy tsdb/skeletons/Relations to tsdb/skeletons/corpus/relations (notice the change from R to r).
- The final directory structure should look like this:
grammar/tsdb/skeletons/Index.lisp (lists the testsuites)
grammar/tsdb/skeletons/Relations (master copy of the database schema)
grammar/tsdb/skeletons/corpus/item (file provided)
grammar/tsdb/skeletons/corpus/relations (copy of ../Relations)
grammar/tsdb/home (directory to store test profiles)
Create and run an initial test suite instance
- Start the lkb
- Load your starter grammar. (The script file is in your-grammar-dir/lkb/script.)
- Start [incr tsdb()] by typing (tsdb:tsdb :podium) at the * prompt in the LKB buffer in emacs.
- In the [incr tsdb()] podium, select Options > Database Root
and input the path to tsdb/home.
- In the [incr tsdb()] podium, select Options > Skeleton Root
and input the path to tsdb/skeletons.
- Optional: For future use, you can set these variables
ahead of time in a file called .tsdbrc in your home directory.
It should contain these lines, with path names edited appropriately:
(tsdb:tsdb :home "path-to-tsdb/home")
(tsdb:tsdb :skeleton "path-to-tsdb/skeletons")
- In the [incr tsdb()] podium, select File > Create. You should
see your test suite in the menu there. Select it, and get a test suite
instance. Post to Canvas if this doesn't work.
- Make sure your grammar is loaded into the LKB.
- Once you have a test suite instance, select it (by clicking on it),
then do Process > All Items.
- Be sure to save (i.e., not overwrite or delete) this test suite
instance, as you'll be asked to turn it in.
Note If your tsdb/ directory is inside a shared folder on VirtualBox, it will not work.
Back to top
Explore the results
Collect the following information to provide in your write up, by using the [incr tsdb()] functions such as Browse > Results, Analyze > Coverage, and Analyze > Overgeneration.
- How many items parsed?
- What is the average number of parses per parsed item?
- How many parses did the most ambiguous item receive?
- What sources of ambiguity can you identify?
- For 10 items (if you have at least that many parsing), do any of the parses look reasonable in the semantics? (Emily will demo in class on Thursday.)
Back to top
Improve the choices file for two phenomena
Based on your analysis of the results of the preliminary run, choose two phenomena to improve in the choices file, from the following list. You're looking for phenomena that are affecting many sentences: either leading to lots of ambiguity or leading to lots of parse failure. I suspect that case and agreement will be most useful to attack first, if they are present in your language. We'll work on morphotactics next week. If somehow fewer than two of the options below are appropriate for your language, post to Canvas and we'll figure something else out to work on.
Improving the choices file means changing the information for these phenomena in the choices file --- probably both in the general section (e.g. did the original choices file have the right answer for the overall case system?) and on the morphology/lexicon sections. If the morphology is messy (as it likely will be), I encourage you to pick phenomena that involve fewer changes there, in your language.
Make sure you can parse individual sentences
Once you have created your starter grammar (or each time you
create one, as you should iterate through grammar creation and
testing a few times as you refine your choices), try it out on a
couple of sentences interactively to see if it works:
- Load the grammar into the LKB.
- Using the parse dialog box (or 'C-c p' in emacs to get the parse
command inserted at your prompt), enter a sentence to parse.
- You can identify sentences that should parse by looking at the results from your original [incr tsdb()] run.
- You can also parse individual sentences by using Browse > All items or Browse > Results in [incr tsdb()] and double clicking on the item.
- Examine the results. If it does parse, check out the semantics (pop-up menu on the little trees). If it doesn't look at the parse chart to see why not.
- Problems with lexical rules and lexical entries often become apparent here, too: If the LKB can't find an analysis for one of your words, it will say so, and (obviously) fail to parse the sentence.
Note that the questionnaire has a section for test sentences. If
you use this, then the parse dialog will be pre-filled with your test sentences.
Back to top
Create a testsuite for those phenomena
Create a small testsuite of examples, according to
the general instructions for
testsuites and the formatting
instructions, illustrating the phenomena you worked on above. The
testsuite should have both positive and negative examples, but doesn't
need to be exhaustive (since we're working with test corpora this
year), but you'll want both positive and negative examples for each of
the phenomena you work on in this section. I expect these testsuites
to have about 20 examples total by the end of this week, though you
can do more if you find that useful. All examples should be simple enough that your grammar can parse them or fails to parse them because of the one thing that's wrong with them.
Create a test suite skeleton
- Make a subdirectory called lab2 inside
tsdb/skeletons for your test suite.
- Edit tsdb/skeletons/Index.lisp to include a line for this
directory, e.g.:
(
((:path . "matrix") (:content . "matrix: A test suite created automatically from the test sentences given in the Grammar Matrix questionnaire."))
((:path . "corpus") (:content . "IGT provided by the linguist"))
((:path . "lab2") (:content . "Test suite collected for Lab 2."))
)
- Download the python script make_item, make
sure it is executable, and run it on your test suite:
make_item testsuite.txt
Notes on make_item:
- This script is going to be pretty picky about the format
of your test suite. If you have questions, please post to Canvas (10 minute rule!).
- It requires python3, which is on the current version of the Ubuntu+LKB appliance.
- Alternatively, you can copy your testsuite and make_item over to patas and run there, or install python3 (from http://python.org/download) on your host OS (mac or windows), and run make_item outside VirtualBox.
- If the above command is successful,
testsuite.txt.item
would be created in the working directory. If the testsuite contains errors, it's possible that a lot of output will appear on stderr. It maybe useful to redirect this into a file that you can use to go through
and correct the errors one at a time. For example:
./make_item testsuite.txt item 2>errs
The command just above attempts to create 'item' in the working directory, and stderr messages are redirected to the file 'errs'.
make_item
contains a default mapping from testsuite line types into particular fields of the [incr_tsdb()]
item file. The default mapping puts 'orth' into 'i-input', the field which the is the input to the grammar. If your grammar targets a different testsuite line, override the default mapping with the -m
/--map
option.
./make_item --map orth-seg i-input testsuite.txt item
The invocation above maps the orth-seg
line into the input field.
You can run make_item
with -h
/--help
to see a summary of the options.
- Copy the .item file which is output by make_item
to tsdb/skeletons/lab2/item.
- Copy tsdb/skeletons/Relations to tsdb/skeletons/lab2/relations (notice the change from R to r).
Run both the test corpus and the testsuite
Following the same procedure as the first time you ran your test corpus, do test runs over both the testsuite and the test corpus.
Again, collect the following information to provide in your write up. Please present 1-4 as some kind of table contrasting before & after.
- How many items parsed?
- For the testsuite, report separately for grammatical items (coverage) and ungrammatical ones (overgeneration)
- What is the average number of parses per parsed item?
- How many parses did the most ambiguous item receive?
- What sources of ambiguity can you identify?
- For 10 items (if you have at least that many parsing), do any of the parses look reasonable in the semantics? (Emily will demo in class on Tuesday.)
It is fine for these to be the same 10 items you examined on the first run!
Back to top
Write up
Your write up should be a plain text file (not .doc, .rtf or .pdf)
which includes the following:
- Please answer the following question: May I share this and future write ups with students working on the AGGREGATION project? (Yes or no are both perfectly fine answers!)
- Description the steps you had to take to get from the automatically constructed choice file to one that would both (a) customize and (b) compile.
- Your answers to the questions about the [incr tsdb()] runs (initial and after your improvements to the choices file), repeated here.
- How many items parsed?
- What is the average number of parses per parsed item?
- How many parses did the most ambiguous item receive?
- What sources of ambiguity can you identify?
- For 10 items (if you have at least that many parsing), do any of the parses look reasonable in the semantics? (Emily will demo in class on Thursday.)
- Documentation of the phenomena you have added to your testsuite,
illustrated with examples from the testsuite.
- Documentation of the choices you made in the customization
system, illustrated with examples from your test suite.
- This can be interleaved with the documentation of the phenomena
(so you describe each phenomenon and then the choices you used to add
an analysis of it to the grammar), but the documentation of the phenomenon and choices should be logically separate. Here's an example of what this should look like.
- Descriptions of any properties of your language illustrated
in your test suite but not covered by your starter grammar and/or
the customization system.
- If you have identified ways in which the automatically created choices file is particularly off-base, please report them here. If you can include IGT from the testsuite or your descriptive materials illustrating the problem, that is even better.
Back to top
Back to top
Back to course page
ebender at u dot washington dot edu
Last modified: