



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




-^ Modify basic DCG into one that includes phrase structure• Basic DCG:^ sentence
-->^ np,^
vp. vp^ -->^ v,
np.
-^ Phrase Structure DCG:^ sentence(sentence(NP,VP))
-->^ np(NP),
vp(VP).
vp(vp(V,NP))
-->^ v(V),
np(NP). v(v(likes))
-->^ [likes]. np(np(john))
-->^ [john]. np(np(mary))
-->^ [mary].
-^ Modified Query
-^ ?-^ sentence(
PS ,[john,likes,mary],[]). PS^ =^ sentence(np(john),vp(v(likes),np(mary)))
-^ modify basic DCG into one that includes meaning• Basic DCG:^ sentence
-->^ np,^
vp. vp^ -->^ v,
np.
-^ Meaning DCG:^ –^ sentence(P)
-->^ np(NP1),
vp(P), {saturate1(P,NP1)}.– vp(P)^ -->
v(P),^ np(NP2),
{saturate2(P,NP2)}.
-^ v(likes(X,Y))
-->^ [likes].
-^ np(john)
-->^ [john].
-^ np(mary)
-->^ [mary].
-^ saturate1(P,A)
:-^ arg(1,P,A).
-^ saturate2(P,A)
:-^ arg(2,P,A).
-^ Query
-^ ?-^ sentence(M,[john,likes,mary],[]).^ M^ =^
likes(john,mary)
Nth^ argument of Predicate
equal to^ Argument {^
}^ means call Prolog
means call^ arg(2,VBm,NPm)
%^ Exercises
1 through
3
sbar^ -->
np,^ s. sbar^ -->
s. s^ -->^
vp. s^ -->^
np,^ vp. np^ -->
[john]. np^ -->
[pete]. np^ -->
[mary]. np^ -->
det,^
n. np^ -->
[who].
-^ np^
-->^ neg,
np.
-^ np^
-->^ np,
conj,
np.
-^ n^ -->
[student].
-^ n^ -->
[baseball,fan].
-^ neg
-->^ [not].
-^ conj
-->^ [and].
-^ vp^
-->^ v,
np.
-^ v^ -->
[is].
-^ det
-->^ [a].
-^ Step 1: Get some phrase structure output first•^ Step 2: Note:–^ rule ordering is important here...–^ how to ensure the right rule gets applied for sentences vs. questions?^ –^ sbar --> s.–^ sbar --> np, s.^ | ?- sbar(PS,[who,is,not,a,baseball,fan],[]).PS = sbar(np(who),s(vp(v(is),np(neg(not),np(det(a),n(baseball_fan)))))) ?| ?- sbar(PS,[john,is,a,baseball,fan],[]).PS = sbar(s(np(john),vp(v(is),np(det(a),n(baseball_fan))))) ?| ?- sbar(PS,[who,is,a,student,and,a,baseball,fan],[]).PS = sbar(np(who),s(vp(v(is),np(np(det(a),n(student)),conj(and),np(det(a),n(baseball_fan)))))) ?| ?- sbar(PS,[who,is,a,student,and,not,a,baseball,fan],[]).PS = sbar(np(who),s(vp(v(is),np(np(det(a),n(student)),conj(and),np(neg(not),np(det(a),n(baseball_fan)))))))?
-^ Step 1: Generate some meaning output.•^ Step 2: Notice, for example, that for the conjunction cases youneed the same variable for both predicate nominals–^ i.e.
saturate1/
must be modified to deal with logical connectives like
,
(conjunction) and
+^ (negation) | ?- sbar(M,[who,is,not,a,baseball,fan],[]).M = +baseball_fan(_A) ?| ?- sbar(M,[john,is,a,baseball,fan],[]).M = baseball_fan(john) ?| ?- sbar(M,[who,is,a,student,and,a,baseball,fan],[]).M = student(_A),baseball_fan(_A) ?| ?- sbar(M,[who,is,a,student,and,not,a,baseball,fan],[]).M = student(_A),+baseball_fan(_A)?