From e40cceeb4c8020583d124ce167ae597d89e82878 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 20 Jan 2006 13:40:19 +0000 Subject: [PATCH] clitic insertion started --- lib/resource-1.0/french/LangFre.gf | 2 +- lib/resource-1.0/french/MorphoFre.gf | 2 - lib/resource-1.0/french/ParadigmsFre.gf | 2 +- lib/resource-1.0/romance/CatRomance.gf | 2 +- lib/resource-1.0/romance/CommonRomance.gf | 184 ---------------------- lib/resource-1.0/romance/DiffRomance.gf | 86 ---------- lib/resource-1.0/romance/ResRomance.gf | 40 +++-- lib/resource-1.0/romance/VerbRomance.gf | 4 +- 8 files changed, 29 insertions(+), 293 deletions(-) diff --git a/lib/resource-1.0/french/LangFre.gf b/lib/resource-1.0/french/LangFre.gf index 6fa21b6ae..48ede5030 100644 --- a/lib/resource-1.0/french/LangFre.gf +++ b/lib/resource-1.0/french/LangFre.gf @@ -12,7 +12,7 @@ concrete LangFre of Lang = -- ConjunctionFre, -- PhraseFre, -- TensedFre, --- StructuralFre, + StructuralFre, BasicFre ** { diff --git a/lib/resource-1.0/french/MorphoFre.gf b/lib/resource-1.0/french/MorphoFre.gf index 28b706c24..ac71a8c48 100644 --- a/lib/resource-1.0/french/MorphoFre.gf +++ b/lib/resource-1.0/french/MorphoFre.gf @@ -162,8 +162,6 @@ oper -- All the eight personal pronouns can be built by the following macro. -- The use of "en" as atonic genitive is debatable. - Pronoun = {s : NPForm => Str ; a : Agr ; c : ClitType} ; - mkPronoun : (_,_,_,_,_,_,_ : Str) -> Gender -> Number -> Person -> ClitType -> Pronoun = \il,le,lui,Lui,son,sa,ses,g,n,p,c -> diff --git a/lib/resource-1.0/french/ParadigmsFre.gf b/lib/resource-1.0/french/ParadigmsFre.gf index 537d431d2..bedf965a1 100644 --- a/lib/resource-1.0/french/ParadigmsFre.gf +++ b/lib/resource-1.0/french/ParadigmsFre.gf @@ -288,7 +288,7 @@ oper accusative = complAcc ; genitive = complGen ; dative = complDat ; - mkPreposition p = {s = p ; c = Acc} ; + mkPreposition p = {s = p ; c = Acc ; isDir = False} ; mkN x y g = mkCNomIrreg x y g ** {lock_N = <>} ; regN x g = mkNomReg x g ** {lock_N = <>} ; diff --git a/lib/resource-1.0/romance/CatRomance.gf b/lib/resource-1.0/romance/CatRomance.gf index 43f69d1c2..cac60880f 100644 --- a/lib/resource-1.0/romance/CatRomance.gf +++ b/lib/resource-1.0/romance/CatRomance.gf @@ -46,7 +46,7 @@ incomplete concrete CatRomance of Cat = -- Noun CN = {s : Number => Str ; g : Gender} ; - NP,Pron = {s : NPForm => Str ; a : Agr ; c : ClitType} ; + NP,Pron = Pronoun ; Det = {s : Gender => Case => Str ; n : Number} ; QuantSg = {s : Gender => Case => Str} ; QuantPl = {s : Gender => Case => Str} ; diff --git a/lib/resource-1.0/romance/CommonRomance.gf b/lib/resource-1.0/romance/CommonRomance.gf index 073a1bfbb..9bdb8c909 100644 --- a/lib/resource-1.0/romance/CommonRomance.gf +++ b/lib/resource-1.0/romance/CommonRomance.gf @@ -49,187 +49,3 @@ resource CommonRomance = ParamRomance ** open Prelude in { } -{- - oper - --- For $Lex$. - --- For each lexical category, here are the worst-case constructors. --- --- But $mkNoun$ is fully defined only for each language, since --- $Gender$ varies. - - nounForms : (x1,_,_,x4 : Str) -> (Number => Species => Case => Str) = - \man,mannen,men,mennen -> \\n,d,c => case of { - => mkCase c man ; - => mkCase c mannen ; - => mkCase c men ; - => mkCase c mennen - } ; - - Adjective : Type = {s : AForm => Str} ; - - mkAdjective : (x1,_,_,_,_,_,x7 : Str) -> {s : AForm => Str} = - \liten, litet, lilla, sma, mindre, minst, minsta -> { - s = table { - AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ; - AF ACompar c => mkCase c mindre ; - AF (ASuperl SupStrong) c => mkCase c minst ; - AF (ASuperl SupWeak) c => mkCase c minsta - } - } ; - - mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} = - \finna,finner,finn,fann,funnit,funnen,funnet,funna -> { - s = table { - VF (VPres Act) => finner ; - VF (VPres Pass) => mkVoice Pass finn ; - VF (VPret v) => mkVoice v fann ; - VF (VImper v) => mkVoice v finn ; - VI (VInfin v) => mkVoice v finna ; - VI (VSupin v) => mkVoice v funnit ; - VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna) - } ; - vtype = VAct - } ; - --- These are useful auxiliaries. - - mkCase : Case -> Str -> Str = \c,f -> case c of { - Nom => f ; - Gen => f + case last f of { - "s" | "x" => [] ; - _ => "s" - } - } ; - - mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str = - \a, liten, litet, lilla, sma -> - case a of { - Strong gn => case gn of { - SgUtr => liten ; - SgNeutr => litet ; - Plg => sma - } ; - Weak Sg => lilla ; - Weak Pl => sma - } ; - - mkVoice : Voice -> Str -> Str = \v,s -> case v of { - Act => s ; - Pass => s + case last s of { - "s" => "es" ; - _ => "s" - } - } ; - - --- For $Noun$. - - artDef : GenNum -> Str = \gn -> gennumForms "den" "det" "de" ! gn ; - - mkNP : (x1,_,_,_,x5 : Str) -> GenNum -> Person -> - {s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,gn,p -> { - s = table { - NPNom => du ; - NPAcc => dig ; - NPPoss g => gennumForms din ditt dina ! g - } ; - a = { - gn = gn ; - p = p - } - } ; - - gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de -> - table { - SgUtr => den ; - SgNeutr => det ; - _ => de - } ; - - regNP : Str -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} = - \det,dess,gn -> - mkNP det det dess dess dess gn P3 ; - - --- For $Verb$. - - Verb : Type = { - s : VForm => Str ; - vtype : VType - } ; - - VP = { - s : VPForm => { - fin : Str ; -- V1 har ---s1 - inf : Str -- V2 sagt ---s4 - } ; - a1 : Polarity => Str ; -- A1 inte ---s3 - n2 : Agr => Str ; -- N2 dig ---s5 - a2 : Str ; -- A2 idag ---s6 - ext : Str ; -- S-Ext att hon går ---s7 - --- ea1,ev2, --- these depend on params of v and a1 - en2,ea2,eext : Bool -- indicate if the field exists - } ; - - - insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { - s = vp.s ; - a1 = vp.a1 ; - n2 = \\a => vp.n2 ! a ++ obj ! a ; - a2 = vp.a2 ; - ext = vp.ext ; - en2 = True ; - ea2 = vp.ea2 ; - eext = vp.eext - } ; - - insertAdv : Str -> VP -> VP = \adv,vp -> { - s = vp.s ; - a1 = vp.a1 ; - n2 = vp.n2 ; - a2 = vp.a2 ++ adv ; - ext = vp.ext ; - en2 = vp.en2 ; - ea2 = True ; - eext = vp.eext - } ; - - insertAdV : Str -> VP -> VP = \adv,vp -> { - s = vp.s ; - a1 = \\b => vp.a1 ! b ++ adv ; - n2 = vp.n2 ; - a2 = vp.a2 ; - ext = vp.ext ; - en2 = vp.en2 ; - ea2 = vp.ea2 ; - eext = vp.eext - } ; - - infVP : VP -> Agr -> Str = \vp,a -> - (vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1 - - --- For $Sentence$. - - Clause : Type = { - s : Tense => Anteriority => Polarity => Order => Str - } ; - - mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> { - s = \\t,a,b,o => - let - verb = vp.s ! VPFinite t a ; - neg = vp.a1 ! b ; - compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext - in - case o of { - Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ; - Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ; - Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl - } - } ; - -} --} \ No newline at end of file diff --git a/lib/resource-1.0/romance/DiffRomance.gf b/lib/resource-1.0/romance/DiffRomance.gf index 44b5fe65f..80e9b0527 100644 --- a/lib/resource-1.0/romance/DiffRomance.gf +++ b/lib/resource-1.0/romance/DiffRomance.gf @@ -40,89 +40,3 @@ oper } -{- - ---2 Constants uniformly defined in terms of language-dependent constants - -param - - Case = Nom | Acc | CPrep Prep ; - - NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr - - RelForm = RSimple Case | RComplex Gender Number Case ; - - -oper - - Compl : Type = {s : Str ; c : Case} ; - - npform2case : NPForm -> Case = \p -> case p of { - Ton x => x ; - Aton x => x ; - Poss _ => genitive - } ; - - case2npform : Case -> NPForm = \c -> case c of { - Nom => Aton Nom ; - Acc => Aton Acc ; - _ => Ton c - } ; - - npRelForm : NPForm -> RelForm = \np -> case np of { - Ton c => RSimple c ; - Aton c => RSimple c ; - Poss _ => RSimple genitive - } ; - - appCompl : Compl -> (NPForm => Str) -> Str = \comp,np -> - comp.s ++ np ! Ton comp.c ; - - - Verb = {s : VF => Str ; aux : VAux ; isRefl : Bool} ; -{- - predV : Verb -> VP = \verb -> - let - diath = case verb.vtype of { - VPass => Pass ; - _ => Act - } ; - vfin : Tense -> Str = \t -> verb.s ! vFin t diath ; - vsup = verb.s ! VI (VSupin diath) ; - vinf = verb.s ! VI (VInfin diath) ; - - har : Tense -> Str = \t -> verbHave.s ! vFin t Act ; - ha : Str = verbHave.s ! VI (VInfin Act) ; - - vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> { - fin = fin ; inf = inf - } ; - - in { - s = table { - VPFinite t Simul => case t of { - Pres | Past => vf (vfin t) [] ; - Fut => vf auxFut vinf ; - Cond => vf auxCond vinf - } ; - VPFinite t Anter => case t of { - Pres | Past => vf (har t) vsup ; - Fut => vf auxFut (ha ++ vsup) ; - Cond => vf auxCond (ha ++ vsup) - } ; - VPImperat => vf (verb.s ! VF (VImper diath)) [] ; - VPInfinit Simul => vf [] vinf ; - VPInfinit Anter => vf [] (ha ++ vsup) - } ; - a1 : Polarity => Str = negation ; - n2 : Agr => Str = \\a => case verb.vtype of { - VRefl => reflPron a ; - _ => [] - } ; - a2 : Str = [] ; - ext : Str = [] ; - en2,ea2,eext : Bool = False -- indicate if the field exists - } ; --} - - diff --git a/lib/resource-1.0/romance/ResRomance.gf b/lib/resource-1.0/romance/ResRomance.gf index fcf33e3ca..65415c25b 100644 --- a/lib/resource-1.0/romance/ResRomance.gf +++ b/lib/resource-1.0/romance/ResRomance.gf @@ -18,11 +18,13 @@ oper nominative : Case = Nom ; accusative : Case = Acc ; - Compl : Type = {s : Str ; c : Case} ; + Pronoun = {s : NPForm => Str ; a : Agr ; c : ClitType} ; - complAcc : Compl = {s = [] ; c = accusative} ; - complGen : Compl = {s = [] ; c = genitive} ; - complDat : Compl = {s = [] ; c = dative} ; + Compl : Type = {s : Str ; c : Case ; isDir : Bool} ; + + complAcc : Compl = {s = [] ; c = accusative ; isDir = True} ; + complGen : Compl = {s = [] ; c = genitive ; isDir = False} ; + complDat : Compl = {s = [] ; c = dative ; isDir = True} ; npform2case : NPForm -> Case = \p -> case p of { Ton x => x ; @@ -81,20 +83,24 @@ oper adv = [] ; ext = [] ; } ; -{- - insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { - s = vp.s ; - agr = - - a1 = vp.a1 ; - n2 = \\a => vp.n2 ! a ++ obj ! a ; - a2 = vp.a2 ; - ext = vp.ext ; - en2 = True ; - ea2 = vp.ea2 ; - eext = vp.eext + + insertObject : Compl -> Pronoun -> VP -> VP = \c,np,vp -> + let + cc : Str * Str * VPAgr = case of { + | <_,Clit0> => <[], c.s ++ np.s ! Ton c.c, vp.agr> ; + _ => + } + in { + s = vp.s ; + agr = cc.p3 ; + clit1 = vp.clit1 ; ---- works for one clit now + clit2 = cc.p1 ; + neg = vp.neg ; + comp = \\a => vp.comp ! a ++ cc.p2 ; + adv = vp.adv ; + ext = vp.ext ; } ; --} + mkClause : Str -> Agr -> VP -> {s : Tense => Anteriority => Polarity => Mood => Str} = \subj,agr,vp -> { diff --git a/lib/resource-1.0/romance/VerbRomance.gf b/lib/resource-1.0/romance/VerbRomance.gf index d8829236d..f698695c3 100644 --- a/lib/resource-1.0/romance/VerbRomance.gf +++ b/lib/resource-1.0/romance/VerbRomance.gf @@ -4,8 +4,10 @@ incomplete concrete VerbRomance of Verb = CatRomance ** open DiffRomance, ResRom lin UseV = predV ; + + ComplV2 v np = insertObject v.c2 np (predV v) ; + {- - ComplV2 v np = insertObj (\\_ => v.c2 ++ np.s ! accusative) (predV v) ; ComplV3 v np np2 = insertObj (\\_ => v.c2 ++ np.s ! accusative ++ v.c3 ++ np2.s ! accusative)