From d9b6bdaf1e0433987335b871c4bb41004a2cf040 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 18 Sep 2008 13:29:53 +0000 Subject: [PATCH] latin adjectives and determiners --- lib/next-resource/latin/AdjectiveLat.gf | 15 ++-- lib/next-resource/latin/CatLat.gf | 14 ++-- lib/next-resource/latin/LexiconLat.gf | 4 +- lib/next-resource/latin/NounLat.gf | 31 ++++--- lib/next-resource/latin/ParadigmsLat.gf | 9 ++ lib/next-resource/latin/ResLat.gf | 101 +++++++++++++++++++++-- lib/next-resource/latin/StructuralLat.gf | 4 +- lib/next-resource/latin/VerbLat.gf | 4 +- 8 files changed, 140 insertions(+), 42 deletions(-) diff --git a/lib/next-resource/latin/AdjectiveLat.gf b/lib/next-resource/latin/AdjectiveLat.gf index c5abc2730..9b0f3457d 100644 --- a/lib/next-resource/latin/AdjectiveLat.gf +++ b/lib/next-resource/latin/AdjectiveLat.gf @@ -1,12 +1,11 @@ concrete AdjectiveLat of Adjective = CatLat ** open ResLat, Prelude in { -{- + lin - PositA a = { - s = \\_ => a.s ! AAdj Posit ; - isPre = True - } ; + PositA a = a ; + +{- ComparA a np = { s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ; isPre = False @@ -28,13 +27,13 @@ concrete AdjectiveLat of Adjective = CatLat ** open ResLat, Prelude in { s = \\a => ap.s ! a ++ sc.s ; isPre = False } ; +-} AdAP ada ap = { - s = \\a => ada.s ++ ap.s ! a ; + s = \\g,n,c => ada.s ++ ap.s ! g ! n ! c ; isPre = ap.isPre } ; - UseA2 a = a ; --} +-- UseA2 a = a ; } diff --git a/lib/next-resource/latin/CatLat.gf b/lib/next-resource/latin/CatLat.gf index ff3d42762..eb8868f7a 100644 --- a/lib/next-resource/latin/CatLat.gf +++ b/lib/next-resource/latin/CatLat.gf @@ -40,21 +40,21 @@ concrete CatLat of Cat = CommonX ** open ResLat, Prelude in { -- VP = ResLat.VP ; VPSlash = ResLat.VP ** {c2 : Preposition} ; --- Comp = {s : Agr => Str} ; + Comp = {s : Gender => Number => Case => Str} ; -- ---- Adjective -- --- AP = {s : Agr => Str ; isPre : Bool} ; + AP = Adjective ** {isPre : Bool} ; ---- {s : Agr => Str ; isPre : Bool} ; -- ---- Noun -- --- CN = {s : Number => Case => Str ; g : Gender} ; + CN = {s : Number => Case => Str ; g : Gender} ; NP, Pron = {s : Case => Str ; g : Gender ; n : Number ; p : Person} ; --- Det = {s,sp : Str ; n : Number} ; + Det = Determiner ; -- Predet, Ord = {s : Str} ; --- Num = {s : Str ; n : Number ; hasCard : Bool} ; + Num = {s : Gender => Case => Str ; n : Number} ; -- Card = {s : Str ; n : Number} ; --- Quant = {s,sp : Bool => Number => Str} ; + Quant = Quantifier ; -- ---- Numeral -- @@ -79,7 +79,7 @@ concrete CatLat of Cat = CommonX ** open ResLat, Prelude in { -- VV = {s : VVForm => Str ; isAux : Bool} ; -- V2V = Verb ** {c2 : Str ; isAux : Bool} ; -- - A = Adjective ; + A = Adjective ** {isPre : Bool} ; -- A2 = {s : AForm => Str ; c2 : Str} ; -- N = Noun ; diff --git a/lib/next-resource/latin/LexiconLat.gf b/lib/next-resource/latin/LexiconLat.gf index 0c3e0e411..3e0863e63 100644 --- a/lib/next-resource/latin/LexiconLat.gf +++ b/lib/next-resource/latin/LexiconLat.gf @@ -85,8 +85,8 @@ lin -- garden_N = regN "garden" ; -- girl_N = mkN feminine (regN "girl") ; -- glove_N = regN "glove" ; --- gold_N = regN "gold" ; --- good_A = mkADeg "good" "better" "best" "well" ; + gold_N = mkN "aurum" ; + good_A = mkA "bonus" ; -- go_V = mk5V "go" "goes" "went" "gone" "going" ; -- green_A = regADeg "green" ; -- harbour_N = regN "harbour" ; diff --git a/lib/next-resource/latin/NounLat.gf b/lib/next-resource/latin/NounLat.gf index 0ae8eda4e..896aaee3e 100644 --- a/lib/next-resource/latin/NounLat.gf +++ b/lib/next-resource/latin/NounLat.gf @@ -3,11 +3,11 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude in { flags optimize=all_subs ; lin --- DetCN det cn = { --- s = \\c => det.s ++ cn.s ! det.n ! c ; --- a = agrgP3 det.n cn.g --- } ; --- + DetCN det cn = { + s = \\c => det.s ! cn.g ! c ++ cn.s ! det.n ! c ; + n = det.n ; g = cn.g ; p = P3 + } ; + -- UsePN pn = pn ** {a = agrgP3 Sg pn.g} ; UsePron p = p ; @@ -37,12 +37,12 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude in { -- n = num.n -- } ; -- --- DetQuant quant num = { --- s = quant.s ! num.hasCard ! num.n ++ num.s ; --- sp = quant.sp ! num.hasCard ! num.n ++ num.s ; --- n = num.n --- } ; --- + DetQuant quant num = { + s = \\g,c => quant.s ! num.n ! g ! c ++ num.s ! g ! c ; + sp = \\g,c => quant.sp ! num.n ! g ! c ++ num.s ! g ! c ; + n = num.n + } ; + -- DetNP det = { -- s = \\c => det.sp ; ---- case -- a = agrP3 det.n @@ -53,10 +53,9 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude in { -- sp = \\_,_ => p.sp -- } ; -- --- NumSg = {s = []; n = Sg ; hasCard = False} ; --- NumPl = {s = []; n = Pl ; hasCard = False} ; ------b NoOrd = {s = []} ; --- + NumSg = {s = \\_,_ => [] ; n = Sg} ; + NumPl = {s = \\_,_ => [] ; n = Pl} ; + -- NumCard n = n ** {hasCard = True} ; -- -- NumDigits n = {s = n.s ! NCard ; n = n.n} ; @@ -95,7 +94,7 @@ concrete NounLat of Noun = CatLat ** open ResLat, Prelude in { -- a = agrP3 Sg -- } ; -- --- UseN n = n ; + UseN n = n ; -- UseN2 n = n ; -----b UseN3 n = n ; -- diff --git a/lib/next-resource/latin/ParadigmsLat.gf b/lib/next-resource/latin/ParadigmsLat.gf index c47074a88..808d46bc4 100644 --- a/lib/next-resource/latin/ParadigmsLat.gf +++ b/lib/next-resource/latin/ParadigmsLat.gf @@ -34,6 +34,15 @@ oper = \x,y,z -> noun_ngg x y z ** {lock_N = <>} ; } ; + mkA = overload { + mkA : (verbum : Str) -> A + = \n -> adj n ** {isPre = False ; lock_A = <>} ; + mkA : (verbum, verbi : Str) -> A + = \x,y -> adj123 x y ** {isPre = False ; lock_A = <>} ; + mkA : (bonus,bona,bonum : N) -> A + = \x,y,z -> mkAdjective x y z ** {isPre = False ; lock_A = <>} ; + } ; + mkV = overload { mkV : (tacere : Str) -> V diff --git a/lib/next-resource/latin/ResLat.gf b/lib/next-resource/latin/ResLat.gf index 2143e095e..99ae5c3e4 100644 --- a/lib/next-resource/latin/ResLat.gf +++ b/lib/next-resource/latin/ResLat.gf @@ -219,6 +219,52 @@ oper in mkAdjective (noun12 bonus) (noun1 (bon + "a")) (noun2um (bon + "um")) ; + adj3x : (_,_ : Str) -> Adjective = \acer,acris -> + let + ac = Predef.tk 2 acer ; + acrise : Str * Str = case acer of { + _ + "er" => ; + _ + "is" => ; + _ => + } + in + mkAdjective + (noun3adj acer acris Masc) + (noun3adj acrise.p1 acris Fem) + (noun3adj acrise.p2 acris Neutr) ; + + noun3adj : Str -> Str -> Gender -> Noun = \audax,audacis,g -> + let + audac = Predef.tk 2 audacis ; + audacem = case g of {Neutr => audax ; _ => audac + "em"} ; + audaces = case g of {Neutr => audac +"ia" ; _ => audac + "es"} ; + audaci = audac + "i" ; + in + mkNoun + audax audacem (audac + "is") audaci audaci audax + audaces audaces (audac + "ium") (audac + "ibus") + g ; + + +-- smart paradigm + + adj123 : Str -> Str -> Adjective = \bonus,boni -> + case of { + <_ + ("us" | "er"), _ + "i"> => adj12 bonus ; + <_ + ("us" | "er"), _ + "is"> => adj3x bonus boni ; + <_ , _ + "is"> => adj3x bonus boni ; + _ => Predef.error ("adj123: not applicable to" ++ bonus ++ boni) + } ; + + adj : Str -> Adjective = \bonus -> + case bonus of { + _ + ("us" | "er") => adj12 bonus ; + facil + "is" => adj3x bonus bonus ; + feli + "x" => adj3x bonus (feli + "cis") ; + _ => adj3x bonus (bonus + "is") ---- any example? + } ; + + -- verbs param @@ -297,7 +343,7 @@ oper } } ; - esseV : Verb = + esse_V : Verb = let esse = mkVerb "es" "si" "era" "sum" "esse" "fui" "*futus" "ero" "erunt" "eri" ; @@ -431,7 +477,8 @@ oper VP : Type = { fin : VActForm => Str ; inf : VAnter => Str ; - obj : Str + obj : Str ; + adj : Gender => Number => Str } ; VPSlash = VP ** {c2 : Preposition} ; @@ -439,7 +486,8 @@ oper predV : Verb -> VP = \v -> { fin = v.act ; inf = v.inf ; - obj = [] + obj = [] ; + adj = \\_,_ => [] } ; predV2 : (Verb ** {c : Preposition}) -> VPSlash = \v -> predV v ** {c2 = v.c} ; @@ -449,13 +497,21 @@ oper insertObj : Str -> VP -> VP = \obj,vp -> { fin = vp.fin ; inf = vp.inf ; - obj = obj ++ vp.obj + obj = obj ++ vp.obj ; + adj = vp.adj + } ; + + insertAdj : (Gender => Number => Case => Str) -> VP -> VP = \adj,vp -> { + fin = vp.fin ; + inf = vp.inf ; + obj = vp.obj ; + adj = \\g,n => adj ! g ! n ! Nom ++ vp.adj ! g ! n } ; Clause = {s : VAnter => VTense => Polarity => Str} ; mkClause : Pronoun -> VP -> Clause = \np,vp -> { - s = \\a,t,p => np.s ! Nom ++ vp.obj ++ negation p ++ + s = \\a,t,p => np.s ! Nom ++ vp.obj ++ vp.adj ! np.g ! np.n ++ negation p ++ vp.fin ! VAct a t np.n np.p } ; @@ -463,5 +519,40 @@ oper Pos => [] ; Neg => "non" } ; + +-- determiners + + Determiner : Type = { + s,sp : Gender => Case => Str ; + n : Number + } ; + + Quantifier : Type = { + s,sp : Number => Gender => Case => Str ; + } ; + + mkQuantifG : (_,_,_,_,_ : Str) -> (_,_,_,_ : Str) -> (_,_,_ : Str) -> + Gender => Case => Str = + \mn,ma,mg,md,mab, fno,fa,fg,fab, nn,ng,nab -> table { + Masc => pronForms mn ma mg md mab ; + Fem => pronForms fno fa fg md fab ; + Neutr => pronForms nn nn ng md nab + } ; + + mkQuantifier : (sg,pl : Gender => Case => Str) -> Quantifier = \sg,pl -> + let ssp = table {Sg => sg ; Pl => pl} + in { + s = ssp ; + sp = ssp + } ; + + hic_Quantifier = mkQuantifier + (mkQuantifG + "hic" "hunc" "huius" "huic" "hoc" "haec" "hanc" "huius" "hac" "hoc" "huius" "hoc") + (mkQuantifG + "hi" "hos" "horum" "his" "his" "hae" "has" "harum" "his" "hocec" "horum" "his") + ; + + } diff --git a/lib/next-resource/latin/StructuralLat.gf b/lib/next-resource/latin/StructuralLat.gf index 9234af5e5..1da0e796a 100644 --- a/lib/next-resource/latin/StructuralLat.gf +++ b/lib/next-resource/latin/StructuralLat.gf @@ -95,12 +95,12 @@ concrete StructuralLat of Structural = CatLat ** -- there7from_Adv = ss ["from there"] ; -- therefore_PConj = ss "therefore" ; -- they_Pron = mkPron "they" "them" "their" "theirs" Pl P3 Masc ; ---- --- this_Quant = mkQuant "this" "these" ; + this_Quant = hic_Quantifier ; -- through_Prep = ss "through" ; -- too_AdA = ss "too" ; -- to_Prep = ss "to" ; -- under_Prep = ss "under" ; --- very_AdA = ss "very" ; + very_AdA = ss "valde" ; -- want_VV = P.mkVV (P.regV "want") ; -- we_Pron = mkPron "we" "us" "our" "ours" Pl P1 Masc ; -- whatPl_IP = mkIP "what" "what" "what's" Pl ; diff --git a/lib/next-resource/latin/VerbLat.gf b/lib/next-resource/latin/VerbLat.gf index c57db77d2..451963e96 100644 --- a/lib/next-resource/latin/VerbLat.gf +++ b/lib/next-resource/latin/VerbLat.gf @@ -31,7 +31,7 @@ concrete VerbLat of Verb = CatLat ** open ResLat in { -- (insertObjc (\\a => infVP vv.isAux vp a) (predVc vv)) ** -- {c2 = vp.c2} ; -- --- UseComp comp = insertObj comp.s (predAux auxBe) ; + UseComp comp = insertAdj comp.s (predV esse_V) ; -- -- AdvVP vp adv = insertObj (\\_ => adv.s) vp ; -- @@ -43,7 +43,7 @@ concrete VerbLat of Verb = CatLat ** open ResLat in { -- -----b UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no "to" -- --- CompAP ap = ap ; + CompAP ap = ap ; -- CompNP np = {s = \\_ => np.s ! Acc} ; -- CompAdv a = {s = \\_ => a.s} ; --