Assignment 3 : Grammars and Parsing

Due Wednesday, October 24



Code

Several modules and examples of nltk code are available at http://www.cs.vassar.edu/~cs395/code.

Exercises

1.  Creating and implementing a grammar fragment 


Sentences to accept:
she sees him
they see him
they see the woman
they see the women
I know her
I know the man whom she sees
I know the woman who sees him
the woman who sees him walks
the women who see him walk

Sentences to not accept:
*she sees he
*they sees him
*me know her
*I know the woman whom sees him
*the woman who sees him walk
*the woman who see him walks
*the women who sees him walk
*the women who see him walks

You may find that you need to revise your grammar as the implementation exposes flaws in it (eg, it can parse sentences that should be disallowed). Some of these may be implementation bugs while others may be thinking bugs that were actually problems with the grammar you defined in exercise 1. Comment on how this process went for you, especially if the implementation revealed the latter type of error. (Note: it is fine to change your answer to exercise 1 if the implementation did expose errors!)


2.  Finding subcategorization frames

Resources

Code

There are several modules in the course code directory that you can use, either directly or as models for your code. They include:
bigramscomputes bigrams for a corpus
buildStoplistbuildStoplist : builds a list of stop words (words not to be included in an analysis)
compareModals comparison of modals in parts of the Brown corpus (from class slides)
concordance.pygenerates a concordance of a given word as well as collocates
conditional_probcomputes a conditional probability for a POS tag for each word
countTagscomputes the tag most often assigned to words in a tagged corpus
find_namesfinds proper names (sort of) (from class slides)
freqdistcomputes a frequency distribution for words in genesis and prints the token with greatest number of occurrences (from class slides)
init reads the plain text 911 report file
storyGentry to generate a story (from class slides)
wordcountscounts words in the text
wordcounts-textdoes the same as wordcounts but prints each word and frequency
extraction_grammar.pyDefines a grammar and parses supplied sentences

Links

In addition to the nltk tutorial, here are some links to resources that describe the various nltk modules etc.:

nltk api              : an api for the modules in nltk. Check out the index, which I find most useful
nltk source        : the source of nltk modules, just  in case it helps



What to hand in, and how

To submit your assignment, send it by email to ide@cs.vassar.edu with the subject line CS395 ASSIGNMENT 3.