Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
625 views
in Technique[技术] by (71.8m points)

prolog - APE: Converting DRS to Struct

I'm trying to convert DRS to different structure. Here is unfinished work in progress (still simple DRS):

conds2lst(Conds,Lst) :- maplist( X^L^(Z-_ = X, Z =.. L), Conds, Lst).
property(Conds,Adj) :- member([property,_,Adj|_], Conds).
object(Conds,Struct) :- , property(Conds,Adj), member([object,Noun,Noun|_], Conds), Struct =.. [Noun,Adj].
predicate(Conds,Struct) :- object(Conds,Obj),
    ( member([predicate,Verb,Verb,Subj,_Obj], Conds), Struct =.. [Verb,Subj,Obj] );
    ( member([predicate,Verb,Verb,Subj,Obj,IndObj], Conds), Struct =.. [Verb,Subj,Obj,IndObj] ).
sent(Conds,Struct) :-  predicate(Conds,Struct).

?- ape2drs('Peter owns a red book.',D),conds(D,C),conds2lst(C,L),sent(L,S).
D = drs([book, own], [object(book, book, countable, na, eq, 1)-1/5, property(book, red, pos)-1/4, predicate(own, own, named('Peter'), book)-1/2]),
C = [object(book, book, countable, na, eq, 1)-1/5, property(book, red, pos)-1/4, predicate(own, own, named('Peter'), book)-1/2],
L = [[object, book, book, countable, na, eq, 1], [property, book, red, pos], [predicate, own, own, named('Peter'), book]],
S = own(named('Peter'), book(red)) .

of course my current code is quite specific ... but one thing which starts to unravel ... eerie feeling ... it looks like DCG code ...

property -> [property], member.
object -> property, member, {=.. }.
predicate -> object, (member;member).
sent -> predicate.

the difference is that the list is unordered , but if you can feed it hierarchically from the Verb down it can probably be parsed as Hierarchically-Difference-List i.e. somewhat mimic DCG !? member() is plays the role of the DIFF.

The hard thing is that you need to late bind the Domain-Vars Top-bottom OR bottom-top

What do you think ? or I'm just imagining ?

question from:https://stackoverflow.com/questions/66058449/ape-converting-drs-to-struct

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...