Lab 3
3.1
These two rules let the system handle Wh-questions
This rule lets the system handle questions with "hidden" beneficiary e.g. "Who did John give Fido to (Mary)"
sem.add("VBAR[fin +]/NP -> V3[tense -] NP PP.dat/NP",
lambda v3, np, pp: lambda subj, beneficiary: v3(subj, beneficiary, np))
This rule lets the system handle questions with "hidden" object e.g. "What did John give (Fido) to Mary?"
sem.add("VBAR[fin +]/NP -> V3[tense -] NP/NP PP.dat",
lambda v3, np, pp: lambda subj, patient: v3(subj, pp, patient))
3.2
I added this rule, which let verbs such as give take two NP arguments.
In lambda calculus form they were given different variable names to avoid confusion (np1, np2)
sem.add("V+args -> V3[tense +] NP[wh -] NP[wh -]",
lambda v3, np1, np2: lambda subj: v3(subj, np1, np2))
3.3
I added the rule below which let a "tense-less" VP take two NP arguments
I did the same renaming of variable names as was done for question 2
sem.add("VBAR[fin +] -> V3[tense -] NP[wh -] NP[wh -]",
lambda v3, np1, np2: lambda subj: v3(subj, np1, np2))
Sentences such as "Did John give Mary Fido " works without any additional rules because
sem.add("Q[wh -] -> Do_Modal NP[wh -] VBAR[fin +]",
lambda dm, np, vbar: dm(vbar(np)))
uses the same VBAR rule to construct "tense-less" VPs. The ordering of constituents of VBAR is the same in y/n questions as it is in declarative sentences
3.4
I added this rule
sem.add("VBAR[fin +]/NP -> V3[tense -] NP/NP NP",
lambda v3, np1, np2: lambda subj, patient: v3(subj, np2, patient))
Why don't we need to add two rules again? Because we do not need to cover the "Who did John give Fido" in the same vein (Fido can be the beneficiary according to the above rule) as "Who did John give Fido to?
in fact this seems to be an ambiguous case, we can either understand "Who did John give Fido to" or "Who did John give to Fido"
Extensibility
Each time we add a declarative sentence we need to add other rules to handle y-n questions
For each gap we might have in a sentence we need additional rules so it is hard to say the system is very easy to extend
0 Comments:
Post a Comment
<< Home