This assignment is due Wednesday, November 8 at 11:59PM.

Goals

Through this assignment you will:

Background

Please review the class slides and readings in the textbook on meaning representation and semantic analysis.

Creating Target Semantic Representations

Based on the examples in the text and class slides, manually create target representations in first-order logic for each of the sentences in the test sentence file (see the files section below). These forms constitute the semantic representations that your grammar and parsing process below should derive.

NOTE:Your representations should employ the event-style semantics presented in class. In this format, events (primarily, verbs) typically have the form
exists e.(eventing(e) & eventarg1(e,x1) & eventarg2(e,x2) … )

The format will parallel that of the automatically generated output. For each sentence you analyze, please write two lines:

If you want to use “fancy” symbols, please use a PDF file. You may also choose to use the NLTK-style formatting instead; that can be stored in a .txt file if you wish.

NOTE: Some of these sentences may be ambiguous, especially in relation to quantifier scope. Please provide only a single semantic representation for each.

Building a Grammar with Semantic Attachments

Based on the materials above and the format for implementing semantic attachments in NLTK Ch. 10 , 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 test sentence file (see the files section below). It should be written using the NLTK .fcfg format that can be read in by nltk.data.load().

Sample grammars made be found in NLTK book Chapter 10, the online grammars in /corpora/nltk/nltk-data/grammars/, and in the examples referenced above. NOTE: The NLTK grammars are provided largely to help with formatting the semantic attachments. Remember that the semantic analysis must employ the Neo-Davidsonian event-style semantics in the class slides. Many of the NLTK grammars do not.

Semantic analysis

Create a program to perform semantic analysis on the test sentences based on your grammar and output the results. Specifically, your program should:

Note: You only need to print a single representation if the sentence is ambiguous.

Programming

Create a program called hw6_semantics.sh which performs the parsing and compositional semantic analysis described above invoked as:
hw6_semantics.sh <input_grammar_filename> <input_sentences_filename> <output_filename> where,

Files

Please adhere to the naming conventions below.

Test and Example Data Files

All files related to this assignment may be found in /mnt/dropbox/23-24/571/hw6/, as below:

Submission files