;============================================================================================ ;UNL-ENG TRANSFORMATION GRAMMAR FOR THE CORPUS UC-A1 ;Documentation available at http://www.unlweb.net/wiki/English_grammar ;This grammar must be used with the UNL-NL Default Transformation Grammar (available at http://www.unlweb.net/wiki/Default_grammar) ;============================================================================================ ;============================================================================================ ;============================================================================================ ;1. SEMANTIC ANALYSIS ;Converts the semantic network into a syntactic network ;============================================================================================ ;============================================================================================ ;============================================================================================ ;1.1 RELATIONS ;Converts semantic relations into syntactic relations ;============================================================================================ agt(%x,V;%y,N):=VS(%x,PER=%y;%y,-CAS,+CAS=NOM); agt(kill,he) > VS(kill,he) aoj(%x;%y,N):=VP(VB(?[be],?[[]],?LEX=V,?POS=COP,PER=%y,att=%x;%x,-CAS,+CAS=NOM);%y,-CAS,+CAS=NOM,DIS=BEF); aoj(beautiful,it) > VP(VB(is,beautiful),it) ben(%x;%y):=XA(%x;PC([for],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); ben(book,John) > XA(book,PC(for,John)) cnt(%x,N;%y,N):=NA(%x;PC([about],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); cnt(book,Paris) > NA(book,PC(about,Paris)) man(%x,J;%y,A):=XA(%x;%y,DIS=BEF); man(beautiful,extremely) > XA(beautiful,extremely) man(%x,V;%y,A):=XA(%x;%y); man(beautiful,extremely) > XA(beautiful,extremely) man(%x;%y,N,@with):=XA(%x;PC([with],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); man(kill,knife) > XA(kill,PC(with,knife)) mod(%x,N;%y,J):=NA(%x;%y,DIS=BEF); mod(beautiful,book) > NA(beautiful,book) mod(%x,N;%y,N):=NA(%x;PC([of],LEX=P,POS=PRE;%y)); mod(book,John) > NA(book,PC(of,John)) obj(%x,V;%y,N):=VC(%x;%y,-CAS,+CAS=OBL); obj(kill,Mary) > VC(kill,Mary) plc(%x;%y,N,@behind):=XA(%x;PC([behind],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@behind) > XA(book,PC(behind,table)) plc(%x;%y,N,@beside):=XA(%x;PC([beside],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@beside) > XA(book,PC(beside,table)) plc(%x;%y,N,@far_from):=XA(%x;PC([far from],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@far_from) > XA(book,PC(far from,table)) plc(%x;%y,N,@from):=XA(%x;PC([from],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(train,Paris.@from) > XA(train,PC(from,Paris)) plc(%x;%y,N,@in_front_of):=XA(%x;PC([in front of],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@in_front_of) > XA(book,PC(in front of,table)) plc(%x;%y,N,@near):=XA(%x;PC([near],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@near) > XA(book,PC(near,table)) plc(%x;%y,N,@on):=XA(%x;PC([on],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@on) > XA(book,PC(on,table)) plc(%x;%y,N,@to):=XA(%x;PC([to],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(train,Paris.@to) > XA(train,PC(to,Paris)) plc(%x;%y,N,@through):=XA(%x;PC([through],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(train,Paris.@through) > XA(train,PC(through,Paris)) plc(%x;%y,N,@under):=XA(%x;PC([under],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(book,table.@under) > XA(book,PC(under,table)) plc(%x;%y,N):=XA(%x;PC([in],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); plc(kill,kitchen) > XA(kill,PC(in,kitchen)) pos(%x,N;%y,R):=NS(%x;?POS=SPR,?PER=%y,?GEN=%y); pos(book,I) > NS(book,my) pos(%x,N;%y,D):=NS(%x;%y); pos(book,my) > NS(book,my) rsn(%x,V;%y,N):=VA(%x;PC([because of],LEX=P,POS=PRE;%y)); rsn(kill,Peter) > XA(kill,PC(because of,Peter)) tim(%x;%y,N,@before):=XA(%x;PC([before],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); tim(minute,noon.@before) > XA(minute,PC(before,noon)) tim(%x;%y,N,@after):=XA(%x;PC([after],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); tim(minute,noon.@after) > XA(minute,PC(before,after)) tim(%x;%y,N,@since):=XA(%x;PC([since],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); tim(minute,noon.@since) > XA(minute,PC(before,since)) tim(%x;%y,N,@until):=XA(%x;PC([until],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); tim(minute,noon.@until) > XA(minute,PC(before,until)) tim(%x;%y,N):=XA(%x;PC([at],LEX=P,POS=PRE;%y,-CAS,+CAS=OBL)); tim(minute,noon) > XA(minute,PC(at,noon)) tim(%x;%y,A):=XA(%x;%y); tim(kill,yesterday) > XA(kill,yesterday) and(%x;%y):=((%y,+>BLK)([and],LEX=C,POS=CCJ,+>BLK)(%x,+>BLK),+LEX=%x); or(%x;%y):=((%y,+>BLK)([or],LEX=C,POS=CCJ,+>BLK)(%x,+>BLK),+LEX=%x); ;============================================================================================ ;============================================================================================ ;2. ATTRIBUTES ;Converts semantic attributes into syntactic relations ;============================================================================================ ;============================================================================================ ;Determiners (%x,N,@def):=(NS(%x,-@def;%y,[the],+LEX=D,+POS=ART),+LEX=N); book.@def > NS(book,the) (%x,N,@indef):=(NS(%x,-@indef;%y,[a],+LEX=D,+POS=ART),+LEX=N); book.@indef > NS(book,a) (%x,N,@all):=(NS(%x,-@all,-NUM,+NUM=PLR;%y,[all],+LEX=D,+POS=QUA,+DIS=BEF),+LEX=N); book.@all > NA(books,all) (%x,N,@other):=(NS(%x,-@other;%y,[other],+LEX=D,+POS=DEM,+DIS=BEF),+LEX=N); book.@other > NA(book,other) (%x,N,@no):=(NS(%x,-@no;%y,[no],+LEX=D,+POS=QUA),+LEX=N); book.@no > NS(book,no) (%x,N,@paucal):=(NS(%x,-@paucal,-NUM,+NUM=PLR;%y,[few],+LEX=D,+POS=QUA,+DIS=BEF),+LEX=N); book.@paucal > NA(books,few) (%x,N,@multal):=(NS(%x,-@multal,-NUM,+NUM=PLR;%y,[many],+LEX=D,+POS=QUA,+DIS=BEF),+LEX=N); book.@multal > NA(books,many) ;Adverbs (%x,J,@plus):=(JS(%x,-@plus;%y,[very],+LEX=A,+POS=SAV,+DIS=BEF),+LEX=J,+DIS=%x); beautiful.@plus > JS(beautiful,very) (%x,V,^COP,@not):=(VA(%x,-@not;%y,[not],+LEX=A,+POS=SAV,+DIS=BEF),+LEX=V); arrive.@not > VA(arrive,not) (%x,V,COP,@not):=(VA(%x,-@not;%y,[not],+LEX=A,+POS=SAV,+DIS=AFT),+LEX=V); arrive.@not > VA(arrive,not) ;Tense (%x,V,@future):=+IC(%y,[will],+LEX=I,+POS=AUX,+ATE=FUT,+PER=%x;%x,-@future,-ATE,-PER,+VBL=INF); arrive.@future > will arrive (%x,V,@present):=(%x,-@present,-VBL,+ATE=PRS); (%x,V,@past):=(%x,-@past,-VBL,+ATE=PAS); (%x,V,@anterior):=+IC(%y,?[have],?[[]],?LEX=I,?POS=AUX,+PER=%x,+ATE=%x;%x,-@anterior,-ATE,-PER,+VBL=PTP); arrive.@anterior > have arrived ;Aspect (%x,V,@progressive):=+IC(%y,?[be],?[[]],?LEX=I,?POS=AUX,+PER=%x,+ATE=%x;%x,-@progressive,-ATE,-PER,+VBL=GER); arrive.@progressive > be arriving ;Modality (%x,V,@obligation):=+IC(%y,[must],+LEX=I,+POS=MOV;%x,-@obligation,-ATE,-PER,+VBL=INF); arrive.@obligation > must arrive ;Voice VS(%x,@reflexive;%y):=+VC(%x,-@reflexive;?[[%y]],?POS=FPR,-CAS,+CAS=OBL); VS(kill.@reflexive,he) > VS(kill,he)VC(kill,himself) ;Number (%x,@pl):=(%x,-@pl,-NUM,+NUM=PLR); ;Interrogative (%x,@interrogative)(%y,{BLK|STAIL}):=(%x,-@interrogative)(%new,"?",PUT=EMARK)(%y); ;============================================================================================ ;============================================================================================ ;2. POST-PROCESSING ;Normalizes the list output ;============================================================================================ ;============================================================================================ ;Auxiliary VA(%x,^COP,ATE;%y,[not]):=+IC(%z,?[do],?[[]],?LEX=I,?POS=AUX,+ATE=%x,+PER=%x;%x,-ATE,-PER,+VBL=INF); VC(arrive,not) > VC(arrive,not)IC(do,arrive) ;Coordination ([and],%c1)(%x)({[and]|COMMA},%c2):=([,],",",+PUT=COMMA,+>BLK,$c3)(%x)(%c2); ([or],%c1)(%x)({[or]|COMMA},%c2):=([,],",",+PUT=COMMA,+>BLK,$c3)(%x)(%c2); ;Determiners (D,%d)([all],%all):=(%all)(%d); the all books > all the books, my all books > all my books