Question: grasem.pl:f ( X , F ) : - s ( Y , F , [ ] ) , flat ( Y , X ) .

grasem.pl:f(X,F):- s(Y,F,[]), flat(Y,X).
% :- s(F,[])
s(and(P1,P2))--> np(X-P1), vp(X-P2).
vp(X-P)--> verbo1(X-P).
vp(X-and(P,P1))--> verbo2(X-Y-P), np(Y-P1).
vp(X-P)--> verboBe, adj(X-P).
vp(X-and(P,P1,P2))--> verbo3(X-Y-Z-P), np(Y-P1), pp(Z-P2).
pp(X-P)--> prep, np(X-P).
np(X-P)--> np1(X-P).
np(X-and(P,P1,rel(X,Y)))--> np1(X-P), pp(Y-P1).
np(X-and(P1,P2))--> adj1(X-P2),np1(X-P1).
adj1(X-P)--> adj(X-P).
adj1(X-and(P1,P2))--> adj(X-P1), adj1(X-P2).
np1(X-P)--> det, nominal(X-P).
np1(X-true)--> properName(X).
np1(A-P)--> det, nominal(A-P), properName(A).
nominal(X-P)--> noun(X-P).
nominal(X-and(P1,P2))--> noun(X-P1), nominal(X-P2).
noun(X-man(X))-->[man].
noun(X-book(X))-->[book].
noun(X-customer(X))-->[customer].
noun(X-cover(X))-->[cover].
noun(X-bag(X))-->[bag].
noun(X-blue(X))-->[blue].
det -->[the].
det -->[a].
properName('Manuel')-->['Manuel'].
properName('Maria')-->['Maria'].
prep -->[from].
prep -->[to].
prep -->[with].
prep -->[in].
verbo1(X-run(X))-->[ran].
verbo2(X-Y-bought(X,Y))-->[bought].
verbo2(X-Y-give(X,Y))-->[gave].
verbo3(X-Y-Z-bought(X,Y,Z))-->[bought].
verbo3(X-Y-Z-give(X,Y,Z))-->[gave].
verboBe-->[is].
adj(X-blue(X))-->[blue].
flat(and(A,B,C),L):-!,flat(A,L1),flat(and(B,C),L2), append(L1,L2,L).
flat(and(A,B),L):-!,flat(A,L1),flat(B,L2), append(L1,L2,L).
flat(true,[]):-!.
flat(A,[A]). Add rules to grammar and lexicon in order to obtain the semantic representation of sentences=1.The customer who gave Maria the book ran.2.The book has a blue cover.3.The book is from Maria

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!