/* Copyright (C) Wolfgang Menzel, Universität Hamburg, 2003-06-27 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. */ :- nl. :- write_ln('an English grammar with feature unification'). :- write_ln('agreement, subcategorisation, '). :- write_ln('call: ?- s([the, man, was, nice],Structure,Tense).'). :- nl. % the dictionary det(det(the),sg) --> [the]. det(det(the),pl) --> [the]. % change all the other entries accordingly det(det(a),sg) --> [a]. det(det(an),sg) --> [an]. det(det(some),sg) --> [some]. det(det(this),sg) --> [this]. det(det(these),pl) --> [these]. det(det(those),sg) --> [those]. det(det(those),pl) --> [those]. n(n(man),sg) --> [man]. n(n(men),pl) --> [men]. n(n(woman),sg) --> [woman]. n(n(women),pl) --> [women]. n(n(fish),_) --> [fish]. n(n(house),sg) --> [house]. n(n(houses),pl) --> [houses]. adj(adj(good)) --> [good]. adj(adj(happy)) --> [happy]. adj(adj(nice)) --> [nice]. cop(cop(am),first,sg,pres) --> [am]. cop(cop(are),second,sg,pres) --> [are]. cop(cop(is),third,sg,pres) --> [is]. cop(cop(are),_,pl,pres) --> [are]. cop(cop(was),first,sg,past) --> [was]. cop(cop(were),second,sg,past) --> [were]. cop(cop(was),third,sg,past) --> [was]. cop(cop(were),_,pl,past) --> [were]. verb(v(sleep),first,sg,pres,[]) --> [sleep]. verb(v(sleep),second,sg,pres,[]) --> [sleep]. verb(v(sleep),_,pl,pres,[]) --> [sleep]. verb(v(sleeps),third,sg,pres,[]) --> [sleep]. verb(v(slept),_,_,past,[]) --> [slept]. verb(v(love),first,sg,pres,[np(_,_,_,nom)]) --> [love]. verb(v(love),second,sg,pres,[np(_,_,_,nom)]) --> [love]. verb(v(love),_,pl,pres,[np(_,_,_,nom)]) --> [love]. verb(v(loves),third,sg,pres,[np(_,_,_,nom)]) --> [loves]. verb(v(loved),_,_,past,[np(_,_,_,nom)]) --> [loved]. verb(v(give),first,sg,pres,[np(_,_,_,acc),np(_,_,_,nom)]) --> [give]. verb(v(give),second,sg,pres,[np(_,_,_,acc),np(_,_,_,nom)]) --> [give]. verb(v(give),_,pl,pres,[np(_,_,_,acc),np(_,_,_,nom)]) --> [give]. verb(v(gives),third,sg,pres,[np(_,_,_,acc),np(_,_,_,nom)]) --> [gives]. verb(v(gave),_,_,past,[np(_,_,_,acc),np(_,_,_,nom)]) --> [gave]. verb(v(make),first,sg,pres,[np(np(det(_),_),_,_,nom)]) --> [make]. verb(v(make),second,sg,pres,[np(np(det(_),_),_,_,nom)]) --> [make]. verb(v(make),_,pl,pres,[np(np(det(_),_),_,_,nom)]) --> [make]. verb(v(makes),third,sg,pres,[np(np(det(_),_),_,_,nom)]) --> [makes]. verb(v(made),_,_,past,[np(np(det(_),_),_,_,nom)]) --> [made]. verb(v(make),first,sg,pres,[np(_,_,_,acc),advp(_)]) --> [make]. verb(v(make),second,sg,pres,[np(_,_,_,acc),advp(_)]) --> [make]. verb(v(make),_,pl,pres,[np(_,_,_,acc),advp(_)]) --> [make]. verb(v(makes),third,sg,pres,[np(_,_,_,acc),advp(_)]) --> [makes]. verb(v(made),_,_,past,[np(_,_,_,acc),advp(_)]) --> [made]. part(part(sleeping),[]) --> [sleeping]. part(part(loving),[np(_,_,_,acc)]) --> [loving]. part(part(giving),[np(_,_,_,acc),np(_,_,_,nom)]) --> [giving]. part(part(making),[np(_,_,_,acc)]) --> [making]. part(part(making),[np(_,_,_,acc),advp(_)]) --> [making]. ppron(ppron(i),first,sg,nom) --> [i]. ppron(ppron(you),second,_,_) --> [you]. ppron(ppron(he),third,sg,nom) --> [he]. ppron(ppron(she),third,sg,nom) --> [she]. ppron(ppron(it),third,sg,_) --> [it]. ppron(ppron(we),first,pl,nom) --> [we]. ppron(ppron(they),third,pl,nom) --> [they]. ppron(ppron(me),first,sg,acc) --> [me]. ppron(ppron(him),third,sg,acc) --> [him]. ppron(ppron(her),third,sg,acc) --> [her]. ppron(ppron(us),first,pl,acc) --> [us]. ppron(ppron(them),third,pl,acc) --> [them]. % grammar rules nbar(nbar(N),Num) --> n(N,Num). nbar(nbar(Adj,N),Num) --> adj(Adj),n(N,Num). np(np(Det,Nbar),third,Num,_) --> det(Det,Num),nbar(Nbar,Num). np(np(Ppron),Pers,Num,Case) --> ppron(Ppron,Pers,Num,Case). vp(vp(Cop,Advp),Pers,Num,Tense) --> cop(Cop,Pers,Num,Tense), advp(Advp). vp(vp(Cop,Np),Pers,Num,Tense) --> cop(Cop,Pers,Num,Tense), np(Np,_,_,acc). vp(vp(Vbar),Pers,Num,Tense) --> vbar(Vbar,Pers,Num,Tense). vbar(vbar(V0),Pers,Num,Tense) --> verb(V0,Pers,Num,Tense,[]). vbar(vbar(V0,S1),Pers,Num,Tense) --> verb(V0,Pers,Num,Tense,[C1]),C1, {arg(1,C1,S1)}. vbar(vbar(V0,S1,S2),Pers,Num,Tense) --> verb(V0,Pers,Num,Tense,[C1,C2]),C1,C2, {arg(1,C1,S1),arg(1,C2,S2)}. %v0(V0,Pers,Num,Tense,Subcat) --> % verb(V0,Pers,Num,Tense,Subcat). %v0(v0(V0,Comp),Pers,Num,Tense,Rest) --> % v0(V0,Pers,Num,Tense,[Comp|Rest]), % Comp. advp(advp(Advp)) --> adj(Advp). advp(advp(Advp)) --> part(Advp,[]). advp(advp(Advp,S1)) --> part(Advp,[C1]),C1,{arg(1,C1,S1)}. advp(advp(Advp,S1,S2)) --> part(Advp,[C1,C2]),C1,C2,{arg(1,C1,S1),arg(1,C2,S2)}. s(s(Np,Vp),Tense) --> np(Np,Pers,Num,nom), vp(Vp,Pers,Num,Tense). s(Sentence,Structure,Tense) :- s(Structure,Tense,Sentence,[ ]).