From be3c9fe1994020cac525b5dffb0fc968ca95a3d3 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 17 Feb 2006 13:20:10 +0000 Subject: [PATCH] changed representation of clitics in romance VP (French ready) --- lib/resource-1.0/french/DiffFre.gf | 60 ++++++++++---- lib/resource-1.0/french/ResFre.gf | 2 + lib/resource-1.0/romance/AdjectiveRomance.gf | 2 +- lib/resource-1.0/romance/CatRomance.gf | 2 +- lib/resource-1.0/romance/CommonRomance.gf | 19 +++++ lib/resource-1.0/romance/DiffRomance.gf | 15 +--- lib/resource-1.0/romance/PhraseRomance.gf | 2 + lib/resource-1.0/romance/ResRomance.gf | 87 +++++++++----------- lib/resource-1.0/romance/VerbRomance.gf | 6 +- 9 files changed, 116 insertions(+), 79 deletions(-) diff --git a/lib/resource-1.0/french/DiffFre.gf b/lib/resource-1.0/french/DiffFre.gf index cb50f276d..3baed1f48 100644 --- a/lib/resource-1.0/french/DiffFre.gf +++ b/lib/resource-1.0/french/DiffFre.gf @@ -2,6 +2,8 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in { + flags optimize=all ; + param Prep = P_de | P_a ; NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr @@ -57,13 +59,25 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in { vpAgrClit : Agr -> VPAgr = \a -> VPAgrClit (aagr a.g a.n) ; --- subty - placeNewClitic = \ci,c,pro,isc,old -> - let new = if_then_Str isc (pro.s ! Aton c) [] - in - case pro.a.p of { - P1 | P2 => new ++ old ; - _ => old ++ new - } ; + pronArg = \n,p,acc,dat -> + let + pacc = case acc of { + CRefl => case p of { + P3 => elision "s" ; --- use of reflPron incred. expensive + _ => argPron Fem n p Acc + } ; + CPron a => argPron a.g a.n a.p Acc ; + _ => [] + } ; + pdat = case dat of { + CPron a => argPron a.g a.n a.p dative ; + _ => [] + } ; + in + case dat of { + CPron {p = P3} => ; + _ => + } ; negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; @@ -95,19 +109,35 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in { partQIndir = elision "c" ; - reflPron : Number => Person => Case => Str = + reflPron : Number -> Person -> Case -> Str = \n,p,c -> + let pron = argPron Fem n p c in + case of { + => elision "s" ; + => prepCase c ++ "soi" ; + _ => pron + } ; + + argPron : Gender -> Number -> Person -> Case -> Str = let - cases : (x,y : Str) -> (Case => Str) = \me,moi -> table { + cases : (x,y : Str) -> Case -> Str = \me,moi,c -> case c of { Acc | CPrep P_a => me ; _ => moi } ; + cases3 : (x,y,z : Str) -> Case -> Str = \les,leur,eux,c -> case c of { + Acc => les ; + CPrep P_a => leur ; + _ => eux + } ; in - \\n,p => case of { - => cases (elision "m") "moi" ; - => cases (elision "t") "toi" ; - => \\_ => "nous" ; - => \\_ => "vous" ; - _ => cases (elision "s") "soi" + \g,n,p -> case of { + <_,Sg,P1> => cases (elision "m") "moi" ; + <_,Sg,P2> => cases (elision "t") "toi" ; + <_,Pl,P1> => \_ -> "nous" ; + <_,Pl,P2> => \_ -> "vous" ; + => cases3 elisLa "lui" "elle" ; + <_,Sg,P3> => cases3 (elision "l") "lui" "lui" ; + => cases3 "les" "leur" "elles" ; + <_,Pl,P3> => cases3 "les" "leur" "eux" } ; vRefl : VType = VRefl ; diff --git a/lib/resource-1.0/french/ResFre.gf b/lib/resource-1.0/french/ResFre.gf index 35aa101df..878f3d17a 100644 --- a/lib/resource-1.0/french/ResFre.gf +++ b/lib/resource-1.0/french/ResFre.gf @@ -8,4 +8,6 @@ instance ResFre of ResRomance = DiffFre ** open CommonRomance, Prelude in { +flags optimize=all ; + } ; diff --git a/lib/resource-1.0/romance/AdjectiveRomance.gf b/lib/resource-1.0/romance/AdjectiveRomance.gf index a63a7c7c4..32b8fb2c7 100644 --- a/lib/resource-1.0/romance/AdjectiveRomance.gf +++ b/lib/resource-1.0/romance/AdjectiveRomance.gf @@ -21,7 +21,7 @@ incomplete concrete AdjectiveRomance of Adjective = ReflA2 adj = { s = \\af => - adj.s ! Posit ! af ++ adj.c2.s ++ reflPron ! Sg ! P3 ! adj.c2.c ; --- agr + adj.s ! Posit ! af ++ adj.c2.s ++ reflPron Sg P3 adj.c2.c ; --- agr isPre = False } ; diff --git a/lib/resource-1.0/romance/CatRomance.gf b/lib/resource-1.0/romance/CatRomance.gf index f46bbf4d5..e90f33469 100644 --- a/lib/resource-1.0/romance/CatRomance.gf +++ b/lib/resource-1.0/romance/CatRomance.gf @@ -35,7 +35,7 @@ incomplete concrete CatRomance of Cat = -- Verb - VP = ResRomance.VP ; + VP = CommonRomance.VP ; Comp = {s : Agr => Str} ; SC = {s : Str} ; diff --git a/lib/resource-1.0/romance/CommonRomance.gf b/lib/resource-1.0/romance/CommonRomance.gf index d2fcf94be..3983ac530 100644 --- a/lib/resource-1.0/romance/CommonRomance.gf +++ b/lib/resource-1.0/romance/CommonRomance.gf @@ -113,6 +113,10 @@ oper param RAgr = RAg {g : Gender ; n : Number} | RNoAg ; --- AAgr +-- Clitic slots. + + CAgr = CPron {g : Gender ; n : Number ; p : Person} | CRefl | CNone ; --- Agr + oper aagr : Gender -> Number -> AAgr = \g,n -> {g = g ; n = n} ; @@ -169,5 +173,20 @@ oper | VPAgrClit -- elle a dormi; elle les a vues {g : Gender ; n : Number} ; + oper + VP : Type = { + s : VPForm => { + fin : Agr => Str ; -- ai + inf : AAgr => Str -- dit + } ; + agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic + neg : Polarity => (Str * Str) ; -- ne-pas + clAcc : CAgr ; -- le/se + clDat : CAgr ; -- lui + clit2 : Str ; -- y en + comp : Agr => Str ; -- content(e) ; à ma mère ; hier + ext : Polarity => Str ; -- que je dors / que je dorme + } ; + } diff --git a/lib/resource-1.0/romance/DiffRomance.gf b/lib/resource-1.0/romance/DiffRomance.gf index 864b6815e..3a7e5f176 100644 --- a/lib/resource-1.0/romance/DiffRomance.gf +++ b/lib/resource-1.0/romance/DiffRomance.gf @@ -45,17 +45,9 @@ interface DiffRomance = open CommonRomance, Prelude in { oper clitInf : Str -> Str -> Str ; --- If a new clitic is placed before an existing one. --- (Fre "le lui", Ita "glie lo"). - - placeNewClitic : - (Case * Number * Person) -> -- info on old clit - Case -> -- case of new clit - {s : NPForm => Str ; a : Agr ; hasClit : Bool} -> -- new clit - Bool -> -- whether to clit'ze - Str -> -- old clit - Str ; -- old + new (or rev.) +-- To render pronominal arguments as clitics and/or ordinary complements. + pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ; --2 Constants that must derivatively depend on language @@ -89,7 +81,8 @@ interface DiffRomance = open CommonRomance, Prelude in { partQIndir : Str ; -- ce, ciò - reflPron : Number => Person => Case => Str ; + reflPron : Number -> Person -> Case -> Str ; + argPron : Gender -> Number -> Person -> Case -> Str ; auxPassive : Verb ; diff --git a/lib/resource-1.0/romance/PhraseRomance.gf b/lib/resource-1.0/romance/PhraseRomance.gf index fb4ef0e2d..3c604646d 100644 --- a/lib/resource-1.0/romance/PhraseRomance.gf +++ b/lib/resource-1.0/romance/PhraseRomance.gf @@ -1,6 +1,8 @@ incomplete concrete PhraseRomance of Phrase = CatRomance ** open CommonRomance, ResRomance, Prelude in { + flags optimize = all_subs ; + lin PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; diff --git a/lib/resource-1.0/romance/ResRomance.gf b/lib/resource-1.0/romance/ResRomance.gf index fd2bfae22..4009ec22d 100644 --- a/lib/resource-1.0/romance/ResRomance.gf +++ b/lib/resource-1.0/romance/ResRomance.gf @@ -3,6 +3,7 @@ interface ResRomance = DiffRomance ** open CommonRomance, Prelude in { +flags optimize=all ; --2 Constants uniformly defined in terms of language-dependent constants @@ -38,21 +39,6 @@ oper _ => Ton c } ; - - VP : Type = { - s : VPForm => { - fin : Agr => Str ; -- ai - inf : AAgr => Str -- dit - } ; - agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic - neg : Polarity => (Str * Str) ; -- ne-pas - clit1 : Agr => Str ; -- se lui - clInfo : Case * Number * Person ; -- whether and what fills clit1 (Nom = none) - clit2 : Str ; -- y en - comp : Agr => Str ; -- content(e) ; à ma mère ; hier - ext : Polarity => Str ; -- que je dors / que je dorme - } ; - appCompl : Compl -> (NPForm => Str) -> Str = \comp,np -> comp.s ++ np ! Ton comp.c ; @@ -77,11 +63,6 @@ oper inf = \\a => inf a } ; - cli : (Agr => Str) * (Case * Number * Person) = case isVRefl typ of { - True => <\\a => reflPron ! a.n ! a.p ! Acc,> ; --- n,p - _ => <\\_ => [], > -- not care - } ; - in { s = table { VPFinite t Simul => vf (vfin t) (\_ -> []) ; @@ -92,8 +73,11 @@ oper } ; agr = partAgr typ ; neg = negation ; - clit1 = cli.p1 ; - clInfo = cli.p2 ; + clAcc = case isVRefl typ of { + True => CRefl ; + _ => CNone + } ; + clDat = CNone ; --- no dative refls clit2 = [] ; comp = \\a => [] ; ext = \\p => [] @@ -101,51 +85,58 @@ oper insertObject : Compl -> Pronoun -> VP -> VP = \c,np,vp -> let - cc : Bool * Str * VPAgr = case of { - | - <_,_,False> => ; - <_,Acc,_> => ; - _ => + vpacc = vp.clAcc ; + vpdat = vp.clDat ; + vpagr = vp.agr ; + npa = np.a ; + noNewClit = ; + + cc : CAgr * CAgr * Str * VPAgr = case of { + => case c.c of { + Acc => ; + _ => -- must be dat + } ; + _ => noNewClit } ; + in { s = vp.s ; - agr = cc.p3 ; - clit1 = \\a => placeNewClitic vp.clInfo c.c np cc.p1 (vp.clit1 ! a) ; - clInfo = case cc.p1 of { - False => vp.clInfo ; -- no new clitic - _ => - } ; + agr = cc.p4 ; + clAcc = cc.p1 ; + clDat = cc.p2 ; clit2 = vp.clit2 ; neg = vp.neg ; - comp = \\a => vp.comp ! a ++ cc.p2 ; + comp = \\a => vp.comp ! a ++ cc.p3 ; ext = vp.ext ; } ; insertComplement : (Agr => Str) -> VP -> VP = \co,vp -> { s = vp.s ; agr = vp.agr ; - clit1 = vp.clit1 ; - clInfo = vp.clInfo ; + clAcc = vp.clAcc ; + clDat = vp.clDat ; clit2 = vp.clit2 ; neg = vp.neg ; comp = \\a => vp.comp ! a ++ co ! a ; ext = vp.ext ; } ; + insertAdv : Str -> VP -> VP = \co,vp -> { s = vp.s ; agr = vp.agr ; - clit1 = vp.clit1 ; - clInfo = vp.clInfo ; + clAcc = vp.clAcc ; + clDat = vp.clDat ; clit2 = vp.clit2 ; neg = vp.neg ; comp = \\a => vp.comp ! a ++ co ; ext = vp.ext ; } ; + insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> { s = vp.s ; agr = vp.agr ; - clit1 = vp.clit1 ; - clInfo = vp.clInfo ; + clAcc = vp.clAcc ; + clDat = vp.clDat ; clit2 = vp.clit2 ; neg = vp.neg ; comp = vp.comp ; @@ -167,20 +158,20 @@ oper verb = vps.fin ! agr ; inf = vps.inf ! (appVPAgr vp.agr (aagr agr.g agr.n)) ; --- subtype bug neg = vp.neg ! b ; - clit = vp.clit1 ! agr ++ vp.clit2 ; - compl = vp.comp ! agr ++ vp.ext ! b + clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; + compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b in - subj ++ neg.p1 ++ clit ++ verb ++ neg.p2 ++ inf ++ compl + subj ++ neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ inf ++ compl } ; infVP : VP -> Agr -> Str = \vp,agr -> let - inf = (vp.s ! VPInfinit Simul).inf ! (aagr agr.g agr.n) ; - neg = vp.neg ! Pos ; --- Neg not in API - cli = vp.clit1 ! agr ++ vp.clit2 ; - obj = vp.comp ! agr + inf = (vp.s ! VPInfinit Simul).inf ! (aagr agr.g agr.n) ; + neg = vp.neg ! Pos ; --- Neg not in API + clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; + obj = clpr.p2 ++ vp.comp ! agr in - clitInf cli inf ++ obj ; + clitInf clpr.p1 inf ++ obj ; } diff --git a/lib/resource-1.0/romance/VerbRomance.gf b/lib/resource-1.0/romance/VerbRomance.gf index 9d27dded2..0f3b09719 100644 --- a/lib/resource-1.0/romance/VerbRomance.gf +++ b/lib/resource-1.0/romance/VerbRomance.gf @@ -6,9 +6,9 @@ incomplete concrete VerbRomance of Verb = lin UseV = predV ; - ComplV2 v np = insertObject v.c2 np (predV v) ; + ComplV2 v np1 = insertObject v.c2 np1 (predV v) ; - ComplV3 v np np2 = insertObject v.c3 np2 (insertObject v.c2 np (predV v)) ; + ComplV3 v np1 np2 = insertObject v.c3 np2 (insertObject v.c2 np1 (predV v)) ; ComplVV v vp = insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ; @@ -34,7 +34,7 @@ incomplete concrete VerbRomance of Verb = ReflV2 v = case v.c2.isDir of { True => predV {s = v.s ; vtyp = vRefl} ; False => insertComplement - (\\a => v.c2.s ++ reflPron ! a.n ! a.p ! v.c2.c) (predV v) + (\\a => v.c2.s ++ reflPron a.n a.p v.c2.c) (predV v) } ; PassV2 v = insertComplement (\\a => v.s ! VPart a.g a.n) (predV auxPassive) ;