%Based on Graham Wilcock's implementation of the Sag and Wasow book %Extended by Paul Bennett % Additions include classification of verbs following Dixon /*******************************************************/ /* GramKit SW13-HPSG1 */ /* Implementing Sag & Wasow 1999 (Chapter 13) */ /* in ProFIT for GramKit parser/generator */ /* */ /* Graham Wilcock (graham@ccl.umist.ac.uk) 98/12 */ /*******************************************************/ :- multifile '--->'/2. :- op(1200, yfx, --->). :- use_module(lists, library(lists), [append/3, is_list/1, reverse/2, permutation/2]). /*******************************************************/ /* Sort Hierarchy and Feature Declarations */ /*******************************************************/ top > [feat_struc]. feat_struc > [synsem_struc, agr_cat, gram_cat, val_cat, pos, sem_struc, pred, ind]. synsem_struc > [phrase, lex_item] intro [phon, syn:gram_cat, sem:sem_struc]. lex_item > [word, lxm] intro [arg_st]. lxm > [const_lxm, infl_lxm]. const_lxm > [prep_lxm, adj_lxm, adv_lxm, conj_lxm, comp_lxm]. prep_lxm > [pdp_lxm, mkp_lxm]. infl_lxm > [noun_lxm, verb_lxm]. noun_lxm > [pron_lxm, pn_lxm, cn_lxm]. verb_lxm > [tv_lxm, iv_lxm, ppv_lxm, others]. iv_lxm > [srv_lxm, motion_verb, rest_verb, corporeal_verb, attention_verb, weather_verb]. tv_lxm > [rest_verb, follow_verb, give_verb, build_verb, affect_verb, corporeal_verb, attention_verb, think_verb, like_verb, annoy_verb, arrive_verb, speaking_verb]. ppv_lxm > [rest_verb, corporeal_verb, speaking_verb, affect_verb]. others > [think_verb, extrap_lxm, sor_lxm, attention_verb]. adj_lxm > [raising_adj]. agr_cat fin_dom [m,f,n] * [sg,pl] * [1,2,3]. gram_cat intro [head:pos, val:val_cat]. val_cat intro [comps, spr]. pos > [verb, adv, adj, conj, prep, nom, comp] intro [form, pred, mod]. nom > [noun, det] intro [agr:agr_cat]. noun intro [case, ana]. det intro [count]. prep intro [p_obj]. verb intro [aux, neg, inv]. sem_struc intro [mode, index, restr]. pred > [inst, arg, two_arg, name, sit] intro [reln, sit, det, event_time, ref_time, speech_time, aspect]. inst intro [inst]. arg intro [arg, arbiter]. two_arg intro [arg1, arg2]. name intro [name, named]. sit > [motion, rest, follow, affect, giving, corporeal, building, attention, thinking, speaking, liking, annoying, wanting, postponing, happy, aware, influence, commitment, orientation]. rest intro [causer, resting, locus, entity, object]. follow intro [moving, locus]. affect intro [agent, manipulated, target]. building intro [agent, manipulated, product]. giving intro [donor, gift, recipient]. corporeal intro [causer, human, substance, thing]. attention intro [causer, perceiver, impression]. thinking intro [cogitator, thought]. speaking intro [speaker, addressee, message]. liking intro [experiencer, stimulus]. happy intro [theme]. aware intro [cogitator, stimulus]. influence intro [influence, influenced, soa]. commitment intro [committor, commissee, soa]. orientation intro [experiencer, soa]. /*******************************************************/ /* Phrase Structure Rules */ /*******************************************************/ /******************************/ /* HPSG Principles */ /******************************/ /* Head Feature Principle */ 'HFP1' := (syn!head!HF ---> [syn!head!HF|_]). 'HFP2' := (syn!head!HF ---> [_,syn!head!HF|_]). /* Valence Principle */ 'VALP1' := (syn!val!spr!Spr ---> [syn!val!spr!Spr|_]). 'VALP2' := (syn!val!comps![] ---> [_,syn!val!comps![]|_]). /* Semantics Principle */ 'SemP1' := (sem!(mode!M & index!I) ---> [sem!(mode!M & index!I)|_]). 'SemP2' := (sem!(mode!M & index!I) ---> [_,sem!(mode!M & index!I)|_]). 'Restr1' := (sem!restr!R0-RN ---> [sem!restr!R0-RN]). 'Restr2' := (sem!restr!R0-RN ---> [sem!restr!R0-R1,sem!restr!R1-RN]). 'Restr3' := (sem!restr!R0-RN ---> [sem!restr!R0-R1,sem!restr!R1-R2,sem!restr!R2-RN]). /* Phon Concatenation */ 'Phon1' := (phon!P0-PN ---> [phon!P0-PN]). 'Phon2' := (phon!P0-PN ---> [phon!P0-P1,phon!P1-PN]). 'Phon3' := (phon!P0-PN ---> [phon!P0-P1,phon!P1-P2,phon!P2-PN]). /******************************/ /* Head-Specifier Rule, p84 */ /******************************/ @'Phon2' & @'HFP2' & @'VALP2' & @'SemP2' & @'Restr2' & ( [ Spr, [ [ [ [ Phrase & [ [ [ [ [ 90 -> C is L - 32 ; C = L), name(Root, [C]), gensym(Root, Var). /*******************************************************/ /* gensym/2 (from Clocksin & Mellish) */ /*******************************************************/ gensym(Root,Atom) :- getNum(Root,Num), name(Root,Name1), numeral(Num,Name2), append(Name1,Name2,Name), name(Atom,Name). getNum(Root,Num) :- retract(current_num(Root,Num1)),!, Num is Num1+1, asserta(current_num(Root,Num)). getNum(Root,1) :- asserta(current_num(Root,1)). numeral(Int,List) :- numeral(Int,[],List). numeral(I,Sofar,[C|Sofar]) :- I < 10,!, C is I + 48. numeral(I,Sofar,List) :- Tophalf is I//10, % '//' for integer in Sicstus. Bothalf is I mod 10, C is Bothalf+48, numeral(Tophalf,[C|Sofar],List). /*******************************************************/ /* End of GramKit Grammar */ /*******************************************************/