/* 
NAMES      Dr. Christoph Lehner    mailto:chris@cl.uni-hildesheim.de
PHONES    +5121 88 33 77 ¥ +89 260 37 54
WEB-ADR  http://www.uni-hildesheim.de/~chlehn
*****************************************************************
All programs are freeware, but please be honest enough to
give clear references to where they came from.
*****************************************************************

© Christoph Lehner

*/

/* Not quite adequate for German:

s --> np + vp

The position of the frontal NP can also be filled with some
other material like adverbials or non-nominative Nounphrases.

*/

sent(s(NP,VP)) --> 
        np(NP,_,nom,Num), 
        vp(VP,Num).

/* Nounphrase and verbphrase are supposed to match in number 
(and person if there were any pronouns, but there aren't so far */


np(np(NPR),Gen,Kas,sing) --> 
        npr(NPR, Gen,Kas ).

np(np(AR,CN), Gen,Kas,Num) --> 
        ar(AR, Gen,Kas,Num),
        cn(CN, Gen,Kas,Num).

vp(vp(V),Num) --> v1(V,Num).

vp(vp(V,NP),Num) --> 
        v2(V,Num),
        np(NP,Gen,akk,_).

vp(vp(V,NP1,NP2),Num) --> 
        v3(V,Num),
        np(NP1,Gen1,dat,Num),
        np(NP2,Gen2,akk,Num) .

/*  Verben */
v1(v1(V),Num) -->  
        [V], {lex(v1,V,Num ) } .
v2(v2(V),Num) -->  
        [V], {lex(v2,V,Num ) } .
v3(v3(V),Num) -->  
        [V], {lex(v3,V,Num ) } .

/* Artikel */
ar(ar(AR),Gen,Kas,Num) --> 
        [AR], {lex(ar,AR, Gen,Kas,Num) } .

/* Substantive */
cn(cn(CN),Gen,Kas,Num ) --> 
        [CN], 
        {lex(cn,CN, Gen,Kas,Num)} .

/* Namen */
npr(npr(NPR), Gen,Kas) -->
         [NPR], 
         { lex(npr,NPR,Gen,Kas) }.



lex(v1,pokert,sing ).
lex(v2,kennt,sing ).
lex(v3,gibt,sing ).

lex(v1,pokern,plu ).
lex(v2,kennen, plu ).
lex(v3,geben, plu ).

lex(npr,spade,mask,nom).
lex(npr,spade,mask,akk).
lex(npr,spade,mask,dat).
lex(npr,spades,mask,gen).

lex(cn,detektivin,fem,_,sing).
lex(cn,detektivinnen,fem,_,plu).


lex(cn,gauner,mask,nom,_ ).
lex(cn,gauner,mask,akk,_ ).
lex(cn,gauner,mask,dat,sing ).
lex(cn,gauners,mask,gen,sing ).

lex(cn,gaunern,mask,dat,plu).
lex(cn,gauner,mask,gen,plu ).

lex(ar,der,mask,nom,sing ).
lex(ar,den,mask,akk,sing ).
lex(ar,dem,mask,dat,sing ).
lex(ar,des,mask,gen,sing ).

lex(ar,die,mask,nom,plu ).
lex(ar,die,mask,akk,plu ).
lex(ar,den,mask,dat,plu ).
lex(ar,der,mask,gen,plu ).


lex(ar,die,fem,nom,sing ).
lex(ar,die,fem,akk,sing ).

lex(ar,die,fem,nom,plu ).
lex(ar,die,fem,akk,plu ).


test_sent([die,detektivin,kennt,den,gauner]).
test_sent([spade,kennt,den,gauner]).
test_sent([der,gauner,kennt,spade]).

test:-
        test_sent(L),
        sent(Tree,L,[]),
        drucke_baum(Tree),
        nl, fail.
test.