diff --git a/lib/resource-1.0/abstract/Cat.gf b/lib/resource-1.0/abstract/Cat.gf index 954eeb697..7acc7b58a 100644 --- a/lib/resource-1.0/abstract/Cat.gf +++ b/lib/resource-1.0/abstract/Cat.gf @@ -1,18 +1,15 @@ --1 The category system -abstract Cat = Tense ** { +abstract Cat = Common ** { cat --2 Top-level units --- Constructed in [Text Text.html]. +-- Constructed in [Text Text.html]: $Text$. - Text ; -- text consisting of several phrases +-- Constructed in [Phrase Phrase.html]: $Phr$ and --- Constructed in [Phrase Phrase.html]. - - Phr ; -- phrase in a text e.g. "But be quiet my darling." Utt ; -- sentence, question, word... e.g. "be quiet" Voc ; -- vocative or "please" e.g. "my darling" diff --git a/lib/resource-1.0/abstract/Common.gf b/lib/resource-1.0/abstract/Common.gf new file mode 100644 index 000000000..cdc2d1f01 --- /dev/null +++ b/lib/resource-1.0/abstract/Common.gf @@ -0,0 +1,26 @@ +--1 Infrastructure with common implementations. + +-- This module defines the abstract parameters of tense, polarity, and +-- anteriority, which are used in [Phrase Phrase.html] to generate different +-- forms of sentences. Together they give 2 x 4 x 4 = 16 sentence forms. + +-- These tenses are defined for all languages in the library. More tenses +-- can be defined in the language extensions, e.g. the "passé simple" of +-- Romance languages. + +abstract Common = { + + cat + Text ; -- text consisting of several phrases + Phr ; -- phrase in a text e.g. "But be quiet my darling." + + Pol ; + Tense ; + Ant ; + + fun + PPos, PNeg : Pol ; -- I sleep/don't sleep + TPres, TPast, TFut, TCond : Tense ; -- I sleep/slept/will sleep/would sleep + ASimul, AAnter : Ant ; -- I sleep/have slept + +} diff --git a/lib/resource-1.0/abstract/Idiom.gf b/lib/resource-1.0/abstract/Idiom.gf index 356b149e0..dcce3f6b7 100644 --- a/lib/resource-1.0/abstract/Idiom.gf +++ b/lib/resource-1.0/abstract/Idiom.gf @@ -6,8 +6,10 @@ abstract Idiom = Cat ** { -- often different even in closely related languages. fun - ExistNP : NP -> Cl ; -- there is a house - ImpersVP : VP -> Cl ; -- it rains - ProgrVP : VP -> VP ; -- sleeping + ExistNP : NP -> Cl ; -- there is a house + ImpersCl : VP -> Cl ; -- it rains + GenericCl : VP -> Cl ; -- one sleeps + + ProgrVP : VP -> VP ; -- sleeping } diff --git a/lib/resource-1.0/common/CommonX.gf b/lib/resource-1.0/common/CommonX.gf new file mode 100644 index 000000000..396116712 --- /dev/null +++ b/lib/resource-1.0/common/CommonX.gf @@ -0,0 +1,20 @@ +concrete CommonX of Common = open (R = ParamX) in { + + lincat + Text, Phr = {s : Str} ; + + Tense = {s : Str ; t : R.Tense} ; + Ant = {s : Str ; a : R.Anteriority} ; + Pol = {s : Str ; p : R.Polarity} ; + + lin + PPos = {s = []} ** {p = R.Pos} ; + PNeg = {s = []} ** {p = R.Neg} ; + TPres = {s = []} ** {t = R.Pres} ; + TPast = {s = []} ** {t = R.Past} ; + TFut = {s = []} ** {t = R.Fut} ; + TCond = {s = []} ** {t = R.Cond} ; + ASimul = {s = []} ** {a = R.Simul} ; + AAnter = {s = []} ** {a = R.Anter} ; + +} diff --git a/lib/resource-1.0/english/CatEng.gf b/lib/resource-1.0/english/CatEng.gf index c505ddbed..e67d0cea5 100644 --- a/lib/resource-1.0/english/CatEng.gf +++ b/lib/resource-1.0/english/CatEng.gf @@ -1,4 +1,4 @@ -concrete CatEng of Cat = TenseX ** open ResEng, Prelude in { +concrete CatEng of Cat = CommonX ** open ResEng, Prelude in { flags optimize=all_subs ; @@ -6,7 +6,7 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in { -- Phrase - Text, Phr, Utt, Voc = {s : Str} ; + Utt, Voc = {s : Str} ; -- Tensed/Untensed @@ -35,9 +35,10 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in { -- Verb VP = { - s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ; - ad : Str ; - s2 : Agr => Str + s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ; + prp : Str ; -- present participle + ad : Str ; + s2 : Agr => Str } ; Comp = {s : Agr => Str} ; SC = {s : Str} ; diff --git a/lib/resource-1.0/english/IdiomEng.gf b/lib/resource-1.0/english/IdiomEng.gf index 82b61f123..516d7cd1f 100644 --- a/lib/resource-1.0/english/IdiomEng.gf +++ b/lib/resource-1.0/english/IdiomEng.gf @@ -4,9 +4,11 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in { lin ExistNP np = - mkClause "there" (agrP3 Sg) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ; - ImpersVP vp = mkClause "it" (agrP3 Sg) vp ; --- ProgrVP : VP -> VP ; -- sleeping + mkClause "there" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ; + ImpersCl vp = mkClause "it" (agrP3 Sg) vp ; + GenericCl vp = mkClause "one" (agrP3 Sg) vp ; + + ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ; } diff --git a/lib/resource-1.0/english/LangEng.gf b/lib/resource-1.0/english/LangEng.gf index de5dd3853..402de1fef 100644 --- a/lib/resource-1.0/english/LangEng.gf +++ b/lib/resource-1.0/english/LangEng.gf @@ -17,6 +17,6 @@ concrete LangEng of Lang = LexiconEng ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/lib/resource-1.0/english/ResEng.gf b/lib/resource-1.0/english/ResEng.gf index 95e7fd9e8..867715712 100644 --- a/lib/resource-1.0/english/ResEng.gf +++ b/lib/resource-1.0/english/ResEng.gf @@ -162,9 +162,10 @@ resource ResEng = ParamX ** open Prelude in { Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ; VP : Type = { - s : VerbForms ; - ad : Str ; - s2 : Agr => Str + s : VerbForms ; + prp : Str ; -- present participle + ad : Str ; + s2 : Agr => Str } ; --- The order gets wrong with AdV, but works around a parser @@ -200,6 +201,7 @@ resource ResEng = ParamX ** open Prelude in { => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; + prp = verb.s ! VPresPart ; ad = [] ; s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) [] } ; @@ -230,12 +232,14 @@ resource ResEng = ParamX ** open Prelude in { => vf "would" ("have" ++ part) ; => vf "wouldn't" ("have" ++ part) } ; + prp = verb.prpart ; ad = [] ; s2 = \\_ => [] } ; insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> { s = vp.s ; + prp = vp.prp ; ad = vp.ad ; s2 = \\a => vp.s2 ! a ++ obj ! a } ; @@ -244,6 +248,7 @@ resource ResEng = ParamX ** open Prelude in { insertAdV : Str -> VP -> VP = \adv,vp -> { s = vp.s ; + prp = vp.prp ; ad = vp.ad ++ adv ; s2 = \\a => vp.s2 ! a } ; @@ -264,7 +269,8 @@ resource ResEng = ParamX ** open Prelude in { Neg => \\_ => verbs ! VVPastNeg } ; inf = verbs ! VVF VInf ; - ppart = verbs ! VVF VPPart + ppart = verbs ! VVF VPPart ; + prpart = verbs ! VVF VPresPart ; } ; _ => predV {s = \\vf => verbs ! VVF vf ; isRefl = False} } ; @@ -287,7 +293,7 @@ resource ResEng = ParamX ** open Prelude in { does = agrVerb "does" "do" ; doesnt = agrVerb "doesn't" "don't" ; - Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ; + Aux = {pres,past : Polarity => Agr => Str ; inf,ppart,prpart : Str} ; auxBe : Aux = { pres = \\b,a => case of { @@ -300,7 +306,8 @@ resource ResEng = ParamX ** open Prelude in { _ => (posneg b "were") } ; inf = "be" ; - ppart = "been" + ppart = "been" ; + prpart = "being" } ; posneg : Polarity -> Str -> Str = \p,s -> case p of { diff --git a/lib/resource-1.0/finnish/CatFin.gf b/lib/resource-1.0/finnish/CatFin.gf index 5df744765..a72ed6dbb 100644 --- a/lib/resource-1.0/finnish/CatFin.gf +++ b/lib/resource-1.0/finnish/CatFin.gf @@ -1,4 +1,4 @@ -concrete CatFin of Cat = TenseX ** open ResFin, Prelude in { +concrete CatFin of Cat = CommonX ** open ResFin, Prelude in { flags optimize=all_subs ; @@ -6,7 +6,7 @@ concrete CatFin of Cat = TenseX ** open ResFin, Prelude in { -- Phrase - Text, Phr, Utt, Voc = {s : Str} ; + Utt, Voc = {s : Str} ; -- Tensed/Untensed diff --git a/lib/resource-1.0/finnish/IdiomFin.gf b/lib/resource-1.0/finnish/IdiomFin.gf new file mode 100644 index 000000000..b6d77aa25 --- /dev/null +++ b/lib/resource-1.0/finnish/IdiomFin.gf @@ -0,0 +1,7 @@ +concrete IdiomFin of Idiom = CatFin ** + open MorphoFin, ParadigmsFin, Prelude in { + + flags optimize=all_subs ; + +} + diff --git a/lib/resource-1.0/finnish/LangFin.gf b/lib/resource-1.0/finnish/LangFin.gf index 1df23e389..9f51710ce 100644 --- a/lib/resource-1.0/finnish/LangFin.gf +++ b/lib/resource-1.0/finnish/LangFin.gf @@ -11,10 +11,12 @@ concrete LangFin of Lang = RelativeFin, ConjunctionFin, PhraseFin, + TextX, + IdiomFin, StructuralFin, LexiconFin ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = finnish ; } ; diff --git a/lib/resource-1.0/finnish/VerbFin.gf b/lib/resource-1.0/finnish/VerbFin.gf index b79b8fdc1..518fccda3 100644 --- a/lib/resource-1.0/finnish/VerbFin.gf +++ b/lib/resource-1.0/finnish/VerbFin.gf @@ -35,7 +35,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in { ComplV2A v np ap = insertObj (\\fin,b,_ => appCompl fin b v.c2 np ++ - ap.s ! False ! AN (NCase np.a.n (npform2case v.c2.c))) --agr to obj + ap.s ! False ! AN (NCase np.a.n (npform2case v.c3.c))) --agr to obj (predV v) ; UseComp comp = diff --git a/lib/resource-1.0/french/DiffFre.gf b/lib/resource-1.0/french/DiffFre.gf index 0fccab591..b90c7c0f9 100644 --- a/lib/resource-1.0/french/DiffFre.gf +++ b/lib/resource-1.0/french/DiffFre.gf @@ -82,6 +82,22 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in { _ => } ; + mkImperative vp = { + s = \\pol,aag => + let + agr = aag ** {p = P2} ; + verb = (vp.s ! VPImperat).fin ! agr ; + neg = vp.neg ! pol ; + clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; + compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol + in + case pol of { + Pos => verb ++ clpr.p1 ++ compl ; ---- clitics can be different + Neg => neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ compl + } + } ; + + negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; Neg => diff --git a/lib/resource-1.0/french/IdiomFre.gf b/lib/resource-1.0/french/IdiomFre.gf new file mode 100644 index 000000000..ddab140dd --- /dev/null +++ b/lib/resource-1.0/french/IdiomFre.gf @@ -0,0 +1,20 @@ +concrete IdiomFre of Idiom = CatFre ** + open PhonoFre, MorphoFre, ParadigmsFre, Prelude in { + + flags optimize=all_subs ; + + lin + ExistNP np = + mkClause "il" (agrP3 Masc Sg) + (insertClit2 "y" (insertComplement (\\_ => np.s ! Ton Acc) (predV avoir_V))) ; + ImpersCl vp = mkClause "il" (agrP3 Masc Sg) vp ; + GenericCl vp = mkClause "on" (agrP3 Masc Sg) vp ; + + ProgrVP vp = + insertComplement + (\\a => "en" ++ "train" ++ elisDe ++ infVP vp a) + (predV copula) ; + +} + + diff --git a/lib/resource-1.0/french/LangFre.gf b/lib/resource-1.0/french/LangFre.gf index c1a57d54f..50533cd29 100644 --- a/lib/resource-1.0/french/LangFre.gf +++ b/lib/resource-1.0/french/LangFre.gf @@ -11,10 +11,12 @@ concrete LangFre of Lang = RelativeFre, ConjunctionFre, PhraseFre, + TextX, + IdiomFre, StructuralFre, LexiconFre ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/lib/resource-1.0/german/CatGer.gf b/lib/resource-1.0/german/CatGer.gf index 4ce1c587a..6040240d4 100644 --- a/lib/resource-1.0/german/CatGer.gf +++ b/lib/resource-1.0/german/CatGer.gf @@ -1,4 +1,4 @@ -concrete CatGer of Cat = TenseX ** open ResGer, Prelude in { +concrete CatGer of Cat = CommonX ** open ResGer, Prelude in { flags optimize=all_subs ; @@ -6,7 +6,7 @@ concrete CatGer of Cat = TenseX ** open ResGer, Prelude in { -- Phrase - Text, Phr, Utt, Voc = {s : Str} ; + Utt, Voc = {s : Str} ; -- Tensed/Untensed diff --git a/lib/resource-1.0/german/IdiomGer.gf b/lib/resource-1.0/german/IdiomGer.gf new file mode 100644 index 000000000..fae8cbb59 --- /dev/null +++ b/lib/resource-1.0/german/IdiomGer.gf @@ -0,0 +1,7 @@ +concrete IdiomGer of Idiom = CatGer ** + open MorphoGer, ParadigmsGer, Prelude in { + + flags optimize=all_subs ; + +} + diff --git a/lib/resource-1.0/german/LangGer.gf b/lib/resource-1.0/german/LangGer.gf index e1632f878..eb0bb9541 100644 --- a/lib/resource-1.0/german/LangGer.gf +++ b/lib/resource-1.0/german/LangGer.gf @@ -11,10 +11,12 @@ concrete LangGer of Lang = RelativeGer, ConjunctionGer, PhraseGer, + TextX, + IdiomGer, StructuralGer, LexiconGer ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/lib/resource-1.0/german/StructuralGer.gf b/lib/resource-1.0/german/StructuralGer.gf index ea5158668..07227e367 100644 --- a/lib/resource-1.0/german/StructuralGer.gf +++ b/lib/resource-1.0/german/StructuralGer.gf @@ -63,7 +63,7 @@ concrete StructuralGer of Structural = CatGer ** a = Strong } ; only_Predet = {s = \\_,_,_ => "nur"} ; - no_Phr = ss ["Nein ."] ; + no_Phr = ss "nein" ; on_Prep = mkPrep "auf" Dat ; or_Conj = ss "oder" ** {n = Sg} ; otherwise_PConj = ss "sonst" ; @@ -123,6 +123,6 @@ concrete StructuralGer of Structural = CatGer ** youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ; youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Pl P2 ; ---- poss youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ; - yes_Phr = ss ["Ja ."] ; + yes_Phr = ss "ja" ; } diff --git a/lib/resource-1.0/italian/DiffIta.gf b/lib/resource-1.0/italian/DiffIta.gf index acff1205c..9f728b782 100644 --- a/lib/resource-1.0/italian/DiffIta.gf +++ b/lib/resource-1.0/italian/DiffIta.gf @@ -100,6 +100,20 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud in ; + mkImperative vp = { + s = \\pol,aag => + let + agr = aag ** {p = P2} ; + verb = case of { + => (vp.s ! VPInfinit Simul).inf ! aag ; + _ => (vp.s ! VPImperat).fin ! agr + } ; + neg = vp.neg ! pol ; + clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; + compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol + in + neg.p1 ++ verb ++ clpr.p1 ++ compl ; + } ; negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; diff --git a/lib/resource-1.0/italian/IdiomIta.gf b/lib/resource-1.0/italian/IdiomIta.gf new file mode 100644 index 000000000..0ad2bc9b0 --- /dev/null +++ b/lib/resource-1.0/italian/IdiomIta.gf @@ -0,0 +1,7 @@ +concrete IdiomIta of Idiom = CatIta ** + open MorphoIta, ParadigmsIta, Prelude in { + + flags optimize=all_subs ; + +} + diff --git a/lib/resource-1.0/italian/LangIta.gf b/lib/resource-1.0/italian/LangIta.gf index c05807f3b..b08d64184 100644 --- a/lib/resource-1.0/italian/LangIta.gf +++ b/lib/resource-1.0/italian/LangIta.gf @@ -11,10 +11,12 @@ concrete LangIta of Lang = RelativeIta, ConjunctionIta, PhraseIta, + TextX, + IdiomIta, StructuralIta, LexiconIta ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/lib/resource-1.0/italian/LexiconIta.gf b/lib/resource-1.0/italian/LexiconIta.gf index f1f7ab9a5..ab92c51bb 100644 --- a/lib/resource-1.0/italian/LexiconIta.gf +++ b/lib/resource-1.0/italian/LexiconIta.gf @@ -23,7 +23,7 @@ lin bike_N = regN "bicicletta" ; bird_N = regN "uccello" ; black_A = regADeg "nero" ; - blue_A = regADeg "blù" ; + blue_A = mkA "blù" "blù" "blù" "blù" "blumente" ; boat_N = regN "batello" ; book_N = regN "libro" ; boot_N = regN "stivale" ; diff --git a/lib/resource-1.0/lang.gfprob b/lib/resource-1.0/lang.gfprob index 41bc440ed..28dcd8432 100644 --- a/lib/resource-1.0/lang.gfprob +++ b/lib/resource-1.0/lang.gfprob @@ -12,3 +12,6 @@ --# prob ComplV2A 0.01 --# prob ComplA2 0.1 --# prob UsePN 0.01 +--# prob yes_Phr 0.02 +--# prob no_Phr 0.02 +--# prob TEmpty 0.1 diff --git a/lib/resource-1.0/norwegian/IdiomNor.gf b/lib/resource-1.0/norwegian/IdiomNor.gf new file mode 100644 index 000000000..bb48fb3e2 --- /dev/null +++ b/lib/resource-1.0/norwegian/IdiomNor.gf @@ -0,0 +1,7 @@ +concrete IdiomNor of Idiom = CatNor ** + open MorphoNor, ParadigmsNor, Prelude in { + + flags optimize=all_subs ; + +} + diff --git a/lib/resource-1.0/norwegian/LangNor.gf b/lib/resource-1.0/norwegian/LangNor.gf index 46f90e0ba..d9699c2d7 100644 --- a/lib/resource-1.0/norwegian/LangNor.gf +++ b/lib/resource-1.0/norwegian/LangNor.gf @@ -11,10 +11,12 @@ concrete LangNor of Lang = RelativeNor, ConjunctionNor, PhraseNor, + TextX, + IdiomNor, StructuralNor, LexiconNor ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/lib/resource-1.0/romance/CatRomance.gf b/lib/resource-1.0/romance/CatRomance.gf index e90f33469..f7d2c75f6 100644 --- a/lib/resource-1.0/romance/CatRomance.gf +++ b/lib/resource-1.0/romance/CatRomance.gf @@ -1,5 +1,5 @@ incomplete concrete CatRomance of Cat = - TenseX ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in { + CommonX ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in { flags optimize=all_subs ; @@ -7,7 +7,7 @@ incomplete concrete CatRomance of Cat = -- Phrase - Text, Phr, Utt, Voc = {s : Str} ; + Utt, Voc = {s : Str} ; -- Tensed/Untensed diff --git a/lib/resource-1.0/romance/DiffRomance.gf b/lib/resource-1.0/romance/DiffRomance.gf index 42b449c93..9c2b020d0 100644 --- a/lib/resource-1.0/romance/DiffRomance.gf +++ b/lib/resource-1.0/romance/DiffRomance.gf @@ -47,12 +47,14 @@ interface DiffRomance = open CommonRomance, Prelude in { -- To render pronominal arguments as clitics and/or ordinary complements. - pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ; + oper pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ; + +-- To render imperatives (with their clitics etc). + + oper mkImperative : CommonRomance.VP -> {s : Polarity => AAgr => Str} ; --2 Constants that must derivatively depend on language ----- nominative : Case ; ----- accusative : Case ; dative : Case ; genitive : Case ; diff --git a/lib/resource-1.0/romance/ResRomance.gf b/lib/resource-1.0/romance/ResRomance.gf index a5e724aad..f244bc5f7 100644 --- a/lib/resource-1.0/romance/ResRomance.gf +++ b/lib/resource-1.0/romance/ResRomance.gf @@ -61,6 +61,11 @@ oper habet : TMood -> Agr -> Str = \tm,a -> aux ! VFin tm a.n a.p ; habere : Str = aux ! VInfin ; + vimp : Agr -> Str = \a -> verb.s ! VImper (case a.n of { + Sg => SgP2 ; + Pl => PlP2 + }) ; + vf : (Agr -> Str) -> (AAgr -> Str) -> { fin : Agr => Str ; inf : AAgr => Str @@ -72,9 +77,9 @@ oper in { s = table { - VPFinite t Simul => vf (vfin t) (\_ -> []) ; - VPFinite t Anter => vf (habet t) vpart ; - VPImperat => vf (\_ -> verb.s ! VImper SgP2) (\_ -> []) ; ---- + VPFinite t Simul => vf (vfin t) (\_ -> []) ; + VPFinite t Anter => vf (habet t) vpart ; + VPImperat => vf vimp (\_ -> []) ; VPInfinit Simul => vf (\_ -> []) (\_ -> vinf) ; VPInfinit Anter => vf (\_ -> []) (\a -> habere ++ vpart a) } ; @@ -139,6 +144,17 @@ oper ext = vp.ext ; } ; + insertClit2 : Str -> VP -> VP = \co,vp -> { + s = vp.s ; + agr = vp.agr ; + clAcc = vp.clAcc ; + clDat = vp.clDat ; + clit2 = vp.clit2 ++ co ; ---- y en + neg = vp.neg ; + comp = vp.comp ; + ext = vp.ext ; + } ; + insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> { s = vp.s ; agr = vp.agr ; @@ -168,7 +184,7 @@ oper clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b in - subj ++ neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ inf ++ compl + subj ++ neg.p1 ++ clpr.p1 ++ vp.clit2 ++ verb ++ neg.p2 ++ inf ++ compl } ; infVP : VP -> Agr -> Str = \vp,agr -> @@ -178,7 +194,7 @@ oper clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; obj = clpr.p2 ++ vp.comp ! agr in - clitInf clpr.p1 inf ++ obj ; + clitInf (clpr.p1 ++ vp.clit2) inf ++ obj ; } diff --git a/lib/resource-1.0/romance/SentenceRomance.gf b/lib/resource-1.0/romance/SentenceRomance.gf index 90b5acb56..78d324c6f 100644 --- a/lib/resource-1.0/romance/SentenceRomance.gf +++ b/lib/resource-1.0/romance/SentenceRomance.gf @@ -8,14 +8,7 @@ incomplete concrete SentenceRomance of Sentence = PredSCVP sc vp = mkClause sc.s (agrP3 Masc Sg) vp ; - ImpVP vp = { - s = \\pol,aag => - let - agr = aag ** {p = P2} ; - verb = (vp.s ! VPImperat).fin ! agr - in - verb ++ vp.comp ! agr ++ vp.ext ! pol ---- neg,clit - } ; + ImpVP = mkImperative ; SlashV2 np v2 = mkClause diff --git a/lib/resource-1.0/scandinavian/CatScand.gf b/lib/resource-1.0/scandinavian/CatScand.gf index 678517fd2..58d158ce5 100644 --- a/lib/resource-1.0/scandinavian/CatScand.gf +++ b/lib/resource-1.0/scandinavian/CatScand.gf @@ -1,5 +1,5 @@ incomplete concrete CatScand of Cat = - TenseX ** open ResScand, Prelude, CommonScand, (R = ParamX) in { + CommonX ** open ResScand, Prelude, CommonScand, (R = ParamX) in { flags optimize=all_subs ; @@ -7,7 +7,7 @@ incomplete concrete CatScand of Cat = -- Phrase - Text, Phr, Utt, Voc = {s : Str} ; + Utt, Voc = {s : Str} ; -- Tensed/Untensed diff --git a/lib/resource-1.0/spanish/DiffSpa.gf b/lib/resource-1.0/spanish/DiffSpa.gf index e46470483..203bc951b 100644 --- a/lib/resource-1.0/spanish/DiffSpa.gf +++ b/lib/resource-1.0/spanish/DiffSpa.gf @@ -73,6 +73,21 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud -- => <"te" ++ "me", []> ; -- <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ; + mkImperative vp = { + s = \\pol,aag => + let + agr = aag ** {p = P2} ; + verb = case of { + => (vp.s ! VPFinite (VPres Conjunct) Simul).fin ! agr ; + _ => (vp.s ! VPImperat).fin ! agr + } ; + neg = vp.neg ! pol ; + clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ; + compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol + in + neg.p1 ++ verb ++ clpr.p1 ++ compl ; + } ; + negation : Polarity => (Str * Str) = table { Pos => <[],[]> ; Neg => <"no",[]> diff --git a/lib/resource-1.0/spanish/IdiomSpa.gf b/lib/resource-1.0/spanish/IdiomSpa.gf new file mode 100644 index 000000000..4a052d691 --- /dev/null +++ b/lib/resource-1.0/spanish/IdiomSpa.gf @@ -0,0 +1,7 @@ +concrete IdiomSpa of Idiom = CatSpa ** + open MorphoSpa, ParadigmsSpa, Prelude in { + + flags optimize=all_subs ; + +} + diff --git a/lib/resource-1.0/spanish/LangSpa.gf b/lib/resource-1.0/spanish/LangSpa.gf index ca795db86..951cab43d 100644 --- a/lib/resource-1.0/spanish/LangSpa.gf +++ b/lib/resource-1.0/spanish/LangSpa.gf @@ -11,10 +11,12 @@ concrete LangSpa of Lang = RelativeSpa, ConjunctionSpa, PhraseSpa, + TextSpa, -- special punctuation + IdiomSpa, StructuralSpa, LexiconSpa ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/lib/resource-1.0/spanish/TextSpa.gf b/lib/resource-1.0/spanish/TextSpa.gf new file mode 100644 index 000000000..1f925cb7b --- /dev/null +++ b/lib/resource-1.0/spanish/TextSpa.gf @@ -0,0 +1,11 @@ +concrete TextSpa of Text = { + +-- This works for the special punctuation marks of Spanish. + + lin + TEmpty = {s = []} ; + TFullStop x xs = {s = x.s ++ "." ++ xs.s} ; + TQuestMark x xs = {s = "¿" ++ x.s ++ "?" ++ xs.s} ; + TExclMark x xs = {s = "¡" ++ x.s ++ "!" ++ xs.s} ; + +} diff --git a/lib/resource-1.0/swedish/CatSwe.gf b/lib/resource-1.0/swedish/CatSwe.gf index fe484ff6b..c35924036 100644 --- a/lib/resource-1.0/swedish/CatSwe.gf +++ b/lib/resource-1.0/swedish/CatSwe.gf @@ -1,2 +1,2 @@ -concrete CatSwe of Cat = TenseX ** CatScand with +concrete CatSwe of Cat = CommonX ** CatScand with (ResScand = ResSwe) ; diff --git a/lib/resource-1.0/swedish/LangSwe.gf b/lib/resource-1.0/swedish/LangSwe.gf index 42e1291e5..9ebab4cc1 100644 --- a/lib/resource-1.0/swedish/LangSwe.gf +++ b/lib/resource-1.0/swedish/LangSwe.gf @@ -17,6 +17,6 @@ concrete LangSwe of Lang = LexiconSwe ** { -flags startcat = Phr ; +flags startcat = Phr ; unlexer = text ; lexer = text ; } ; diff --git a/src/GF/Text/Text.hs b/src/GF/Text/Text.hs index 7b7f18469..3e1b9c46d 100644 --- a/src/GF/Text/Text.hs +++ b/src/GF/Text/Text.hs @@ -71,6 +71,7 @@ formatAsTextGen tag para = unwords . format . cap . words where w : c : ww | major c -> format $ (w ++ c) :(cap ww) w : c : ww | minor c -> format $ (w ++ c) : ww p : c : ww | openp p -> format $ (p ++ c) :ww + p : c : ww | spanish p -> format $ (p ++ concat (cap [c])) :ww c : ww | para c -> "\n\n" : format ww w : ww -> w : format ww [] -> [] @@ -81,6 +82,7 @@ formatAsTextGen tag para = unwords . format . cap . words where major = flip elem (map singleton ".!?") minor = flip elem (map singleton ",:;)") openp = all (flip elem "(") + spanish = all (flip elem "¡¿") formatAsCode :: String -> String formatAsCode = rend 0 . words where diff --git a/src/GF/UseGrammar/Treebank.hs b/src/GF/UseGrammar/Treebank.hs index cf1652ae9..12dc598f2 100644 --- a/src/GF/UseGrammar/Treebank.hs +++ b/src/GF/UseGrammar/Treebank.hs @@ -110,6 +110,6 @@ linearize mgr lang = linTree2string noMark (canModules mgr) (zIdent lang) where sgr = stateGrammarOfLangOpt False mgr (zIdent lang) - untok = customOrDefault noOptions useUntokenizer customUntokenizer sgr + untok = customOrDefault (stateOptions sgr) useUntokenizer customUntokenizer sgr showTree t = prt_ $ tree2exp t