Skip to content

Instantly share code, notes, and snippets.

@TeamSPoon
Created June 1, 2021 16:48
Show Gist options
  • Save TeamSPoon/fbd6dcf8c36e20b47253586dffe322d2 to your computer and use it in GitHub Desktop.
Save TeamSPoon/fbd6dcf8c36e20b47253586dffe322d2 to your computer and use it in GitHub Desktop.
?- run_pipeline("which countries are bordered by two seas?").
% not_conflicted_span_types('NP',np)
% not_conflicted_span_types('NP',nump)
% not_conflicted_span_types('SBAR',question)
% dropping(
% span( [ seg(6,8),
% phrase(np),
% size(3),
% lnks(4),
% #(r(np,seg(6,8))),
% txt(["genqu","two","seas"]),
% childs(1),
% child(1,nump,r(nump,seg(6,7))),
% link(1,vcompl,r(vcompl,seg(4,8))),
% link(2,vp,r(vp,seg(3,8))),
% link(3,question,r(question,seg(1,8))),
% link(4,query,r(query,seg(1,9))) ]))
% dropping(
% span( [ seg(4,8),
% phrase(vcompl),
% size(5),
% lnks(3),
% #(r(vcompl,seg(4,8))),
% txt(["bordered","BY","genqu","two","seas"]),
% childs(1),
% child(1,np,r(np,seg(6,8))),
% link(1,vp,r(vp,seg(3,8))),
% link(2,question,r(question,seg(1,8))),
% link(3,query,r(query,seg(1,9))) ]))
% dropping(
% span( [ seg(3,8),
% phrase(vp),
% size(6),
% lnks(2),
% #(r(vp,seg(3,8))),
% txt(["are","bordered","BY","genqu","two","seas"]),
% childs(1),
% child(1,vcompl,r(vcompl,seg(4,8))),
% link(1,question,r(question,seg(1,8))),
% link(2,query,r(query,seg(1,9))) ]))
% dropping(
% span( [ seg(1,9),
% phrase(query),
% size(9),
% lnks(0),
% #(r(query,seg(1,9))),
% txt(["which","countries","are","bordered","BY","genqu","two","seas","?"]),
% childs(1),
% child(1,question,r(question,seg(1,8))) ]))
% not_conflicted_span_types('NP',np)
% not_conflicted_span_types('NP',nump)
% not_conflicted_span_types('SBAR',question)
% dropping(
% span( [ seg(6,8),
% phrase(np),
% size(3),
% lnks(4),
% #(r(np,seg(6,8))),
% txt(["genqu","two","seas"]),
% childs(1),
% child(1,nump,r(nump,seg(6,7))),
% link(1,vcompl,r(vcompl,seg(4,8))),
% link(2,vp,r(vp,seg(3,8))),
% link(3,question,r(question,seg(1,8))),
% link(4,query,r(query,seg(1,9))) ]))
% dropping(
% span( [ seg(4,8),
% phrase(vcompl),
% size(5),
% lnks(3),
% #(r(vcompl,seg(4,8))),
% txt(["bordered","BY","genqu","two","seas"]),
% childs(1),
% child(1,np,r(np,seg(6,8))),
% link(1,vp,r(vp,seg(3,8))),
% link(2,question,r(question,seg(1,8))),
% link(3,query,r(query,seg(1,9))) ]))
% dropping(
% span( [ seg(3,8),
% phrase(vp),
% size(6),
% lnks(2),
% #(r(vp,seg(3,8))),
% txt(["are","bordered","BY","genqu","two","seas"]),
% childs(1),
% child(1,vcompl,r(vcompl,seg(4,8))),
% link(1,question,r(question,seg(1,8))),
% link(2,query,r(query,seg(1,9))) ]))
% dropping(
% span( [ seg(1,9),
% phrase(query),
% size(9),
% lnks(0),
% #(r(query,seg(1,9))),
% txt(["which","countries","are","bordered","BY","genqu","two","seas","?"]),
% childs(1),
% child(1,question,r(question,seg(1,8))) ]))
% From /opt/logicmoo_workspace/packs_sys/wam_common_lisp/prolog/wamcl_runtime.pl:5
/* Country+[] :- database80(ti(country,Country)),numberof(Border_Sea,
[]^(database80(ti(sea,Border_Sea)),database80(symmetric_pred(spatial,border,Border_Sea,Country))),
2).
*/
merged_lexical_segs=[ w(which,
[ ape(pos(qdet)),
pos(wdt),
loc(1),
ape(lnks(3)),
lnks(2),
txt("which"),
ape(link(1,np,r(np,seg(1,2)))),
ape(link(2,question,r(question,seg(1,8)))),
ape(link(3,query,r(query,seg(1,9)))),
link(1,'NP',r('NP',seg(1,2))),
link(2,'SBAR',r('SBAR',seg(1,8))) ]),
w(countries,
[ ape(pos(nn)),
pos(nns),
loc(2),
ape(lnks(3)),
lnks(2),
txt("countries"),
ape(link(1,np,r(np,seg(1,2)))),
ape(link(2,question,r(question,seg(1,8)))),
ape(link(3,query,r(query,seg(1,9)))),
link(1,'NP',r('NP',seg(1,2))),
link(2,'SBAR',r('SBAR',seg(1,8))) ]),
w(are,
[ pos(aux),
loc(3),
lnks(3),
txt("are"),
ape(link(1,vp,r(vp,seg(3,8)))),
ape(link(2,question,r(question,seg(1,8)))),
ape(link(3,query,r(query,seg(1,9)))),
link(1,'VP',r('VP',seg(3,7))),
link(2,'S',r('S',seg(3,7))),
link(3,'SBAR',r('SBAR',seg(1,8))) ]),
w(bordered,
[ ape(pos(v)),
pos(vbn),
loc(4),
lnks(4),
txt("bordered"),
ape(link(1,vcompl,r(vcompl,seg(4,8)))),
ape(link(2,vp,r(vp,seg(3,8)))),
ape(link(3,question,r(question,seg(1,8)))),
ape(link(4,query,r(query,seg(1,9)))),
link(1,'VP',r('VP',seg(4,7))),
link(2,'VP',r('VP',seg(3,7))),
link(3,'S',r('S',seg(3,7))),
link(4,'SBAR',r('SBAR',seg(1,8))) ]),
w(by,
[ ape(pos('.')),
pos(in),
loc(5),
ape(lnks(4)),
ape(txt("BY")),
ape(link(1,vcompl,r(vcompl,seg(4,8)))),
ape(link(2,vp,r(vp,seg(3,8)))),
ape(link(3,question,r(question,seg(1,8)))),
ape(link(4,query,r(query,seg(1,9)))),
lnks(5),
txt("by"),
link(1,'PP',r('PP',seg(5,7))),
link(2,'VP',r('VP',seg(4,7))),
link(3,'VP',r('VP',seg(3,7))),
link(4,'S',r('S',seg(3,7))),
link(5,'SBAR',r('SBAR',seg(1,8))) ]),
w(two,
[ ape(pos('.')),
ape(loc(7)),
pos(cd),
loc(6),
lnks(6),
txt("two"),
ape(link(1,nump,r(nump,seg(6,7)))),
ape(link(2,np,r(np,seg(6,8)))),
ape(link(3,vcompl,r(vcompl,seg(4,8)))),
ape(link(4,vp,r(vp,seg(3,8)))),
ape(link(5,question,r(question,seg(1,8)))),
ape(link(6,query,r(query,seg(1,9)))),
link(1,'NP',r('NP',seg(6,7))),
link(2,'PP',r('PP',seg(5,7))),
link(3,'VP',r('VP',seg(4,7))),
link(4,'VP',r('VP',seg(3,7))),
link(5,'S',r('S',seg(3,7))),
link(6,'SBAR',r('SBAR',seg(1,8))) ]),
w(seas,
[ ape(pos(nn)),
ape(loc(8)),
ape(lnks(5)),
pos(nns),
loc(7),
lnks(6),
txt("seas"),
ape(link(1,np,r(np,seg(6,8)))),
ape(link(2,vcompl,r(vcompl,seg(4,8)))),
ape(link(3,vp,r(vp,seg(3,8)))),
ape(link(4,question,r(question,seg(1,8)))),
ape(link(5,query,r(query,seg(1,9)))),
link(1,'NP',r('NP',seg(6,7))),
link(2,'PP',r('PP',seg(5,7))),
link(3,'VP',r('VP',seg(4,7))),
link(4,'VP',r('VP',seg(3,7))),
link(5,'S',r('S',seg(3,7))),
link(6,'SBAR',r('SBAR',seg(1,8))) ]),
w(?,
[ pos('.'),
ape(loc(9)),
loc(8),
lnks(1),
txt("?"),
ape(link(1,query,r(query,seg(1,9)))),
link(1,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ ape(unused_w2),
w(genqu),
seg(6,6),
pos('.'),
loc(6),
lnks(6),
txt("genqu"),
link(1,nump,r(nump,seg(6,7))),
link(2,np,r(np,seg(6,8))),
link(3,vcompl,r(vcompl,seg(4,8))),
link(4,vp,r(vp,seg(3,8))),
link(5,question,r(question,seg(1,8))),
link(6,query,r(query,seg(1,9))) ]),
span( [ seg(1,2),
ape(phrase(np)),
phrase('NP'),
size(2),
ape(lnks(2)),
ape(#(r(np,seg(1,2)))),
lnks(1),
#(r('NP',seg(1,2))),
txt(["which","countries"]),
childs(0),
ape(link(1,question,r(question,seg(1,8)))),
ape(link(2,query,r(query,seg(1,9)))),
link(1,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ seg(6,7),
ape(phrase(nump)),
phrase('NP'),
size(2),
lnks(5),
ape(#(r(nump,seg(6,7)))),
ape(txt(["genqu","two"])),
#(r('NP',seg(6,7))),
txt(["two","seas"]),
childs(0),
ape(link(1,np,r(np,seg(6,8)))),
ape(link(2,vcompl,r(vcompl,seg(4,8)))),
ape(link(3,vp,r(vp,seg(3,8)))),
ape(link(4,question,r(question,seg(1,8)))),
ape(link(5,query,r(query,seg(1,9)))),
link(1,'PP',r('PP',seg(5,7))),
link(2,'VP',r('VP',seg(4,7))),
link(3,'VP',r('VP',seg(3,7))),
link(4,'S',r('S',seg(3,7))),
link(5,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ seg(5,7),
phrase('PP'),
size(3),
lnks(4),
#(r('PP',seg(5,7))),
txt(["by","two","seas"]),
childs(1),
child(1,'NP',r('NP',seg(6,7))),
link(1,'VP',r('VP',seg(4,7))),
link(2,'VP',r('VP',seg(3,7))),
link(3,'S',r('S',seg(3,7))),
link(4,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ seg(4,7),
phrase('VP'),
size(4),
lnks(3),
#(r('VP',seg(4,7))),
txt(["bordered","by","two","seas"]),
childs(1),
child(1,'PP',r('PP',seg(5,7))),
link(1,'VP',r('VP',seg(3,7))),
link(2,'S',r('S',seg(3,7))),
link(3,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ seg(3,7),
phrase('S'),
size(5),
lnks(1),
#(r('S',seg(3,7))),
txt(["are","bordered","by","two","seas"]),
childs(1),
child(1,'VP',r('VP',seg(3,7))),
link(1,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ seg(3,7),
phrase('VP'),
size(5),
lnks(2),
#(r('VP',seg(3,7))),
txt(["are","bordered","by","two","seas"]),
childs(1),
child(1,'VP',r('VP',seg(4,7))),
link(1,'S',r('S',seg(3,7))),
link(2,'SBAR',r('SBAR',seg(1,8))) ]),
span( [ seg(1,8),
ape(phrase(question)),
phrase('SBAR'),
size(8),
ape(lnks(1)),
ape(#(r(question,seg(1,8)))),
ape( txt( ["which","countries","are","bordered","BY","genqu","two","seas"])),
lnks(0),
#(r('SBAR',seg(1,8))),
txt(["which","countries","are","bordered","by","two","seas","?"]),
childs(2),
ape(child(1,np,r(np,seg(1,2)))),
ape(child(2,vp,r(vp,seg(3,8)))),
link(1,query,r(query,seg(1,9))),
child(1,'NP',r('NP',seg(1,2))),
child(2,'S',r('S',seg(3,7))) ]) ].
unresolvedDrs=drs([],
[ question(
drs(
[Country_Which,Sea,Border],
[ query(Country_Which,which)-(1/1),
object(Country_Which,country,countable,na,geq,2)-(1/2),
antecedent(1, Country_Which,
[ object(Country_Which,country,countable,na,geq,2)-(1/2),
query(Country_Which,which)-(1/1) ],
'$gen'(Neutr,'$neutr'),
'$num'(Pl,'$pl'),
'$pers'(Third,'$third'),
1, 2, country),
object(Sea,sea,countable,na,eq,2)-(1/7),
antecedent(2, Sea,
[ object(Sea,sea,countable,na,eq,2)-(1/7) ],
'$gen'(Neutr7,'$neutr'),
'$num'(Pl8,'$pl'),
'$pers'(Third9,'$third'),
1, 7, sea),
predicate(Border,border,Sea,Country_Which)-(1/4) ])) ]).
drs1=drs([],
[ question(
drs(
[Country_Which,Sea,Border],
[ query(Country_Which,which)-(1/1),
object(Country_Which,country,countable,na,geq,2)-(1/2),
antecedent(1, Country_Which,
[ object(Country_Which,country,countable,na,geq,2)-(1/2),
query(Country_Which,which)-(1/1) ],
'$gen'(Neutr,'$neutr'),
'$num'(Pl,'$pl'),
'$pers'(Third,'$third'),
1, 2, country),
object(Sea,sea,countable,na,eq,2)-(1/7),
antecedent(2, Sea,
[ object(Sea,sea,countable,na,eq,2)-(1/7) ],
'$gen'(Neutr7,'$neutr'),
'$num'(Pl8,'$pl'),
'$pers'(Third9,'$third'),
1, 7, sea),
predicate(Border,border,Sea,Country_Which)-(1/4) ])) ]).
sent80=question80(
[_590078],
pred(
quantV(int_det($VAR(Det)),spatial&_945210&_945212- $VAR(Country),`(ti(country,$VAR(Country))),`(true),[],spatial&_945210&_945212-_945228),
identityQ,
symmetric_pred(spatial,border,$VAR(Border),$VAR(Symmetric)),
[ quantV(quantV(same,2),spatial&_945744&_945746- $VAR(Sea),`(ti(sea,$VAR(Sea))),`(true),[],spatial&_945744&_945746-_945762) ])).
pnf=exists(Exists_Country_Which,
exists(Exists_Sea,
exists(Border,
( query(Query,Exists_Country_Which,which)-(1/1) &
object(Query,Exists_Country_Which,country,countable,na,geq,2)-(1/2) &
object(Query,Exists_Sea,sea,countable,na,eq,2)-(1/7) &
predicate(Query,Border,border,Exists_Sea,Exists_Country_Which)-(1/4) )))).
fol=exists(Exists_Country_Which,
exists(Exists_Sea,
exists(Border,
( query(Query,Exists_Country_Which,which)-(1/1) &
object(Query,Exists_Country_Which,country,countable,na,geq,2)-(1/2) &
object(Query,Exists_Sea,sea,countable,na,eq,2)-(1/7) &
predicate(Query,Border,border,Exists_Sea,Exists_Country_Which)-(1/4) )))).
parsed80=whq(Det_S,
s( np(3+pl,np_head(int_det(Det_S),[],country),[]),
verb(border,passive,pres+fin,[],posP),
[],
[ prep_phrase(prep(by),np(3+pl,np_head(quantV(same,2),[],sea),[])) ])).
aceKif(d_kif)=question(
exists(
[_589350,_589356,_589362],
( query($VAR(Which),which) ,
t(countable,$VAR(Countable),geq,2) ,
tCountry($VAR(Country)) ,
t(countable,$VAR(Countable),eq,2) ,
t($VAR(T)) ,
mudBorder($VAR(MudBorder),$VAR(MudBorder2)) ))).
syntaxTrees=[ query,
[ question,
[ np,
[qdet,which],
[ nbar,
[n,countries] ] ],
[ vp,
[aux,are,[]],
[ vbar,
[],
[ vcompl,
[v,bordered],
by,
[ np,
[ nump,
[genqu,[]],
two ],
[ nbar,
[n,seas] ] ] ],
[] ] ] ],
? ].
ape_penn_syntaxTree=[ query,
[ question,
[ np,
['QDET',which],
['NN',countries] ],
[ vp,
['AUX',are],
[ vcompl,
['V',bordered],
['.','BY'],
[ np,
[ nump,
['.',genqu],
['.',two] ],
['NN',seas] ] ] ] ],
['.',?] ].
e2c_syntaxTree=[ 'SBAR',
[ 'NP',
['WDT',which],
['NNS',countries] ],
[ 'S',
[ 'VP',
['AUX',are],
[ 'VP',
['VBN',bordered],
[ 'PP',
['IN',by],
[ 'NP',
['CD',two],
['NNS',seas] ] ] ] ] ],
['.',?] ].
clausify80=( answer80([Country]) :-
( ti(country,Country) ,
numberof(Border_Sea,(ti(sea,Border_Sea),symmetric_pred(spatial,border,Border_Sea,Country)),2) ) ).
paraphrase_set=['2 seas border which countries?'].
results80=[egypt,iran,israel,saudi_arabia,turkey].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment