APE: generate separate object-node instead named-node?

43 views Asked by At

Is there a way to force APE instead of generating internal node like named('Peter'), to generate separate object()-node instead, like the case with "the man" ?

The reason is that later when you query "what does Peter own ?" matches also "the-man-fact".

because :

 man|query:predicate(B,own,C,A) <==> peter:predicate(B,own,named('Peter'),A)

the query is like man:predicate, so if you ask for Peter it will also unify with the-man fact, which it should not. On the other hand if you ask the-man-question it returns correct answer, because it has object()-node.

if it is separate object()-node then it wont match i.e. would be the correct behavior.

The other option would be to TRANSFORM predicate(B,own,named('Peter'),A) to two-nodes and replace it in the list .. How do you do :

   [1,2,3,4,5] ==2==> [1,20,21,3,4,5]

is this :

   ?- A=[1,2,3,4,5],B=[20,21],select(2,A,A1),append(A1,B,C).
   C = [1, 3, 4, 5, 20, 21] .

?- ape('what does the man own?',D).
D = 'drs([],[question(drs([A,B,C],[object(C,man,countable,na,eq,1)-1/4,query(A,what)-1/1,predicate(B,own,C,A)-1/5]))])'.

?- ape('what does Peter own?',D).
D = 'drs([],[question(drs([A,B],[query(A,what)-1/1,predicate(B,own,named(\'Peter\'),A)-1/4]))])'.

?- ape('Peter owns a book.',D).
D = 'drs([A,B],[object(A,book,countable,na,eq,1)-1/4,predicate(B,own,named(\'Peter\'),A)-1/2])'.

?- ape('The man owns a book.',D).
D = 'drs([A,B,C],[object(C,man,countable,na,eq,1)-1/2,object(A,book,countable,na,eq,1)-1/5,predicate(B,own,C,A)-1/3])'.

this is an option, but it sucks and does not cover all the Verb specs..

fix(Conds,Res) :- select([predicate,Var,Verb,named(Name),Obj],Conds, Removed),
    append([[predicate,Var,Verb,X,Obj],[object,X,Name,countable,na,eq,1]], Removed, Res).


?- txt2drs('Peter owns a book.',D),conds(D,C),conds2lst(C,L),fix(L,R).
D = drs([_4832, _4838], [object(_4832, book, countable, na, eq, 1)-1/4, predicate(_4838, own, named('Peter'), _4832)-1/2]),
C = [object(_4832, book, countable, na, eq, 1)-1/4, predicate(_4838, own, named('Peter'), _4832)-1/2],
L = [[object, _4832, book, countable, na, eq, 1], [predicate, _4838, own, named('Peter'), _4832]],
R = [[predicate, _4838, own, _5256, _4832], [object, _5256, 'Peter', countable, na, eq, 1], [object, _4832, book, countable, na, eq|...]].
0

There are 0 answers