sem.add("VBAR[fin +]/NP -> V3[tense -] NP/NP PP.dat",For "Who did John give Fido to", the gap is the beneficiary, and the rule that handles it is:
lambda v3, np, pp: lambda subj, patient: v3(subj, pp, patient))
sem.add("VBAR[fin +]/NP -> V3[tense -] NP PP.dat/NP",
lambda v3, np, pp: lambda subj, beneficiary: v3(subj, beneficiary, np))
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
sem.add("VBAR[fin +] -> V3[tense -] NP[wh -] PP.dat",as follows
lambda v3, np, pp: lambda subj: v3(subj, pp, np))
sem.add("VBAR[fin +] -> V3[tense -] NP[wh -] NP",Here are resulting interactions:
lambda v3, np_ben, np_pat: lambda subj: v3(subj, np_ben, np_pat))
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.
sem.add("VBAR[fin +]/NP -> V3[tense -] NP NP/NP",The interaction is:
lambda v3, np_ben, x:
lambda subj, pat:
v3(subj, np_ben, pat))
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.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