Question: grasem.pl: % testar com: % : - f ( X , [ ' Manuel ' , ran ] ) . % : - f (

grasem.pl:% testar com:
% :- f(X,['Manuel', ran]).
% :- f(X,[a, man, ran]).
% :- f(X,[a,man, with, a, book, ran]).
% :- f(X,['Maria', with, a, book, ran]).
% :- f(X,['Maria', with, the, book, in,a,bag, ran]).
% :- f(X,[the,customer, bought, a, book])
% :- f(X,['Manuel', bought, a, book])
% :- f(X,[the, customer, bought, a, book, from,'Maria']).
% :- f(X,[the, customer, bought, a, book, with, a, blue, cover]).
% :- f(X,[the, customer, gave, a, book, with, a, blue, cover, to,'Manuel' ]).
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]).(a) Manuel ran.
(b) A man ran.
(c) A man with a book ran.
(d) Maria with a book ran.
(e) Maria with a book in a bag ran.
(f) The customer bought a book.
(g) Manuel bought a book.
(h) The customer bought a book from Maria.
(i) The customer bought a book with a blue cover from Maria.
(j) Manuel gave Maria a book with a blue cover.
(k) The customer who gave Maria the book ran
(l) The book has a blue cover
(m) The book is from Maria
(n) The cover is blue. 2. With the semantic analyzer of the file grasem.pl, indicate the result of the
semantic analysis of the sentences from a) to j).
3. Add rules to grammar and lexicon in order to obtain the semantic representation of sentences k) to n)

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!