Ling 571 - Deep Processing Techniques for NLP
Winter 2011
Homework #5: Due 11:59 February 22, 2011
Goals
Through this assignment you will:
- Explore the logic and lambda calculus based representations of natural language semantics.
- Analyze the interaction between semantic attachments and syntactic structure for semantic analysis.
- Gain some further familiarity with NLTK.
- Augment grammars with semantic attachments to produce sentential analyses .
Background
Please review the class slides and readings in the textbook on meaning representation and semantic analysis. Also, review Chapter 10 of the NLTK book for additional detailed examples of logical structures in semantics and the implementation of semantic attachments for some common phenomena in natural language.
Creating Semantic Representations
Based on the examples in the text, class slides, and NLTK Chapter 10,
create representations in first-order logic for each of the example sentences
in the file. Your representations should employ the event-style semantics
presented in class.
Store your semantic representations in a file called sentences.semantics.pdf, if you want to use "fancy" symbols, or sentences.semantics.txt, if you choose to use the NLTK-style formatting instead.
Building a Grammar with Semantic Attachments
Based on the materials above, create a set of context-free grammar
rules augmented with semantic attachments that are adequate to analyze a
small set of English natural language
sentences and produce appropriate semantic analyses.
Your grammar should be able to produce an appropriate semantic analysis for
each sentence in the file.
You may hard-code capitalization.
Data
The sentences to analyze are found in
this file.
Grammar Format
The grammar should be written in a format that can be read in by
nltk.data.load() and stored in a file named grammar.fcfg.
Parsing
Create a program to parse the example sentences based on your grammar
and analyze the results. Specifically, your program should:
- Load your grammar.
- Use nltk.parse.FeatureEarleyChartParser class
to parse the sentences.
- Write the results to a file called results.
- For each example sentence, output to a file
- the semantic representation of the input sentence.
Note: You only need to print a single representation if the sentence is ambiguous.
Files
Please name your program hw5.cmd and your output file results
Please comment all code and remember to include your name in a comment at the
top of each file.
Testing
Your program must run on patas using:
$ condor-submit hw5.cmd
Please see the CLMA wiki pages on the basics of using the condor
cluster.
All files created by the condor run should appear in the top level of
the directory.
Handing in your work
All homework should be handed in using the class CollectIt.
Use the tar command to build a single hand-in file, named
hw#.tar where # is the number of the homework assignment and
containing all the material necessary to test your assignment. Your
hw1.cmd should be at the top level of whatever directory structure
you are using.
For example, in your top-level directory, run:
$ tar cvf hw5.tar *