Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Explain how to reward individual and team performance.

Answered: 1 week ago