From add4702320cd2b53ec8c4e1f8749b67e4fe22fcf Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 20 Aug 2009 21:08:22 +0000 Subject: [PATCH] simplified Romance VP and fixed some bugs --- lib/src/catalan/DiffCat.gf | 2 +- lib/src/catalan/IdiomCat.gf | 6 +-- lib/src/french/DiffFre.gf | 2 +- lib/src/french/IdiomFre.gf | 2 +- lib/src/italian/DiffIta.gf | 4 +- lib/src/italian/IdiomIta.gf | 7 ++- lib/src/romance/CommonRomance.gf | 9 ++++ lib/src/romance/DiffRomance.gf | 13 ++++- lib/src/romance/ResRomance.gf | 81 ++++-------------------------- lib/src/romance/SentenceRomance.gf | 2 +- lib/src/spanish/DiffSpa.gf | 2 +- lib/src/spanish/IdiomSpa.gf | 6 +-- 12 files changed, 47 insertions(+), 89 deletions(-) diff --git a/lib/src/catalan/DiffCat.gf b/lib/src/catalan/DiffCat.gf index b77aee6e2..1c626054c 100644 --- a/lib/src/catalan/DiffCat.gf +++ b/lib/src/catalan/DiffCat.gf @@ -97,7 +97,7 @@ oper ----e => (vp.s ! VPInfinit Simul clpr.p3).inf ! aag ; ----e _ => (vp.s ! VPImperat).fin ! agr ----e } ; - verb = (vp.s ! VPImperat).fin ! agr ; ----e + verb = vp.s.s ! vImperForm agr ; ----e neg = vp.neg ! pol ; compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol in diff --git a/lib/src/catalan/IdiomCat.gf b/lib/src/catalan/IdiomCat.gf index d449a73eb..9a6079dcd 100644 --- a/lib/src/catalan/IdiomCat.gf +++ b/lib/src/catalan/IdiomCat.gf @@ -10,14 +10,14 @@ concrete IdiomCat of Idiom = CatCat ** ImpersCl vp = mkClause [] True (agrP3 Masc Sg) vp ; - ProgrVP vpr = let vp = useVP vpr in + ProgrVP vp = insertComplement (\\agr => let clpr = ; ----e pronArg agr.n agr.p vp.clAcc vp.clDat ; obj = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol in - (vp.s ! VPGerund).inf ! (aagr agr.g agr.n) ++ clpr.p1 ++ obj + vp.s.s ! VGer ++ clpr.p1 ++ obj ) (predV (verbV (estar_54 "estar"))) ; @@ -37,7 +37,7 @@ concrete IdiomCat of Idiom = CatCat ** .s ! DDir ! t ! a ! p ! Indic } ; - ImpPl1 vpr = let vp = useVP vpr in {s = + ImpPl1 vp = {s = (mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem } ; diff --git a/lib/src/french/DiffFre.gf b/lib/src/french/DiffFre.gf index 4d28796b1..bdb85ec1e 100644 --- a/lib/src/french/DiffFre.gf +++ b/lib/src/french/DiffFre.gf @@ -122,7 +122,7 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in { let num = if_then_else Number b Pl aag.n ; agr = {g = aag.g ; n = num ; p = p} ; - verb = (vp.s ! VPImperat).fin ! agr ; + verb = vp.s.s ! vImperForm agr ; neg = vp.neg ! pol ; hascl = False ; ----e(pronArg agr.n agr.p vp.clAcc vp.clDat).p3 ; clpr = <[],[]> ; ----e pronArgGen pol agr.n agr.p vp.clAcc vp.clDat ; diff --git a/lib/src/french/IdiomFre.gf b/lib/src/french/IdiomFre.gf index e8abaac21..be62dc374 100644 --- a/lib/src/french/IdiomFre.gf +++ b/lib/src/french/IdiomFre.gf @@ -33,7 +33,7 @@ concrete IdiomFre of Idiom = CatFre ** (\\a => "en" ++ "train" ++ elisDe ++ infVP vp a) (predV copula) ; - ImpPl1 vpr = let vp = useVP vpr in {s = + ImpPl1 vp = {s = (mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem } ; diff --git a/lib/src/italian/DiffIta.gf b/lib/src/italian/DiffIta.gf index d6ab22238..0aa92879f 100644 --- a/lib/src/italian/DiffIta.gf +++ b/lib/src/italian/DiffIta.gf @@ -114,8 +114,8 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud agr = aag ** {p = pe} ; clpr = ; ----e pronArg agr.n agr.p vp.clAcc vp.clDat ; verb = case of { - => (vp.s ! VPInfinit Simul clpr.p3).inf ! aag ; - _ => (vp.s ! VPImperat).fin ! agr + => vp.s.s ! VInfin clpr.p3 ; ---- ! aag ; + _ => vp.s.s ! vImperForm agr } ; neg = vp.neg ! pol ; compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol diff --git a/lib/src/italian/IdiomIta.gf b/lib/src/italian/IdiomIta.gf index bac30d741..0ca5c094a 100644 --- a/lib/src/italian/IdiomIta.gf +++ b/lib/src/italian/IdiomIta.gf @@ -31,19 +31,18 @@ concrete IdiomIta of Idiom = CatIta ** (predV copula))).s ! DDir ! t ! a ! p ! Indic } ; - ProgrVP vpr = - let vp = useVP vpr in + ProgrVP vp = insertComplement (\\agr => let clpr = <[],[],False> ; ----e pronArg agr.n agr.p vp.clAcc vp.clDat ; obj = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol in - (vp.s ! VPGerund).inf ! (aagr agr.g agr.n) ++ clpr.p1 ++ obj + vp.s.s ! VGer ++ clpr.p1 ++ obj ) (predV (essereV (verboV (stare_16 "stare")))) ; - ImpPl1 vpr = let vp = useVP vpr in {s = + ImpPl1 vp = {s = (mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem } ; diff --git a/lib/src/romance/CommonRomance.gf b/lib/src/romance/CommonRomance.gf index 82da3b824..01c05ddf4 100644 --- a/lib/src/romance/CommonRomance.gf +++ b/lib/src/romance/CommonRomance.gf @@ -155,6 +155,15 @@ oper _ => VInfin False } ; + vImperForm : Agr -> VF = \a -> case of { + => VImper PlP1 ; + <_, P3> => VFin (VPres Conjunct) a.n P3 ; + => VImper SgP2 ; + => VImper PlP2 + } ; + + + --- oper diff --git a/lib/src/romance/DiffRomance.gf b/lib/src/romance/DiffRomance.gf index 70dd40943..742e98b6b 100644 --- a/lib/src/romance/DiffRomance.gf +++ b/lib/src/romance/DiffRomance.gf @@ -49,7 +49,7 @@ interface DiffRomance = open CommonRomance, Prelude in { -- To render imperatives (with their clitics etc). - oper mkImperative : Bool -> Person -> VPC -> {s : Polarity => AAgr => Str} ; + oper mkImperative : Bool -> Person -> VP -> {s : Polarity => AAgr => Str} ; --2 Constants that must derivatively depend on language @@ -103,6 +103,17 @@ param oper Verb = {s : VF => Str ; vtyp : VType} ; + VP : Type = { + s : Verb ; + agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic + neg : Polarity => (Str * Str) ; -- ne-pas + clit1 : Str ; -- le/se + clit2 : Str ; -- lui + clit3 : Str ; -- y en + comp : Agr => Str ; -- content(e) ; à ma mère ; hier + ext : Polarity => Str ; -- que je dors / que je dorme + } ; + --2 Workarounds, to be eliminated -- This should be provided by $pronArg$ above, but causes trouble in compilation. diff --git a/lib/src/romance/ResRomance.gf b/lib/src/romance/ResRomance.gf index 6c59f47e1..cff1ed633 100644 --- a/lib/src/romance/ResRomance.gf +++ b/lib/src/romance/ResRomance.gf @@ -12,7 +12,6 @@ oper nominative : Case = Nom ; accusative : Case = Acc ; ---e Pronoun = {s : NPForm => Str ; a : Agr ; hasClit : Bool} ; NounPhrase : Type = { s : Case => {c1,c2,comp,ton : Str} ; a : Agr ; @@ -27,7 +26,6 @@ oper a = np.a ; hasClit = False } ; ---e Compl : Type = {s : Str ; c : Case ; isDir : Bool} ; @@ -35,7 +33,6 @@ oper complGen : Compl = {s = [] ; c = genitive ; isDir = False} ; complDat : Compl = {s = [] ; c = dative ; isDir = True} ; ---e pn2np : {s : Str ; g : Gender} -> NounPhrase = \pn -> heavyNP { s = \\c => prepCase c ++ pn.s ; a = agrP3 pn.g Sg @@ -62,70 +59,9 @@ oper appCompl : Compl -> NounPhrase -> Str = \comp,np -> comp.s ++ (np.s ! comp.c).ton ; ---e appCompl : Compl -> (NPForm => Str) -> Str = \comp,np -> ---e comp.s ++ np ! Ton comp.c ; oper - VP : Type = { - s : Verb ; - agr : VPAgr ; -- dit/dite dep. on verb, subj, and clitic - neg : Polarity => (Str * Str) ; -- ne-pas - clit1 : Str ; -- le/se - clit2 : Str ; -- lui - clit3 : Str ; -- y en - comp : Agr => Str ; -- content(e) ; à ma mère ; hier - ext : Polarity => Str ; -- que je dors / que je dorme - } ; - - - useVP : VP -> VPC = \vp -> - let - verb = vp.s ; - vfin : TMood -> Agr -> Str = \tm,a -> verb.s ! VFin tm a.n a.p ; - vpart : AAgr -> Str = \a -> verb.s ! VPart a.g a.n ; - vinf : Bool -> Str = \b -> verb.s ! VInfin b ; - vger = verb.s ! VGer ; - - typ = verb.vtyp ; - aux = auxVerb typ ; - - habet : TMood -> Agr -> Str = \tm,a -> aux ! VFin tm a.n a.p ; - habere : Str = aux ! VInfin False ; - - vimp : Agr -> Str = \a -> case of { - => verb.s ! VImper PlP1 ; - <_, P3> => verb.s ! VFin (VPres Conjunct) a.n P3 ; - => verb.s ! VImper SgP2 ; - => verb.s ! VImper PlP2 - } ; - - vf : (Agr -> Str) -> (AAgr -> Str) -> { - fin : Agr => Str ; - inf : AAgr => Str - } = - \fin,inf -> { - fin = \\a => fin a ; - inf = \\a => inf a - } ; - - in { - s = table { - VPFinite t Simul => vf (vfin t) (\_ -> []) ; - VPFinite t Anter => vf (habet t) vpart ; --# notpresent - VPInfinit Anter b=> vf (\_ -> []) (\a -> habere ++ vpart a) ; --# notpresent - VPImperat => vf vimp (\_ -> []) ; - VPGerund => vf (\_ -> []) (\_ -> vger) ; - VPInfinit Simul b=> vf (\_ -> []) (\_ -> vinf b) - } ; - agr = vp.agr ; - neg = vp.neg ; - clit1 = vp.clit1 ; - clit2 = vp.clit2 ; - clit3 = vp.clit3 ; - comp = vp.comp ; - ext = vp.ext - } ; predV : Verb -> VP = \verb -> let @@ -184,10 +120,9 @@ oper ext = vp.ext ; } ; -----e insertRefl : VP -> VP = \vp -> { s = {s = vp.s.s ; vtyp = vRefl} ; - agr = vp.agr ; + agr = VPAgrSubj ; clit1 = vp.clit1 ; clit2 = vp.clit2 ; clit3 = vp.clit3 ; @@ -259,13 +194,19 @@ oper s = \\d,te,a,b,m => let neg = vp.neg ! b ; - clit = vp.clit1 ++ vp.clit2 ++ vp.clit3 ; compl = vp.comp ! agr ++ vp.ext ! b ; gen = agr.g ; num = agr.n ; per = agr.p ; + vtyp = vp.s.vtyp ; + refl = case vtyp of { + VRefl => reflPron num per Acc ; ---- case ? + _ => [] + } ; + clit = refl ++ vp.clit1 ++ vp.clit2 ++ vp.clit3 ; ---- refl first? + verb = vp.s.s ; vaux = auxVerb vp.s.vtyp ; @@ -297,19 +238,17 @@ oper ++ compl } ; - --- in French, pronouns should --- have a "-" with possibly a special verb form with "t": --- "comment fera-t-il" vs. "comment fera Pierre" - infVP : VP -> Agr -> Str = \vpr,agr -> + infVP : VP -> Agr -> Str = \vp,agr -> let - vp = useVP vpr ; ----e clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; ----e iform = infForm agr.n agr.p vp.clAcc vp.clDat ; clpr = ; ----e iform = False ; ----e - inf = (vp.s ! VPInfinit Simul iform).inf ! (aagr agr.g agr.n) ; + inf = vp.s.s ! VInfin False ; ---- ! (aagr agr.g agr.n) ; neg = vp.neg ! Pos ; --- Neg not in API obj = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol in diff --git a/lib/src/romance/SentenceRomance.gf b/lib/src/romance/SentenceRomance.gf index beb393df8..69d68088e 100644 --- a/lib/src/romance/SentenceRomance.gf +++ b/lib/src/romance/SentenceRomance.gf @@ -8,7 +8,7 @@ incomplete concrete SentenceRomance of Sentence = PredSCVP sc vp = mkClause sc.s False (agrP3 Masc Sg) vp ; - ImpVP vpr = let vp = useVP vpr in { + ImpVP vp = { s = \\p,i,g => case i of { ImpF n b => (mkImperative b P2 vp).s ! p ! (aagr g n) } diff --git a/lib/src/spanish/DiffSpa.gf b/lib/src/spanish/DiffSpa.gf index b1ea05af6..442cd43cb 100644 --- a/lib/src/spanish/DiffSpa.gf +++ b/lib/src/spanish/DiffSpa.gf @@ -100,7 +100,7 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud ----e => (vp.s ! VPInfinit Simul clpr.p3).inf ! aag ; ----e _ => (vp.s ! VPImperat).fin ! agr ----e } ; - verb = (vp.s ! VPImperat).fin ! agr ; ----e + verb = vp.s.s ! vImperForm agr ; neg = vp.neg ! pol ; compl = neg.p2 ++ clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol in diff --git a/lib/src/spanish/IdiomSpa.gf b/lib/src/spanish/IdiomSpa.gf index d870f79fa..b2b12c1a9 100644 --- a/lib/src/spanish/IdiomSpa.gf +++ b/lib/src/spanish/IdiomSpa.gf @@ -27,18 +27,18 @@ concrete IdiomSpa of Idiom = CatSpa ** (mkClause [] True (agrP3 Masc Sg) (predV (verboV (hay_3 "haber")))).s ! DDir ! t ! a ! p ! Indic } ; - ProgrVP vpr = let vp = useVP vpr in + ProgrVP vp = insertComplement (\\agr => let clpr = ; ----e pronArg agr.n agr.p vp.clAcc vp.clDat ; obj = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! Pos ---- pol in - (vp.s ! VPGerund).inf ! (aagr agr.g agr.n) ++ clpr.p1 ++ obj + vp.s.s ! VGer ++ clpr.p1 ++ obj ) (predV (verboV (estar_2 "estar"))) ; - ImpPl1 vpr = let vp = useVP vpr in {s = + ImpPl1 vp = {s = (mkImperative False P1 vp).s ! Pos ! {n = Pl ; g = Masc} --- fem } ;