### Gregory Golberg (grisha@alum.mit.edu) Lab 3 6.863 Spring 06

1. Question 1

For "What did John give to Mary", the gap is the patient, and the rule that handles it is:

sem.add("VBAR[fin +]/NP -> V3[tense -] NP/NP PP.dat",
lambda v3, np, pp: lambda subj, patient: v3(subj, pp, patient))
For "Who did John give Fido to", the gap is the beneficiary, and the rule that handles it is:

sem.add("VBAR[fin +]/NP -> V3[tense -] NP PP.dat/NP",
lambda v3, np, pp: lambda subj, beneficiary: v3(subj, beneficiary, np))
2. Question 2

To handle the double object, we add a modification of this rule

sem.add("V+args -> V3[tense +] NP[wh -] PP.dat", lambda v3, np, pp: lambda subj: v3(subj, pp, np))

as follows

sem.add("V+args -> V3[tense +] NP[wh -] NP", lambda v3, np_ben, np_pat: lambda subj: v3(subj, np_ben, np_pat))

Here is the resulting interaction:

```
Hello.
> who did john give fido to
I don't know.
> john gave mary fido
Okay.
> who did john give fido to
mary
```

3. Question 3

To handle the "did" similarly to the previous question, add a modification of rule

sem.add("VBAR[fin +] -> V3[tense -] NP[wh -] PP.dat",
lambda v3, np, pp: lambda subj: v3(subj, pp, np))

as follows

sem.add("VBAR[fin +] -> V3[tense -] NP[wh -] NP",
lambda v3, np_ben, np_pat: lambda subj: v3(subj, np_ben, np_pat))

Here are resulting interactions:

```Hello.
> john did give mary fido
Okay.
> who did john give fido to
mary
> did john give mary fido
Yes.
```

and

```Hello.
> john gave mary fido
Okay.
> did john give mary fido
Yes.
```

This single modification is enough because the rules allow for the auxiliary verb "do" to specify the tense of the actual verb that follows "X did bleep" and questions that start with "do" have the "did X bleep". In other words, since we already have VP -> Do_Modal VBAR and Q -> Do_Modal NP VBAR.

4. Question 4

In this case, "what did john give mary" is similar to "what did john give to mary". The "what" displaces the NP from the PP (in question 1) or from "implicit PP", if you will, from question 2. Thus, similarly to previous questions, the following addition is sufficient:

sem.add("VBAR[fin +]/NP -> V3[tense -] NP NP/NP",
lambda v3, np_ben, x:
lambda subj, pat:
v3(subj, np_ben, pat))

The interaction is:

```Hello.
> john gave mary fido
Okay.
> who did john give fido to
mary
> did john give fido to mary
Yes.
> what did john give mary
fido
```

We do not need two rules, because we are only handling one displacement here, unlike in question 1, where we handle 2 displacements - both of NP, but from different places. "who did john give mary" would actually be the same as "what did john give mary" - in either case, what is displaced is the first NP.

Using the lambda mechanism, the system seems quite extensible in terms of capturing information from sentences of various, even complex, forms. It is not clear whether this extensibility can scale to a text consisting of multiple sentences, where pronouns, for example, can refer to subjects or objects of previous sentences.