From 87ff64e0fc60706d8968a13076d761b4f80f4e4a Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 14 Feb 2006 20:42:36 +0000 Subject: [PATCH] Romance clitics almost OK ; bug fix in tb -c --- lib/resource-1.0/french/DiffFre.gf | 9 ++ lib/resource-1.0/french/MorphoFre.gf | 121 +----------------- lib/resource-1.0/french/ParadigmsFre.gf | 7 +- lib/resource-1.0/french/StructuralFre.gf | 16 +-- lib/resource-1.0/italian/DiffIta.gf | 10 ++ lib/resource-1.0/italian/MorphoIta.gf | 11 +- lib/resource-1.0/italian/ParadigmsIta.gf | 2 +- lib/resource-1.0/italian/StructuralIta.gf | 36 +++--- lib/resource-1.0/romance/CatRomance.gf | 2 +- lib/resource-1.0/romance/CommonRomance.gf | 18 --- .../romance/ConjunctionRomance.gf | 4 +- lib/resource-1.0/romance/DiffRomance.gf | 23 +++- lib/resource-1.0/romance/NounRomance.gf | 4 +- lib/resource-1.0/romance/ResRomance.gf | 65 ++++++---- lib/resource-1.0/spanish/DiffSpa.gf | 21 +++ lib/resource-1.0/spanish/MorphoSpa.gf | 33 +---- lib/resource-1.0/spanish/ParadigmsSpa.gf | 2 +- lib/resource-1.0/spanish/StructuralSpa.gf | 18 +-- src/GF/UseGrammar/Treebank.hs | 13 +- 19 files changed, 165 insertions(+), 250 deletions(-) diff --git a/lib/resource-1.0/french/DiffFre.gf b/lib/resource-1.0/french/DiffFre.gf index 57576c215..cb50f276d 100644 --- a/lib/resource-1.0/french/DiffFre.gf +++ b/lib/resource-1.0/french/DiffFre.gf @@ -4,6 +4,7 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in { param Prep = P_de | P_a ; + NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr VType = VHabere | VEsse | VRefl ; oper @@ -56,6 +57,14 @@ 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 + } ; + negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; Neg => diff --git a/lib/resource-1.0/french/MorphoFre.gf b/lib/resource-1.0/french/MorphoFre.gf index dea311db5..0b955e52c 100644 --- a/lib/resource-1.0/french/MorphoFre.gf +++ b/lib/resource-1.0/french/MorphoFre.gf @@ -161,8 +161,8 @@ oper -- The use of "en" as atonic genitive is debatable. mkPronoun : (_,_,_,_,_,_,_ : Str) -> - Gender -> Number -> Person -> ClitType -> Pronoun = - \il,le,lui,Lui,son,sa,ses,g,n,p,c -> + Gender -> Number -> Person -> Pronoun = + \il,le,lui,Lui,son,sa,ses,g,n,p -> {s = table { Ton x => prepCase x ++ Lui ; Aton Nom => il ; @@ -174,128 +174,13 @@ oper Poss {n = Pl} => ses } ; a = {g = g ; n = n ; p = p} ; - c = c + hasClit = True } ; elisPoss : Str -> Str = \s -> pre {s + "a" ; s + "on" / voyelle} ; -{- - pronJe = mkPronoun - (elision "j") - (elision "m") - (elision "m") - "moi" - "mon" (elisPoss "m") "mes" - PNoGen -- gender cannot be known from pronoun alone - Sg - P1 - Clit1 ; - pronTu = mkPronoun - "tu" - (elision "t") - (elision "t") - "toi" - "ton" (elisPoss "t") "tes" - PNoGen - Sg - P2 - Clit1 ; - pronIl = mkPronoun - "il" - (elision "l") - "lui" - "lui" - "son" (elisPoss "s") "ses" - (PGen Masc) - Sg - P3 - Clit2 ; - ----- A hack to get the dative form "y". - pronY = mkPronoun - "il" - (elision "l") - "y" - "lui" - "en" "en" "en" - (PGen Masc) - Sg - P3 - Clit2 ; - - pronElle = mkPronoun - "elle" - elisLa - "lui" - "elle" - "son" (elisPoss "s") "ses" - (PGen Fem) - Sg - P3 - Clit2 ; - - pronNous = mkPronoun - "nous" - "nous" - "nous" - "nous" - "notre" "notre" "nos" - PNoGen - Pl - P1 - Clit3 ; - - pronVous = mkPronoun - "vous" - "vous" - "vous" - "vous" - "votre" "votre" "vos" - PNoGen - Pl --- depends! - P2 - Clit3 ; - - pronIls = mkPronoun - "ils" - "les" - "leur" - "eux" - "leur" "leur" "leurs" - (PGen Masc) - Pl - P3 - Clit1 ; - - pronElles = mkPronoun - "elles" - "les" - "leur" - "elles" - "leur" "leur" "leurs" - (PGen Fem) - Pl - P3 - Clit1 ; - - personPron : Gender -> Number -> Person -> Pronoun = \g,n,p -> - case of { - => pronJe ; - => pronTu ; - => case g of { - Masc => pronIl ; - Fem => pronElle - } ; - => pronNous ; - => pronVous ; - => case g of { - Masc => pronIls ; - Fem => pronElles - } - } ; --} --2 Determiners -- -- Determiners, traditionally called indefinite pronouns, are inflected diff --git a/lib/resource-1.0/french/ParadigmsFre.gf b/lib/resource-1.0/french/ParadigmsFre.gf index 052d006bf..5a6a5086b 100644 --- a/lib/resource-1.0/french/ParadigmsFre.gf +++ b/lib/resource-1.0/french/ParadigmsFre.gf @@ -167,10 +167,6 @@ oper compADeg : A -> A ; --- From a given $A$, it is possible to get back to $A$. - - adegA : A -> A ; - -- For prefixed adjectives, the following function is -- provided. @@ -259,7 +255,6 @@ oper mkV2Q : V -> Preposition -> V2Q ; mkAS : A -> AS ; - subjAS : A -> AS ; mkA2S : A -> Preposition -> A2S ; mkAV : A -> Preposition -> AV ; mkA2V : A -> Preposition -> Preposition -> A2V ; @@ -301,7 +296,7 @@ oper mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ; mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ; - mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; c = Clit0} ** {lock_NP = <>} ; + mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ; mkA a b c d = compADeg {s = \\_ => (mkAdj a c b d).s ; isPre = False ; lock_A = <>} ; regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ; diff --git a/lib/resource-1.0/french/StructuralFre.gf b/lib/resource-1.0/french/StructuralFre.gf index 06b9e888a..458d65463 100644 --- a/lib/resource-1.0/french/StructuralFre.gf +++ b/lib/resource-1.0/french/StructuralFre.gf @@ -36,7 +36,7 @@ lin he_Pron = mkPronoun "il" (elision "l") "lui" "lui" "son" (elisPoss "s") "ses" - Masc Sg P3 Clit2 ; + Masc Sg P3 ; here7from_Adv = ss "d'ici" ; here7to_Adv = ss "ici" ; here_Adv = ss "ici" ; @@ -47,12 +47,12 @@ lin i_Pron = mkPronoun (elision "j") (elision "m") (elision "m") "moi" "mon" (elisPoss "m") "mes" - Fem Sg P1 Clit1 ; + Fem Sg P1 ; in_Prep = mkPreposition "dans" ; it_Pron = mkPronoun "il" (elision "l") "lui" "lui" "son" (elisPoss "s") "ses" - Masc Sg P3 Clit2 ; + Masc Sg P3 ; less_CAdv = ss "moins" ; many_Det = {s = \\_,c => prepCase c ++ "plusieurs" ; n = Pl} ; more_CAdv = ss "plus" ; @@ -72,7 +72,7 @@ lin she_Pron = mkPronoun "elle" elisLa "lui" "elle" "son" (elisPoss "s") "ses" - Fem Sg P3 Clit2 ; + Fem Sg P3 ; so_AdA = ss "si" ; somebody_NP = pn2np (mkPN ["quelqu'un"] Masc) ; @@ -94,7 +94,7 @@ lin these_NP = mkNP ["celles-ci"] Fem Pl ; they_Pron = mkPronoun "elles" "les" "leur" "eux" "leur" "leur" "leurs" - Fem Pl P3 Clit1 ; + Fem Pl P3 ; this_Quant = {s = table { Sg => \\g,c => prepCase c ++ genForms "ce" "cette" ! g ; ---- cet ; ci @@ -111,7 +111,7 @@ lin want_VV = mkVV (vouloir_V2 ** {lock_V = <>}) ; we_Pron = mkPronoun "nous" "nous" "nous" "nous" "notre" "notre" "nos" - Fem Pl P1 Clit3 ; + Fem Pl P1 ; whatSg_IP = {s = \\c => prepCase c ++ "quoi" ; a = aagr Fem Sg} ; whatPl_IP = {s = \\c => prepCase c ++ "quoi" ; a = aagr Fem Pl} ; when_IAdv = ss "quand" ; @@ -127,11 +127,11 @@ lin yes_Phr = ss "oui" ; --- si youSg_Pron = mkPronoun "tu" (elision "t") (elision "t") "toi" "ton" (elisPoss "t") "tes" - Fem Sg P2 Clit1 ; + Fem Sg P2 ; youPl_Pron, youPol_Pron = mkPronoun "vous" "vous" "vous" "vous" "votre" "votre" "vos" - Fem Pl P2 Clit3 ; + Fem Pl P2 ; } diff --git a/lib/resource-1.0/italian/DiffIta.gf b/lib/resource-1.0/italian/DiffIta.gf index 2ddf9e603..88c132772 100644 --- a/lib/resource-1.0/italian/DiffIta.gf +++ b/lib/resource-1.0/italian/DiffIta.gf @@ -4,6 +4,7 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud param Prep = P_di | P_a | P_da | P_in | P_su | P_con ; + NPForm = Ton Case | Aton Case | PreClit | Poss {g : Gender ; n : Number} ; --- AAgr VType = VHabere | VEsse | VRefl ; oper @@ -76,6 +77,15 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud vpAgrClit : Agr -> VPAgr = \a -> vpAgrNone ; +--- This assumes that Acc clitics are in place before Dat. + + placeNewClitic = \ci,c,pro,isc,old -> + case of { + => pro.s ! PreClit ++ old ; -- there is an old clitic + {p3 = True} => pro.s ! Aton c ; -- no old but a new + _ => [] -- no clitics + } ; + negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; Neg => <"non",[]> diff --git a/lib/resource-1.0/italian/MorphoIta.gf b/lib/resource-1.0/italian/MorphoIta.gf index f3f0ba6fe..50cf16295 100644 --- a/lib/resource-1.0/italian/MorphoIta.gf +++ b/lib/resource-1.0/italian/MorphoIta.gf @@ -132,9 +132,9 @@ oper -- The use of "ne" as atonic genitive is debatable. -- We follow the rule that the atonic nominative is empty. - mkPronoun : (_,_,_,_,_,_,_,_ : Str) -> - Gender -> Number -> Person -> ClitType -> Pronoun = - \il,le,lui,Lui,son,sa,ses,see,g,n,p,c -> + mkPronoun : (_,_,_,_,_,_,_,_,_ : Str) -> + Gender -> Number -> Person -> Pronoun = + \il,le,lui,glie,Lui,son,sa,ses,see,g,n,p -> {s = table { Ton Nom => il ; Ton x => prepCase x ++ Lui ; @@ -142,14 +142,15 @@ oper Aton Acc => le ; Aton (CPrep P_di) => "ne" ; --- hmm Aton (CPrep P_a) => lui ; - Aton q => prepCase q ++ Lui ; ---- GF bug with c or p! + Aton q => prepCase q ++ Lui ; ---- GF bug with c or p! + PreClit => glie ; Poss {n = Sg ; g = Masc} => son ; Poss {n = Sg ; g = Fem} => sa ; Poss {n = Pl ; g = Masc} => ses ; Poss {n = Pl ; g = Fem} => see } ; a = {g = g ; n = n ; p = p} ; - c = c + hasClit = True } ; --2 Determiners diff --git a/lib/resource-1.0/italian/ParadigmsIta.gf b/lib/resource-1.0/italian/ParadigmsIta.gf index 0386a70de..fb39389fa 100644 --- a/lib/resource-1.0/italian/ParadigmsIta.gf +++ b/lib/resource-1.0/italian/ParadigmsIta.gf @@ -299,7 +299,7 @@ oper mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ; mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ; - mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; c = Clit0} ** {lock_NP = <>} ; + mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ; mkA a b c d e = compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ; diff --git a/lib/resource-1.0/italian/StructuralIta.gf b/lib/resource-1.0/italian/StructuralIta.gf index 35d1eec48..6e5977654 100644 --- a/lib/resource-1.0/italian/StructuralIta.gf +++ b/lib/resource-1.0/italian/StructuralIta.gf @@ -35,8 +35,8 @@ lin from_Prep = complGen ; --- he_Pron = mkPronoun - "lui" "lo" "gli" "lui" "suo" "sua" "suoi" "sue" - Masc Sg P3 Clit2 ; + "lui" "lo" "gli" "glie" "lui" "suo" "sua" "suoi" "sue" + Masc Sg P3 ; here7from_Adv = ss ["da quì"] ; here7to_Adv = ss "quì" ; here_Adv = ss "quì" ; @@ -46,13 +46,13 @@ lin in8front_Prep = mkPreposition "davanti" ; i_Pron = mkPronoun - "io" "mi" "mi" "me" "mio" "mia" "miei" "mie" - Fem Sg P1 Clit1 ; + "io" "mi" "mi" "me" "me" "mio" "mia" "miei" "mie" + Fem Sg P1 ; in_Prep = {s = [] ; c = CPrep P_in} ; it_Pron = mkPronoun - "lui" "lo" "gli" "lui" "suo" "sua" "suoi" "sue" - Masc Sg P3 Clit2 ; + "lui" "lo" "gli" "glie" "lui" "suo" "sua" "suoi" "sue" + Masc Sg P3 ; less_CAdv = ss "meno" ; many_Det = {s = \\g,c => prepCase c ++ genForms "molti" "molte" ! g ; n = Pl} ; more_CAdv = ss "più" ; @@ -71,8 +71,8 @@ lin quite_Adv = ss "assai" ; she_Pron = mkPronoun - "lei" "la" "le" "lei" "suo" "sua" "suoi" "sue" - Fem Sg P3 Clit2 ; + "lei" "la" "le" "glie" "lei" "suo" "sua" "suoi" "sue" + Fem Sg P3 ; so_AdA = ss "così" ; somebody_NP = pn2np (mkPN ["qualcuno"] Masc) ; somePl_Det = {s = \\_,c => prepCase c ++ "qualche" ; n = Pl} ; @@ -92,8 +92,8 @@ lin therefore_PConj = ss "quindi" ; these_NP = mkNP ["queste"] Fem Pl ; they_Pron = mkPronoun - "loro" "loro" "li" "loro" "loro" "loro" "loro" "loro" - Fem Pl P3 Clit1 ; + "loro" "loro" "li" "glie" "loro" "loro" "loro" "loro" "loro" + Fem Pl P3 ; this_Quant = { s = table { Sg => \\g,c => prepCase c ++ genForms "questo" "questa" ! g ; @@ -109,8 +109,8 @@ lin very_AdA = ss "molto" ; want_VV = mkVV (verboV (volere_96 "volere")) ; we_Pron = - mkPronoun "noi" "ci" "ci" "noi" "nostro" "nostra" "nostri" "nostre" - Fem Pl P1 Clit3 ; + mkPronoun "noi" "ci" "ci" "ce" "noi" "nostro" "nostra" "nostri" "nostre" + Fem Pl P1 ; whatSg_IP = {s = \\c => prepCase c ++ ["che cosa"] ; a = aagr Fem Sg} ; whatPl_IP = {s = \\c => prepCase c ++ ["che cose"] ; a = aagr Fem Pl} ; --- when_IAdv = ss "quando" ; @@ -125,16 +125,16 @@ lin with_Prep = {s = [] ; c = CPrep P_con} ; yes_Phr = ss "sì" ; youSg_Pron = mkPronoun - "tu" "ti" "ti" "te" "tuo" "tua" "tuoi" "tue" - Fem Sg P2 Clit1 ; + "tu" "ti" "ti" "te" "te" "tuo" "tua" "tuoi" "tue" + Fem Sg P2 ; youPl_Pron = mkPronoun - "voi" "vi" "vi" "voi" "vostro" "vostra" "vostri" "vostre" - Fem Pl P2 Clit3 ; + "voi" "vi" "vi" "ve" "voi" "vostro" "vostra" "vostri" "vostre" + Fem Pl P2 ; youPol_Pron = mkPronoun - "Lei" "La" "Le" "Lei" "Suo" "Sua" "Suoi" "Sue" - Fem Sg P3 Clit2 ; + "Lei" "La" "Le" "Glie" "Lei" "Suo" "Sua" "Suoi" "Sue" + Fem Sg P3 ; } diff --git a/lib/resource-1.0/romance/CatRomance.gf b/lib/resource-1.0/romance/CatRomance.gf index e90f33469..f46bbf4d5 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 = CommonRomance.VP ; + VP = ResRomance.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 55ae196b8..d2fcf94be 100644 --- a/lib/resource-1.0/romance/CommonRomance.gf +++ b/lib/resource-1.0/romance/CommonRomance.gf @@ -21,11 +21,6 @@ param Mood = Indic | Conjunct ; --- There are different types of clitic pronouns (as for position). --- Examples of each: "Giovanni" ; "io" ; "lui" ; "noi". - - ClitType = Clit0 | Clit1 | Clit2 | Clit3 ; - -- Adjectives are inflected in gender and number, and there is also an -- adverbial form (e.g. "infiniment"), which has different paradigms and -- can even be irregular ("bien"). @@ -160,19 +155,6 @@ oper Adj = {s : AForm => Str} ; - 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 - clit2 : Str ; -- lui - comp : Agr => Str ; -- content(e) ; à ma mère ; hier - ext : Polarity => Str ; -- que je dors / que je dorme - } ; - appVPAgr : VPAgr -> AAgr -> AAgr = \vp,agr -> case vp of { VPAgrSubj => agr ; diff --git a/lib/resource-1.0/romance/ConjunctionRomance.gf b/lib/resource-1.0/romance/ConjunctionRomance.gf index aa562fd7a..8b9494429 100644 --- a/lib/resource-1.0/romance/ConjunctionRomance.gf +++ b/lib/resource-1.0/romance/ConjunctionRomance.gf @@ -13,11 +13,11 @@ incomplete concrete ConjunctionRomance of Conjunction = ConjNP conj ss = conjunctTable NPForm conj ss ** { a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ; - c = Clit0 + hasClit = False } ; DConjNP conj ss = conjunctDistrTable NPForm conj ss ** { a = {g = ss.a.g ; n = conjNumber conj.n ss.a.n ; p = ss.a.p} ; - c = Clit0 + hasClit = False } ; ConjAP conj ss = conjunctTable AForm conj ss ** { diff --git a/lib/resource-1.0/romance/DiffRomance.gf b/lib/resource-1.0/romance/DiffRomance.gf index 6398a04f7..864b6815e 100644 --- a/lib/resource-1.0/romance/DiffRomance.gf +++ b/lib/resource-1.0/romance/DiffRomance.gf @@ -15,6 +15,11 @@ interface DiffRomance = open CommonRomance, Prelude in { param Prep ; +-- Forms of noun phrases. Spanish and Italian have special forms for +-- fronted clitics. + + param NPForm ; + -- Which types of verbs exist, in terms of auxiliaries. -- (Fre, Ita "avoir", "être", and refl; Spa only "haber" and refl). @@ -40,11 +45,24 @@ 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.) + --2 Constants that must derivatively depend on language - dative : Case ; - genitive : Case ; +---- nominative : Case ; +---- accusative : Case ; + dative : Case ; + genitive : Case ; vRefl : VType ; isVRefl : VType -> Bool ; @@ -80,7 +98,6 @@ interface DiffRomance = open CommonRomance, Prelude in { param Case = Nom | Acc | CPrep Prep ; - NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr oper Verb = {s : VF => Str ; vtyp : VType} ; diff --git a/lib/resource-1.0/romance/NounRomance.gf b/lib/resource-1.0/romance/NounRomance.gf index 753e02ef5..5d3d5c1c0 100644 --- a/lib/resource-1.0/romance/NounRomance.gf +++ b/lib/resource-1.0/romance/NounRomance.gf @@ -11,7 +11,7 @@ incomplete concrete NounRomance of Noun = in { s = \\c => det.s ! g ! npform2case c ++ cn.s ! n ; a = agrP3 g n ; - c = Clit0 + hasClit = False } ; UsePN = pn2np ; @@ -22,7 +22,7 @@ incomplete concrete NounRomance of Noun = s = \\c => pred.s ! aagr (np.a.g) (np.a.n) ! npform2case c ++ --- subtype np.s ! case2npform pred.c ; a = np.a ; - c = Clit0 + hasClit = False } ; DetSg quant ord = { diff --git a/lib/resource-1.0/romance/ResRomance.gf b/lib/resource-1.0/romance/ResRomance.gf index 33ca41a9b..fd2bfae22 100644 --- a/lib/resource-1.0/romance/ResRomance.gf +++ b/lib/resource-1.0/romance/ResRomance.gf @@ -11,7 +11,7 @@ oper nominative : Case = Nom ; accusative : Case = Acc ; - Pronoun = {s : NPForm => Str ; a : Agr ; c : ClitType} ; + Pronoun = {s : NPForm => Str ; a : Agr ; hasClit : Bool} ; Compl : Type = {s : Str ; c : Case ; isDir : Bool} ; @@ -22,13 +22,14 @@ oper pn2np : {s : Str ; g : Gender} -> Pronoun = \pn -> { s = \\c => prepCase (npform2case c) ++ pn.s ; a = agrP3 pn.g Sg ; - c = Clit0 + hasClit = False } ; npform2case : NPForm -> Case = \p -> case p of { Ton x => x ; + Poss _ => genitive ; Aton x => x ; - Poss _ => genitive + _ => dative ---- Ita PreClit } ; case2npform : Case -> NPForm = \c -> case c of { @@ -38,6 +39,20 @@ 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 + 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 ; @@ -62,6 +77,11 @@ 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) (\_ -> []) ; @@ -70,34 +90,32 @@ oper VPInfinit Simul => vf (\_ -> []) (\_ -> vinf) ; VPInfinit Anter => vf (\_ -> []) (\a -> habere ++ vpart a) } ; - agr = partAgr typ ; - neg = negation ; - clit1 = \\a => case isVRefl typ of { - True => reflPron ! a.n ! a.p ! Acc ; - _ => [] - } ; - clit2 = [] ; - comp = \\a => [] ; - ext = \\p => [] + agr = partAgr typ ; + neg = negation ; + clit1 = cli.p1 ; + clInfo = cli.p2 ; + clit2 = [] ; + comp = \\a => [] ; + ext = \\p => [] } ; insertObject : Compl -> Pronoun -> VP -> VP = \c,np,vp -> let - cc : Str * Str * VPAgr = case of { + cc : Bool * Str * VPAgr = case of { | - <_,_,Clit0> => <[], c.s ++ np.s ! Ton c.c, vp.agr> ; - <_,Acc,_> => ; - _ => - } ; - high = case np.c of { -- whether the new clitic comes closer to verb - Clit0 | Clit1 => False ; ---- approximation; should look at the old clit too - _ => True + <_,_,False> => ; + <_,Acc,_> => ; + _ => } ; in { s = vp.s ; agr = cc.p3 ; - clit1 = vp.clit1 ; ---- just a reflexive - clit2 = preOrPost high vp.clit2 cc.p1 ; + clit1 = \\a => placeNewClitic vp.clInfo c.c np cc.p1 (vp.clit1 ! a) ; + clInfo = case cc.p1 of { + False => vp.clInfo ; -- no new clitic + _ => + } ; + clit2 = vp.clit2 ; neg = vp.neg ; comp = \\a => vp.comp ! a ++ cc.p2 ; ext = vp.ext ; @@ -107,6 +125,7 @@ oper s = vp.s ; agr = vp.agr ; clit1 = vp.clit1 ; + clInfo = vp.clInfo ; clit2 = vp.clit2 ; neg = vp.neg ; comp = \\a => vp.comp ! a ++ co ! a ; @@ -116,6 +135,7 @@ oper s = vp.s ; agr = vp.agr ; clit1 = vp.clit1 ; + clInfo = vp.clInfo ; clit2 = vp.clit2 ; neg = vp.neg ; comp = \\a => vp.comp ! a ++ co ; @@ -125,6 +145,7 @@ oper s = vp.s ; agr = vp.agr ; clit1 = vp.clit1 ; + clInfo = vp.clInfo ; clit2 = vp.clit2 ; neg = vp.neg ; comp = vp.comp ; diff --git a/lib/resource-1.0/spanish/DiffSpa.gf b/lib/resource-1.0/spanish/DiffSpa.gf index df2e4bd19..180fd89fb 100644 --- a/lib/resource-1.0/spanish/DiffSpa.gf +++ b/lib/resource-1.0/spanish/DiffSpa.gf @@ -4,6 +4,7 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud param Prep = P_de | P_a ; + NPForm = Ton Case | Aton Case | Poss {g : Gender ; n : Number} ; --- AAgr VType = VHabere | VRefl ; oper @@ -51,6 +52,26 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud vpAgrClit : Agr -> VPAgr = \a -> vpAgrNone ; +--- This assumes that Acc clitics are in place before Dat. + + placeNewClitic = \ci,c,pro,isc,old -> + if_then_Str isc ( + case of { + => old ++ pro.s ! Aton c ; -- te me, ---se me + => "se" ++ old ; -- se lo + _ => pro.s ! Aton c ++ old -- indirect first + }) [] ; -- no clitics + +{- + placeNewClitic = \ci,c,pro,isc,old -> + case of { + => old ++ pro.s ! Aton c ; -- te me, ---se me + => "se" ++ old ; -- se lo + {p5 = True} => pro.s ! Aton c ++ old ; -- indirect first + _ => [] -- no clitics + } ; +-} + negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; Neg => <"no",[]> diff --git a/lib/resource-1.0/spanish/MorphoSpa.gf b/lib/resource-1.0/spanish/MorphoSpa.gf index 41f82308f..cb33777c9 100644 --- a/lib/resource-1.0/spanish/MorphoSpa.gf +++ b/lib/resource-1.0/spanish/MorphoSpa.gf @@ -92,8 +92,8 @@ oper -- We follow the rule that the atonic nominative is empty. mkPronoun : (_,_,_,_,_,_,_,_ : Str) -> - Gender -> Number -> Person -> ClitType -> Pronoun = - \il,le,lui,Lui,son,sa,ses,see,g,n,p,c -> + Gender -> Number -> Person -> Pronoun = + \il,le,lui,Lui,son,sa,ses,see,g,n,p -> {s = table { Ton Nom => il ; Ton x => prepCase x ++ Lui ; @@ -107,35 +107,8 @@ oper Poss {n = Pl ; g = Fem} => see } ; a = {g = g ; n = n ; p = p} ; - c = c + hasClit = True } ; -{- - -- used in constructions like "(no) hay ..." - - pronEmpty : Number -> Pronoun = \n -> mkPronoun - [] - [] - [] - [] - [] [] [] [] - (PGen Masc) - n - P3 - Clit2 ; - ---2 Reflexive pronouns --- --- It is simply a function depending on number and person. - - pronRefl : Number -> Person -> Str = \n,p -> case of { - => "me" ; - => "te" ; - <_, P3> => "se" ; - => "nos" ; - => "vos" - } ; - --} --2 Determiners diff --git a/lib/resource-1.0/spanish/ParadigmsSpa.gf b/lib/resource-1.0/spanish/ParadigmsSpa.gf index 5e4beadd6..9ad5dd284 100644 --- a/lib/resource-1.0/spanish/ParadigmsSpa.gf +++ b/lib/resource-1.0/spanish/ParadigmsSpa.gf @@ -302,7 +302,7 @@ oper mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ; mkPN x g = {s = x ; g = g} ** {lock_PN = <>} ; - mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; c = Clit0} ** {lock_NP = <>} ; + mkNP x g n = {s = (pn2np (mkPN x g)).s; a = agrP3 g n ; hasClit = False} ** {lock_NP = <>} ; mkA a b c d e = compADeg {s = \\_ => (mkAdj a b c d e).s ; isPre = False ; lock_A = <>} ; diff --git a/lib/resource-1.0/spanish/StructuralSpa.gf b/lib/resource-1.0/spanish/StructuralSpa.gf index 09175259a..d2bc1d229 100644 --- a/lib/resource-1.0/spanish/StructuralSpa.gf +++ b/lib/resource-1.0/spanish/StructuralSpa.gf @@ -37,7 +37,7 @@ lin mkPronoun "el" "lo" "le" "él" "su" "su" "sus" "sus" - Masc Sg P3 Clit2 ; + Masc Sg P3 ; here_Adv = mkAdv "aquí" ; -- acá here7to_Adv = mkAdv ["para acá"] ; here7from_Adv = mkAdv ["de acá"] ; @@ -50,13 +50,13 @@ lin mkPronoun "yo" "me" "me" "mí" "mi" "mi" "mis" "mis" - Fem Sg P1 Clit1 ; + Fem Sg P1 ; in_Prep = mkPreposition "en" ; it_Pron = mkPronoun "el" "lo" "le" "él" "su" "su" "sus" "sus" - Masc Sg P3 Clit2 ; + Masc Sg P3 ; less_CAdv = ss "meno" ; ---- many_Det = {s = \\g,c => prepCase c ++ genForms "muchos" "muchas" ! g ; n = Pl} ; more_CAdv = ss "mas" ; @@ -77,7 +77,7 @@ lin mkPronoun "ella" "la" "le" "ella" "su" "su" "sus" "sus" - Fem Sg P3 Clit2 ; + Fem Sg P3 ; so_AdA = ss "tanto" ; somebody_NP = pn2np (mkPN ["algún"] Masc) ; somePl_Det = {s = \\g,c => prepCase c ++ genForms "algunos" "algunas" ! g ; n = Pl} ; @@ -99,7 +99,7 @@ lin they_Pron = mkPronoun "ellas" "las" "les" "ellas" "su" "su" "sus" "sus" - Fem Pl P3 Clit1 ; + Fem Pl P3 ; this_Quant = { s = table { Sg => \\g,c => prepCase c ++ genForms "este" "esta" ! g ; @@ -118,7 +118,7 @@ lin mkPronoun "nosotras" "nos" "nos" "nosotras" "nuestro" "nuestra" "nuestros" "nuestras" - Fem Pl P1 Clit3 ; + Fem Pl P1 ; whatSg_IP = {s = \\c => prepCase c ++ ["qué"] ; a = aagr Masc Sg} ; whatPl_IP = {s = \\c => prepCase c ++ ["qué"] ; a = aagr Masc Pl} ; --- when_IAdv = ss "cuando" ; @@ -135,17 +135,17 @@ lin youSg_Pron = mkPronoun "tu" "te" "te" "tí" "tu" "tu" "tus" "tus" - Fem Sg P2 Clit1 ; + Fem Sg P2 ; youPl_Pron = mkPronoun "vosotras" "vos" "vos" "vosotras" "vuestro" "vuestra" "vuestros" "vuestras" - Fem Pl P2 Clit3 ; + Fem Pl P2 ; youPol_Pron = mkPronoun "usted" "la" "le" "usted" "su" "su" "sus" "sus" - Fem Pl P2 Clit3 ; + Fem Pl P2 ; oper etConj : {s : Str ; n : Number} = {s = pre { diff --git a/src/GF/UseGrammar/Treebank.hs b/src/GF/UseGrammar/Treebank.hs index 606d72266..cf1652ae9 100644 --- a/src/GF/UseGrammar/Treebank.hs +++ b/src/GF/UseGrammar/Treebank.hs @@ -49,15 +49,16 @@ mkTreebank opts sh com trees = putInXML opts "treebank" comm (concatMap mkItem t tris = zip trees [1..] testTreebank :: Options -> ShellState -> String -> Res -testTreebank opts sh = putInXML opts "diff" [] . concatMap testOne . getTreebank . lines +testTreebank opts sh = putInXML opts "testtreebank" [] . concatMap testOne . getTreebank . lines where - testOne (e,lang,str) = do + testOne (e,lang,str0) = do let tr = annot gr e - let str0 = linearize sh lang tr - if str == str0 then ret else putInXML opts "diff" [] $ do - putInXML opts "tree" [] (puts $ showTree tr) - putInXML opts "old" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str0 + let str = linearize sh lang tr + if str == str0 then ret else putInXML opts "diff" [] $ concat [ + putInXML opts "tree" [] (puts $ showTree tr), + putInXML opts "old" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str0, putInXML opts "new" (" lang=" ++ show (prt_ (zIdent lang))) $ puts str + ] gr = firstStateGrammar sh -- string vs. IO