Assignment 9: Construction Grammar Learning
Assigned Thursday, April 24th
Due Thursday, May 1st, by 11:59pm - submit electronically.

This assignment involves two parts. The first is to get you familiar with the sentence analysis process, and the second to understand the grammar learning algorithm. You will be using a construction grammar analyzer to analyze sentences using a simple grammar written in ECG (Embodied Construction Grammar). You will then be asked to predict the result of grammar learning by examining sets of input tokens.

Please read O8, O9, Book Ch 25, and the Construction Grammar/ECG lecture slides before beginning this assignment.


Using the Analyzer

Run the program

Download a9-windows.zip or a9-linux.zip (or a9-linux64.zip for 64-bit Linux systems); these contain the analyzer program as well as the grammars for this assignment. The program should work using Java 1.5 or better on Windows or Unix; see below for a workaround for Macs.

The grammar files containing ECG code are a9grammar/a9.grm and nomigrammar/nomi.grm.

The GUI interface to the grammar/analyzer is gui-win.jar. You can double-click on the file to start the program, or start it from the command line. (If the program behaves oddly, an uncaught exception may have occurred; it will display in the console if you started the program from the command line.) To run the program from the command line:

~/a9-windows > java -jar gui-win.jar

Load a grammar

To load in a grammar, go to File > Open, and select the .prefs file corresponding to the grammar you want. To start off with, we'll use a9.prefs. This file contains path information telling the analyzer where to find all the files for that grammar.

  1. In the File menu, click Open. Locate the extracted directory and double-click on a9.prefs. This will load the grammar's constructions, schemas, and ontology information. (The ontology is a list of objects in the analyzer's model of the world; you don't need to worry about this.)
  2. You'll see that the Constructions pane in the left sidebar has been filled in with a hierarchical tree. These are the constructions available in this (very limited) grammar, corresponding to early (~12 mo.) in a child's linguistic development. Clicking on a construction name will display the ECG code for that construction in the pane on the right. Where a construction refers to another construction, schema, or ontological type, that name will be linked; click on the link to display its code.
  3. Each time you click on a construction it will open it in a new tab. To hide an opened tab, click the x next to the construction name at the top of the tab.
  4. To see schemas click the Schemas tab at the top of the left sidebar. The schemas in this grammar are all semantic schemas, with the exception of formpoleschema and its descendents.

Analyze some sentences

To analyze a sentence, go to the Analyze menu, choose Sentence...., and type a sentence to analyze. Note: The analyzer does not accept punctuation. Try analyzing I will bring the cup . When you click OK, the analysis will proceed and detailed results will be displayed in a pane at the bottom. Right-click in the pane to display these results in a separate window.

The results of analysis will look something like this:

RETURNED ANALYSIS
____________________________
Cost: -37.281867111870255
Analysis: ROOT(0, 5)

	Constructions Used:

		ROOT[0] (0, 5)
		Transitive-Cn[2] (0, 5)
		I-Cn[5] (0, 1)
		...

	Schemas Used:

		Move[17]
		Place[18]
		...

	Semantic Constraints:
	
		CauseMove[3].direction <-->
		Move[17].direction
			Filler: Place[18]
		...
		
...
Surviving parser states incorporating up through the word "I"

-------------------------------------------------------------------------------------------

Take a look at the output (we suggest opening it in a new window). It lists constructions used in the sentence—for example, I is labeled with the "I" construction (I-Cn[5]). Notice that the analyzer only understands some of the words; "will" and "the" are not grouped with the others because it does not know these words (i.e., they are not in the grammar). Dummy instances of the UnknownWord construction represent these words; they should not interfere with the "real" analysis.

To the parser, an "analysis" of the sentence consists of an instance of some construction that is a subtype of ROOT, with its constituents bound to other construction instances and schema roles bound according to the constraints. For a given input sentence there may be many such analyses. An analysis has a cost associated with it, which is a probabilistic estimate of how likely it is (so it can be ranked relative to other possible analyses, if there are any).

Each construction instance and schema instance is displayed as the type followed by a bracketed integer identifier for the instance. Construction instances also display with a range of input words spanned by the instance—this is abbreviated with integer between-word positions, where 0 refers to the position before the first word and n refers to the position after the nth word. For example, the range (0, 5) contains the first 5 words of the input.

Constructions for individual words I, bring, and cup should only span one word of the input; in contrast, a sentence-long Transitive construction spans the aforementioned ones.

Schema role bindings and fillers are shown under "Semantic Constraints." The bound schema instances comprise the Semantic Specification (SemSpec) for the sentence, which could in principle be provided as input to a semantic simulator. Take a look at these bindings. Verify that the agent of Move (i.e. the thing that moves) is the Cup. Also note that the agent of CauseMove (the person causing motion) is bound to the Speaker, and the patient of CauseMove (the thing being moved) to the Cup.

You can ignore the analyzer output starting with "Surviving parser states" (the rest shows how the analyzer built up the analysis incrementally).

