From aa4a8580f715da1c2298de8d41c05609f0fc39f4 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 11 Feb 2005 08:11:29 +0000 Subject: [PATCH] more on romance --- lib/resource/french/MorphoFre.gf | 29 ++++++---- lib/resource/french/SyntaxFre.gf | 15 +++++ lib/resource/french/TestResourceFre.gf | 1 + lib/resource/romance/CategoriesRomance.gf | 2 +- lib/resource/romance/SyntaxRomance.gf | 67 +++++++++++++++-------- lib/resource/romance/TypesRomance.gf | 1 - src/GF/Canon/CMacros.hs | 1 + 7 files changed, 80 insertions(+), 36 deletions(-) diff --git a/lib/resource/french/MorphoFre.gf b/lib/resource/french/MorphoFre.gf index 59c85a510..a50c8294f 100644 --- a/lib/resource/french/MorphoFre.gf +++ b/lib/resource/french/MorphoFre.gf @@ -13,6 +13,7 @@ resource MorphoFre = open (Predef=Predef), Prelude, TypesFre in { +flags optimize=all ; --3 Front vowels -- @@ -242,19 +243,23 @@ oper P3 Clit1 ; ---2 Reflexive pronouns --- --- It is simply a function depending on number and person. - - pronRefl : Number -> Person -> Str = \n,p -> case of { - => elision "m" ; - => elision "t" ; - <_, P3> => elision "s" ; - => "nous" ; - => "vous" - } ; - + 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 + } + } ; +-- Reflexive pronouns are defined in $SyntaxFre$. -- The composable pronoun "lequel" is inflected by varying the definite -- article and the determiner "quel" in the expected way. diff --git a/lib/resource/french/SyntaxFre.gf b/lib/resource/french/SyntaxFre.gf index f1e4d92c2..9684c5c6c 100644 --- a/lib/resource/french/SyntaxFre.gf +++ b/lib/resource/french/SyntaxFre.gf @@ -2,6 +2,8 @@ instance SyntaxFre of SyntaxRomance = TypesFre ** open Prelude, (CO=Coordination), MorphoFre in { +flags optimize=parametrize ; + oper nameNounPhrase = \jean -> normalNounPhrase @@ -53,6 +55,19 @@ oper } ++ duvin.s ! stressed accusative --- il y en a ; have to define "y" } ; + + reflPron : Number => Person => NPFormA => Str = \\n,p => + case p of { + P3 => table { + Ton x => prepCase x ++ "soi" ; + Aton _ => elision "s" ; + Poss Sg Masc => "son" ; + Poss Sg Fem => "sa" ; + Poss Pl _ => "ses" + } ; + _ => (personPron Masc n p).s + } ; + mkAdjReg : Str -> Bool -> Adjective = \adj,p -> mkAdjective (adjGrand adj) p ; diff --git a/lib/resource/french/TestResourceFre.gf b/lib/resource/french/TestResourceFre.gf index 7738f0619..fb604c550 100644 --- a/lib/resource/french/TestResourceFre.gf +++ b/lib/resource/french/TestResourceFre.gf @@ -8,6 +8,7 @@ concrete TestResourceFre of TestResource = open Prelude, TypesFre, MorphoFre, SyntaxFre in { flags startcat=Phr ; lexer=text ; parser=chart ; unlexer=text ; +optimize=all ; lin Big = mkAdjDegrReg "grand" adjPre ; diff --git a/lib/resource/romance/CategoriesRomance.gf b/lib/resource/romance/CategoriesRomance.gf index 341c05484..a1ba543ea 100644 --- a/lib/resource/romance/CategoriesRomance.gf +++ b/lib/resource/romance/CategoriesRomance.gf @@ -55,7 +55,7 @@ lincat V = Verb ; -- = {s : VF => Str} ; VP = {s : Bool => Gender => VPForm => Str} ; - VPI = {s : Gender => Number => Person => Str} ; + VPI = {s : VIForm => Gender => Number => Person => Str} ; V2 = TransVerb ; -- = Verb ** {s2 : Preposition ; c : CaseA} ; V3 = TransVerb ** {s3 : Preposition ; c3 : CaseA} ; diff --git a/lib/resource/romance/SyntaxRomance.gf b/lib/resource/romance/SyntaxRomance.gf index 286d647dc..0a45c8e81 100644 --- a/lib/resource/romance/SyntaxRomance.gf +++ b/lib/resource/romance/SyntaxRomance.gf @@ -390,9 +390,10 @@ oper param VPForm = VPF Anteriority VF ; Anteriority = Simul | Anter ; + VIForm = VIInfinit | VIImperat Bool Number ; oper - VerbPhrase = {s : Gender => VPForm => Str} ; + VerbPhrase = {s : VIForm => Gender => Number => Person => Str} ; VerbGroup = {s : Bool => Gender => VPForm => Str} ; vpf2vf : VPForm -> VF = \vpf -> case vpf of { @@ -542,6 +543,24 @@ oper False => {clit = [] ; part = aimee ; compl = Jean} } ; +----- add auxVerb to Complemnt to switch to $esse$ in refl ? + + reflTransVerb : TransVerb -> Complemnt = \aime -> + let + clit = isTransVerbClit aime ; + in + \\g,n,p => + let + soi = reflPron ! n ! p ! (case2pformClit aime.c) ; + aimee = aime.s ! VPart g n + in + case clit of { + True => {clit = soi ; part = aimee ; compl = []} ; + False => {clit = [] ; part = aimee ; compl = soi} + } ; + + reflPron : Number => Person => NPFormA => Str ; + mkTransVerb : Verb -> Preposition -> CaseA -> TransVerb = \v,p,c -> v ** {s2 = p ; c = c} ; @@ -614,10 +633,10 @@ oper -- as well as the position: "est toujours heureux" / "est heureux à Paris".) Adverb : Type = SS ; - +{- adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \chante, bien -> {s = \\g,v => chante.s ! g ! v ++ bien.s} ; - +-} -- Adverbs are typically generated by prefixing prepositions. -- The rule for prepositional phrases also comprises the use of prepositions -- treated as cases. Therefore, both a preposition and a case are needed @@ -742,12 +761,14 @@ oper SentenceVerb : Type = Verb ** {mp, mn : Mode} ; -{- ----- - complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \croire,jeanboit -> - {s = \\b,g,w => - let {m = if_then_else Mode b croire.mp croire.mn} - in (predVerb croire).s ! b ! g ! w ++ (embedConj ++ jeanboit.s ! m)} ; ----w --} + complSentVerb : SentenceVerb -> Sentence -> Complemnt = \croire,jeanboit -> + mkCompl + croire + (\\g,n,p => + ----- add Bool to Complemnt ? + ----- let m = if_then_else Mode b croire.mp croire.mn + embedConj ++ jeanboit.s ! croire.mp) ; + verbSent : Verb -> Mode -> Mode -> SentenceVerb = \v,mp,mn -> v ** {mp = mp ; mn = mn} ; @@ -762,12 +783,12 @@ oper -- They can need an oblique case ("à", "de"), but they work like ordinary verbs. VerbVerb : Type = Verb ** {c : CaseA} ; -{- ---- - complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \devoir, nager -> - {s = \\b,g,v => formVerb devoir b g v ++ - prepCase devoir.c ++ nager.s ! True ! g ! VPF Simul VInfin ---- anter - } ; --} + + complVerbVerb : VerbVerb -> VerbPhrase -> Complemnt = \devoir, nager -> + mkCompl + devoir + (\\g,n,p => prepCase devoir.c ++ nager.s ! VIInfinit ! g ! n ! p) ; + mkVerbVerbDir : Verb -> VerbVerb = \v -> v ** {c = accusative} ; @@ -827,12 +848,12 @@ oper -- Relative clauses can be formed from both verb phrases ("qui dort") and -- slash expressions ("que je vois", "dont je parle"). - +{- ----- relVerbPhrase : RelPron -> VerbPhrase -> RelClause = \qui,dort -> {s = \\m,g,n => allRelForms qui g n nominative ++ dort.s ! g ! VPF Simul (VFin (VPres m) n P3) } ; - +-} relSlash : RelPron -> SentenceSlashNounPhrase -> RelClause = \dont,jeparle -> {s = \\m,g,n => jeparle.s2 ++ allRelForms dont g n jeparle.c ++ jeparle.s ! m } ; @@ -929,7 +950,7 @@ oper -- The leading "est-ce que" is recognized as a variant, and requires -- direct word order. - questVerbPhrase : NounPhrase -> VerbPhrase -> Question ; +----- questVerbPhrase : NounPhrase -> VerbPhrase -> Question ; -- The existence question is treated separately. @@ -942,7 +963,7 @@ oper -- -- N.B. inversion variants and "est-ce que" are treated as above. - intVerbPhrase : IntPron -> VerbPhrase -> Question ; +----- intVerbPhrase : IntPron -> VerbPhrase -> Question ; intSlash : IntPron -> SentenceSlashNounPhrase -> Question ; @@ -959,7 +980,7 @@ oper IntAdverb = SS ; - questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question ; +----- questAdverbial : IntAdverb -> NounPhrase -> VerbPhrase -> Question ; --2 Imperatives @@ -974,10 +995,11 @@ oper Imperative = {s : Gender => Number => Str} ; +{- ----- imperVerbPhrase : VerbPhrase -> Imperative = \dormir -> {s = \\g,n => dormir.s ! g ! VPF Simul (vImper n P2) } ; - +-} imperUtterance : Number -> Imperative -> Utterance = \n,I -> ss (I.s ! Masc ! n ++ "!") ; @@ -1152,10 +1174,11 @@ oper B ++ si.s ++ As } ; +{- ----- subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase = \V, si, A -> adVerbPhrase V (ss (si.s ++ A.s ! si.m)) ; - +-} --2 One-word utterances -- diff --git a/lib/resource/romance/TypesRomance.gf b/lib/resource/romance/TypesRomance.gf index 7cdddde5c..5fe513687 100644 --- a/lib/resource/romance/TypesRomance.gf +++ b/lib/resource/romance/TypesRomance.gf @@ -65,7 +65,6 @@ oper prepCase : CaseA -> Str ; - adjCompLong : Adj -> AdjComp ; relPronForms : CaseA => Str ; diff --git a/src/GF/Canon/CMacros.hs b/src/GF/Canon/CMacros.hs index 667fc0e16..9ec753749 100644 --- a/src/GF/Canon/CMacros.hs +++ b/src/GF/Canon/CMacros.hs @@ -129,6 +129,7 @@ term2patt trm = case trm of return (PR (map (uncurry PAss) (zip ll aa'))) LI x -> return $ PV x EInt i -> return $ PI i + FV (t:_) -> term2patt t ---- _ -> prtBad "no pattern corresponds to term" trm patt2term :: Patt -> Term