Finally, try typing in the sentence bring the cup (no capitalization or punctuation!). Notice that the analyzer fails to find a construction which spans the sentence; only single-word constructions appear in the analysis (struck out on May 2, 10 am in response to Nathan's post to the newsgroup). Check this against the grammar: the transitive construction requires three constituents—the agent, the verb, and the object. We know of course that the sentence is grammatically well-formed, but this grammar has not yet learned the imperative-mood form of bring.


Part I: Analysis

Using a9.prefs, analyze the following sentences:

(a) I will bring you the cup

What is the difference between this analysis and the one for I will bring the cup? How is this difference captured in the grammar?

(b) I will bring the cup here

Does the analyzer find a spanning analysis? Why or why not? How does the analysis account for the destination of the bring action, if at all?

(c) * Nomi give I the ball

Does the analyzer find a spanning analysis here? If it does not, explain why. If it does, propose a change to the grammar that will exclude this sentence from being admitted as grammatical.


Part II: Learning

Now load in nomi.prefs. This grammar is nearly identical to the first one except it does not contain the following two constructions: the transitive construction and the ditransitive construction. (It also has most constructions descending from RootType; this is so the analyzer can treat words individually, rather than expecting a construction that will span multiple words.) It contains a number of basic schemas and mostly lexical constructions (and a phrase red ball). This approximates the single-word stage in child language acquisition.

Assume that this is the initial grammar that the child learner (Nomi) is using at the beginning of a play time one day. Remember that when a child acquires language, she has a lot of background knowledge as well as contextual knowledge at her disposal. Below is a pictorial description of the scene in which the utterances were said. In the learning system code, this scene will be encoded as a number of schemas linked together. The scene includes the following descriptive knowledge:

Over the course of interacting with her parents and playing with toys, Nomi hears the following six utterances from her parents, accompanied by some context:

  1. (Father) I will bring you some juice - Father went and retrieved the jug of orange juice from the dinning table.
  2. (Father) I will get a cup for you Nomi - Father brought over the cup for Nomi.
  3. (Mother) Nomi you can get a book and bring it back here - Mother also gestured at the books and then made a familiar "come here" gesture.
  4. (Mother) now get the red ball Nomi - Mother shifts her attention to the red ball that is sitting among Nomi's toys.
  5. (Father) would you get that and give it to me please - Father reiterated Mother's request for the red ball while pointing to the red ball.
  6. (Mother) get the baby and bring her to bed - Mother got up and waved for Nomi to come along to the bedroom.

Assume that Nomi is a linguistically precocious child, so that she hypothesizes new constructions (albeit lexically specific ones) with every utterance she hears. According to the verb-island hypothesis, children tend first to learn verb-specific constructions (e.g. get-ball construction, or throw-block construction) and then later on to generalize across verbs. Based on this principle, as well as the three learning mechanism we discussed in lecture (relational mapping, merging, composing), simulate by hand what Nomi might learn from these sentences.

  1. For each utterance listed above:

    1. Analyze the sentence using nomi.prefs, and compare the SemSpec against what is available in the context.
    2. State any relational mapping operations that may be performed and write down the new construction (if any) in ECG notation (i.e., as it appears in the analyzer). Focus on verb island constructions combining 2 or 3 words. (There is no need to try to make these work in the analyzer.)
    3. To help make this clearer, here is one construction that might be learned from sentence 1. Note that it is essentially a mapping of the CauseMove that Nomi observed onto the sentence she heard (which she partially understood).
      construction Bring-Juice-Cn
      
        constructional constituents
          bring: Bring-Cn
          juice: Juice-Cn
      	
        form constraints
          bring.f before juice.f
      	
        meaning
          evokes Father as father
          evokes Nomi as nomi
          constraints
            bring.m.agent <--> father
            bring.m.direction <--> nomi
            bring.m.patient <--> juice.m
      
  2. At the end of the six utterances, state two learning-by-merging operations that can be performed on the new sets of constructions Nomi just acquired.

Notes

transitive: A transitive verb takes a subject and a (direct) object; an intransitive verb takes no object; and a ditransitive verb takes a subject and two objects (one direct, the other indirect).


Running the Analyzer on a Mac

The analyzer has been made to run on MacOS X's built-in Java 1.5, but currently includes incompatible libraries.

The easiest way to run the analyzer on MacOS X is to run it on a Unix machine (read: your instructional course account) using X11. This requires installation of the free X11 package, included on your MacOS X Installation DVD. If you have trouble getting this to work, please contact the course staff.

Running on X11

Download the linux version of the analyzer and unpack it on linux, in your home directory.

unix ~> mkdir ecg-gui
unix ~> mv a9-linux.zip ./ecg-gui
unix ~> cd ecg-gui
unix ecg-gui/> unzip a9-linux.zip

Then, initiate a shell connection from your OSX computer to the linux server via the Terminal application:

ssh -X me@unix

The -X option forwards X11 connections securely. Then run the client:

unix ~> cd ecg-gui
unix ~> java -jar gui-linux.jar

The Analyzer window will display on your Mac.

Grammars should be loaded on the remote (Unix) account and loaded from there.

Readings

O8, O9, Book Ch 25