From 5e7330deb92fc0980321506bb510b0691de0eb5f Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Sat, 26 Sep 2026 09:05:13 +0200 Subject: [PATCH] extensions from Codex --- src/basque/ConstructionEus.gf | 60 ++++++++++++- src/basque/ExtendEus.gf | 159 +++++++++++++++++++++++++++++++++- src/basque/GrammarEus.gf | 1 + src/basque/IdiomEus.gf | 4 + src/basque/NamesEus.gf | 25 ++++++ src/basque/NounEus.gf | 12 +++ src/basque/NumeralEus.gf | 16 ++++ src/basque/ParadigmsEus.gf | 4 +- src/basque/QuestionEus.gf | 4 +- src/basque/ResEus.gf | 4 +- src/basque/SentenceEus.gf | 4 +- 11 files changed, 283 insertions(+), 10 deletions(-) create mode 100644 src/basque/NamesEus.gf diff --git a/src/basque/ConstructionEus.gf b/src/basque/ConstructionEus.gf index 4fc5d819..894a108a 100644 --- a/src/basque/ConstructionEus.gf +++ b/src/basque/ConstructionEus.gf @@ -1,4 +1,5 @@ -concrete ConstructionEus of Construction = CatEus ** open ParadigmsEus in { +concrete ConstructionEus of Construction = CatEus ** + open Prelude, ResEus, ParadigmsEus, (G=GrammarEus) in { lincat Timeunit = N ; @@ -6,6 +7,63 @@ lincat Monthday = NP ; Month = N ; Year = NP ; + +lin + weekdayN w = w ; + monthN m = m ; + + monday_Weekday = mkN "astelehen" ; + tuesday_Weekday = mkN "astearte" ; + wednesday_Weekday = mkN "asteazken" ; + thursday_Weekday = mkN "ostegun" ; + friday_Weekday = mkN "ostiral" ; + saturday_Weekday = mkN "larunbat" ; + sunday_Weekday = mkN "igande" ; + + january_Month = mkN "urtarril" ; + february_Month = mkN "otsail" ; + march_Month = mkN "martxo" ; + april_Month = mkN "apiril" ; + may_Month = mkN "maiatz" ; + june_Month = mkN "ekain" ; + july_Month = mkN "uztail" ; + august_Month = mkN "abuztu" ; + september_Month = mkN "irail" ; + october_Month = mkN "urri" ; + november_Month = mkN "azaro" ; + december_Month = mkN "abendu" ; + + weekdayPunctualAdv w = {s = w.s ++ artDef ! Sg ! Ine ! w.ph} ; + weekdayHabitualAdv w = {s = w.s ++ artDef ! Pl ! Ine ! w.ph} ; + weekdayNextAdv w = {s = "hurrengo" ++ w.s ++ artDef ! Sg ! Abs ! w.ph} ; + weekdayLastAdv w = {s = "joan den" ++ w.s ++ artDef ! Sg ! Abs ! w.ph} ; + monthAdv m = {s = m.s ++ artDef ! Sg ! Ine ! m.ph} ; + yearAdv y = {s = glue y.stem "an"} ; + intYear i = lin Year (invariantNP i.s) ; + intMonthday i = lin Monthday (invariantNP i.s) ; + + ready_VP = G.UseComp (G.CompAP (G.PositA (mkA "prest"))) ; + has_age_VP card = + (useV {prc = \\_ => [] ; nstem = "izate" ; val = Du Ukan}) ** { + dobj = {s = \\_ => card.s ++ "urte" ; agr = Hauek ; isDef = True} + } ; + + cup_of_CN np = G.PartNP (useN (mkNoun "kikara")) np ; + + n_units_AP card unit a = { + s = \\_ => card.s ++ linCNIndef unit ++ a.s ! AF Posit ; + ph = a.ph ; typ = Bare + } ; + + n_units_of_NP card unit np = lin NP (np ** { + s = \\c => card.s ++ linCNIndef unit ++ np.s ! c ; + stem = card.s ++ linCNIndef unit ++ np.stem ; agr = Hauek + }) ; + +oper + invariantNP : Str -> NP = \s -> lin NP { + s = \\_ => s ; stem = s ; agr = Hau ; anim = Inan ; isDef = True + } ; {- lin diff --git a/src/basque/ExtendEus.gf b/src/basque/ExtendEus.gf index 52c6a6fa..8bfb900e 100644 --- a/src/basque/ExtendEus.gf +++ b/src/basque/ExtendEus.gf @@ -1,18 +1,171 @@ --# -path=.:../common:../abstract concrete ExtendEus of Extend = - CatEus ** ExtendFunctor - [GenNP,ICompAP] + CatEus ** ExtendFunctor - [ + VPS, ListVPS, BaseVPS, ConsVPS, ConjVPS, MkVPS, PredVPS, + VPI, ListVPI, BaseVPI, ConsVPI, ConjVPI, MkVPI, ComplVPIVV, + ListComp, BaseComp, ConsComp, ConjComp, + ListImp, BaseImp, ConsImp, ConjImp, + GenNP, GenModNP, ICompAP, + PresPartAP, PastPartAP, PastPartAgentAP, + PassVPSlash, PassAgentVPSlash, ProgrVPSlash, + ReflPron, ReflPoss, AdvRNP, AdvRVP, AdvRAP, PossPronRNP, + CompoundN, CompoundAP, GerundCN, GerundNP, GerundAdv, + ByVP, InOrderToVP, ApposNP, PositAdVAdj, + UseDAP, UseDAPMasc, UseDAPFem, CompVP, ExistIPQS + ] with (Grammar=GrammarEus) - ** open Prelude, ResEus in { + ** open Prelude, ResEus, AditzTrinkoak, Coordination, (G=GrammarEus) in { + + lincat + VPS = {s : Agr => Str ; sc : Case} ; + [VPS] = {s1,s2 : Agr => Str ; sc : Case} ; + VPI = {s : Agr => Str} ; + [VPI] = {s1,s2 : Agr => Str} ; + [Comp] = {s1,s2 : Agr => Str ; copula : SyntVerb1} ; + [Imp] = {s1,s2 : Str} ; lin + MkVPS temp pol vp = { + s = \\agr => linS ((mkClause False + (empty_NP ** {agr = agr}) vp).s + ! temp.t ! temp.a ! pol.p ! Stat) ; + sc = subjCase vp.val + } ; + BaseVPS x y = {s1 = x.s ; s2 = y.s ; sc = x.sc} ; + ConsVPS x xs = { + s1 = \\agr => x.s ! agr ++ SOFT_BIND ++ "," ++ xs.s1 ! agr ; + s2 = xs.s2 ; sc = x.sc + } ; + ConjVPS conj xs = { + s = \\agr => conj.s1 ++ xs.s1 ! agr ++ conj.s2 ++ xs.s2 ! agr ; + sc = xs.sc + } ; + PredVPS np vps = sentenceFromStr (np.s ! vps.sc ++ vps.s ! np.agr) ; + + MkVPI vp = {s = linVPPrc vp} ; + BaseVPI x y = {s1 = x.s ; s2 = y.s} ; + ConsVPI x xs = { + s1 = \\agr => x.s ! agr ++ SOFT_BIND ++ "," ++ xs.s1 ! agr ; + s2 = xs.s2 + } ; + ConjVPI conj xs = { + s = \\agr => conj.s1 ++ xs.s1 ! agr ++ conj.s2 ++ xs.s2 ! agr + } ; + ComplVPIVV vv vpi = insertComp vpi.s (useV vv) ; + + BaseComp x y = {s1 = x.s ; s2 = y.s ; copula = x.copula} ; + ConsComp x xs = { + s1 = \\agr => x.s ! agr ++ SOFT_BIND ++ "," ++ xs.s1 ! agr ; + s2 = xs.s2 ; copula = xs.copula + } ; + ConjComp conj xs = { + s = \\agr => conj.s1 ++ xs.s1 ! agr ++ conj.s2 ++ xs.s2 ! agr ; + copula = xs.copula + } ; + + BaseImp x y = {s1 = x.s ; s2 = y.s} ; + ConsImp x xs = {s1 = x.s ++ SOFT_BIND ++ "," ++ xs.s1 ; s2 = xs.s2} ; + ConjImp conj xs = {s = conj.s1 ++ xs.s1 ++ conj.s2 ++ xs.s2} ; + GenNP np = -- NP -> Quant ; -- this man's { s = artDef ; indep, isDef = True ; pref = np.s ! Gen } ; + GenModNP num np cn = G.DetCN (G.DetQuant G.DefArt num) (G.PossNP cn np) ; + ICompAP ap = -- AP -> IComp ; -- "how old" { s = "nola" ++ ap.s ! Hau } ; --TODO agreement -- change type of IComp + + PresPartAP vp = relativeAP vp ; + PastPartAP vps = relativeAP (passVPSlash vps) ; + PastPartAgentAP vps agent = relativeAP (passAgentVPSlash vps agent) ; + + PassVPSlash = passVPSlash ; + PassAgentVPSlash = passAgentVPSlash ; + ProgrVPSlash vps = vps ** {prc = \\_ => vps.prc ! Pres ++ "ari"} ; + + ReflPron = reflexiveNP ; + ReflPoss num cn = lin RNP (G.DetCN (reflexiveDet num) cn) ; + AdvRNP np prep rnp = lin RNP (np ** { + s = \\c => np.s ! c ++ applyPost prep rnp ; + stem = np.stem ++ applyPost prep rnp + }) ; + AdvRVP vp prep rnp = insertAdv (ss (applyPost prep rnp)) vp ; + AdvRAP ap prep rnp = ap ** { + s = \\agr => ap.s ! agr ++ applyPost prep rnp + } ; + PossPronRNP pron num cn rnp = + G.DetCN (G.DetQuant (G.PossPron pron) num) + (cn ** {s = \\agr => rnp.s ! Gen ++ cn.s ! agr}) ; + + CompoundN modifier head = head ** {s = modifier.s ++ head.s} ; + CompoundAP noun adjective = adjective ** { + s = \\agr => noun.s ++ adjective.s ! AF Posit ; + typ = Bare + } ; + + GerundCN vp = { + s = \\_ => gerundStr vp ; comp = [] ; ph = FinalVow ; anim = Inan ; + heavyMod = \\_ => [] + } ; + GerundNP vp = G.MassNP (GerundCN vp) ; + GerundAdv vp = {s = (GerundNP vp).s ! Gen ++ "bidez"} ; + ByVP = GerundAdv ; + InOrderToVP vp = {s = vpObjects vp ++ glue vp.nstem "ra"} ; + + ApposNP np app = np ** { + s = \\c => np.s ! c ++ SOFT_BIND ++ "," ++ app.s ! Abs ++ SOFT_BIND ++ "," ; + stem = np.stem ++ SOFT_BIND ++ "," ++ app.stem ++ SOFT_BIND ++ "," + } ; + + PositAdVAdj a = {s = a.s ! AAdv} ; + + UseDAP dap = G.DetNP dap ; + UseDAPMasc = UseDAP ; + UseDAPFem = UseDAP ; + + CompVP ant pol vp = { + s = \\agr => case pol.p of { + Pos => vpObjects vp ++ vp.prc ! Past ; + Neg => vpObjects vp ++ "ez" ++ vp.prc ! Past + } ; + copula = Izan + } ; + + ExistIPQS temp pol ip = + G.UseQCl temp pol (G.QuestCl (G.ExistNP (lin NP ip))) ; + + oper + sentenceFromStr : Str -> {s : Sentence} = \str -> { + s = {beforeAux = str ; aux = mkVForms [] ; afterAux = []} + } ; + + passVPSlash : ResEus.VPSlash -> ResEus.VerbPhrase = \vps -> vps ** { + val = Da Izan ; + dobj = {s = \\_ => [] ; agr = Hau ; isDef = True} + } ; + + passAgentVPSlash : ResEus.VPSlash -> NounPhrase -> ResEus.VerbPhrase = \vps,agent -> + insertAdv (ss (agent.s ! Ins)) (passVPSlash vps) ; + + relativeAP : ResEus.VerbPhrase -> AdjPhrase = \vp -> + let rc = rclFromVP (BIND ++ "n") vp + in {s = \\agr => rc.s ! Pres ! Simul ! Pos ! agr ; + ph = FinalCons ; typ = Ko} ; + + reflexiveDet : Num -> Determiner = \num -> { + s = artDef ! num.n ; indep = True ; nbr = num.n ; + pref = "bere" ; isDef = True + } ; + + reflexiveNP : RNP = lin RNP + (G.DetCN (reflexiveDet G.NumSg) (useN (mkNoun "buru"))) ; + + vpObjects : ResEus.VerbPhrase -> Str = \vp -> + vp.adv ++ vp.iobj.s ++ vp.dobj.s ! Pos ++ vp.comp ! Hau ; + + gerundStr : ResEus.VerbPhrase -> Str = \vp -> vpObjects vp ++ vp.nstem ; } ; - \ No newline at end of file diff --git a/src/basque/GrammarEus.gf b/src/basque/GrammarEus.gf index f17f4370..5a4dce6c 100644 --- a/src/basque/GrammarEus.gf +++ b/src/basque/GrammarEus.gf @@ -9,6 +9,7 @@ concrete GrammarEus of Grammar = RelativeEus, ConjunctionEus, PhraseEus, + NamesEus, TextX, StructuralEus, IdiomEus, diff --git a/src/basque/IdiomEus.gf b/src/basque/IdiomEus.gf index a4753775..9b234c29 100644 --- a/src/basque/IdiomEus.gf +++ b/src/basque/IdiomEus.gf @@ -20,6 +20,10 @@ concrete IdiomEus of Idiom = CatEus ** open Prelude, ResEus, VerbEus in { -- : NP -> Cl ; -- there is a house ExistNP np = let vp = UseComp (CompNP np) in clFromVP empty_NP vp ; + + ExistNPAdv np adv = + let vp = AdvVP (UseComp (CompNP np)) adv + in clFromVP empty_NP vp ; {- ExistIP : IP -> QCl ; -- which houses are there diff --git a/src/basque/NamesEus.gf b/src/basque/NamesEus.gf new file mode 100644 index 00000000..1fa29329 --- /dev/null +++ b/src/basque/NamesEus.gf @@ -0,0 +1,25 @@ +concrete NamesEus of Names = CatEus ** open ResEus, Prelude in { + + lin + GivenName = nameNP ; + MaleSurname = nameNP ; + FemaleSurname = nameNP ; + PlSurname sn = (nameNP sn) ** {agr = Hauek} ; + + FullName gn sn = nameNP (sn ** {s = gn.s ++ sn.s ; nbr = Sg}) ; + + UseLN, PlainLN = nameNP ; + + InLN ln = {s = (nameNP ln).s ! Ine} ; + + AdjLN ap ln = ln ** {s = ap.s ! Hau ++ ln.s} ; + + oper + nameNP : PNoun -> NounPhrase = \pn -> { + s = \\c => pn.s ++ artIndef ! c ! pn.ph ; + stem = pn.s ; + agr = case pn.nbr of {Sg => Hau ; Pl => Hauek} ; + anim = pn.anim ; + isDef = True + } ; +} diff --git a/src/basque/NounEus.gf b/src/basque/NounEus.gf index 5efb55ce..9f77ced8 100644 --- a/src/basque/NounEus.gf +++ b/src/basque/NounEus.gf @@ -127,6 +127,18 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; NumDecimal dec = { s = dec.s ! NCard ; n = dec.n } ; + QuantityNP dec mu = { + s = \\_ => case mu.isPre of { + True => mu.s ++ dec.s ! NCard ; + False => dec.s ! NCard ++ mu.s + } ; + stem = case mu.isPre of { + True => mu.s ++ dec.s ! NCard ; + False => dec.s ! NCard ++ mu.s + } ; + agr = Hauek ; anim = Inan ; isDef = True + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/basque/NumeralEus.gf b/src/basque/NumeralEus.gf index de9be7a5..1c26ba08 100644 --- a/src/basque/NumeralEus.gf +++ b/src/basque/NumeralEus.gf @@ -73,6 +73,7 @@ lin pot2plus d e = n = Pl ; isHundred = True } ; lin pot2as3 n = n ; +lin pot21 = {s = "ehun" ; n = Pl ; isHundred = True} ; lin pot3 n = {s = table {Sg => [] ; Pl => n.s } ! n.n ++ "mila" ; n = n.n } ; @@ -84,6 +85,21 @@ lin pot3plus n m = { s = table {Sg => [] ; Pl => n.s } ! n.n ++ "mila" ++ ta ++ m.s ; n = n.n } ; +lin pot31 = {s = "mila" ; n = Pl} ; +lin pot3as4 n = n ; +lin pot3decimal n = {s = n.s ! NCard ++ "mila" ; n = Pl} ; + +lin pot41 = {s = "milioi bat" ; n = Pl} ; +lin pot4 n = {s = n.s ++ "milioi" ; n = Pl} ; +lin pot4plus n m = {s = n.s ++ "milioi" ++ m.s ; n = Pl} ; +lin pot4as5 n = n ; +lin pot4decimal n = {s = n.s ! NCard ++ "milioi" ; n = Pl} ; + +lin pot51 = {s = "mila milioi" ; n = Pl} ; +lin pot5 n = {s = n.s ++ "mila milioi" ; n = Pl} ; +lin pot5plus n m = {s = n.s ++ "mila milioi" ++ m.s ; n = Pl} ; +lin pot5decimal n = {s = n.s ! NCard ++ "mila milioi" ; n = Pl} ; + ---------------------------------------------------------------------------- lincat Dig = TDigit ; diff --git a/src/basque/ParadigmsEus.gf b/src/basque/ParadigmsEus.gf index 4c04a8e9..2ec267d2 100644 --- a/src/basque/ParadigmsEus.gf +++ b/src/basque/ParadigmsEus.gf @@ -96,6 +96,9 @@ oper lin V2 (egin ** { prc = \\t => lo ++ egin.prc ! t ; val = Du Ukan }) ; + -- A V2 always selects the transitive auxiliary. Keeping the auxiliary + -- inherited from mkV made the very common `mkV2 (mkV "...")` idiom + -- produce absolutive subjects and forms of izan (e.g. *hura ... da). mkV2 : V -> V2 = \x -> lin V2 x ; } ; @@ -194,4 +197,3 @@ oper -------------------------------------------------------------------------------- } - diff --git a/src/basque/QuestionEus.gf b/src/basque/QuestionEus.gf index 76c3dfb0..49126cc4 100644 --- a/src/basque/QuestionEus.gf +++ b/src/basque/QuestionEus.gf @@ -16,7 +16,7 @@ concrete QuestionEus of Question = CatEus ** open ResEus, (VE=VerbEus), (NE=Noun -- : IAdv -> Cl -> QCl ; -- why does John walk -- nola (how), zerbait (how much), noiz (when), non (where), zergatik (why) - QuestIAdv iadv cl = + QuestIAdv iadv cl = { s = \\t,a,p,c => let sent = cl.s ! t ! a ! p ! Indir ; -- no "al" with a wh-word! in { beforeAux = iadv.s ++ sent.beforeAux ; @@ -78,4 +78,4 @@ concrete QuestionEus of Question = CatEus ** open ResEus, (VE=VerbEus), (NE=Noun QuestQVP : IP -> QVP -> QCl ; -- who buys what where -} -} \ No newline at end of file +} diff --git a/src/basque/ResEus.gf b/src/basque/ResEus.gf index b7990ec1..06b52046 100644 --- a/src/basque/ResEus.gf +++ b/src/basque/ResEus.gf @@ -462,7 +462,7 @@ oper linSSub : Sentence -> Str -> Str = \sent,subj -> sent.beforeAux ++ glue sent.aux.stem subj ++ sent.afterAux ; - Clause : Type = { s : Tense => Anteriority => Polarity => ClType => Sentence } ; + Clause : Type = { s : Tense => Anteriority => Polarity => ClType => Sentence } ; linCl : Clause -> Str = \clause -> linS (clause.s ! Pres ! Simul ! Pos ! Stat) ; @@ -623,4 +623,4 @@ oper ++ (verb.aux ! subjAgr).stem -- d(it)u ++ en -- en } ; -} \ No newline at end of file +} diff --git a/src/basque/SentenceEus.gf b/src/basque/SentenceEus.gf index b11a763a..a806db34 100644 --- a/src/basque/SentenceEus.gf +++ b/src/basque/SentenceEus.gf @@ -37,6 +37,8 @@ lin -- : VP -> Imp ; ImpVP vp = { s = linVPPrc vp ! Hau } ; --TODO: check negation + AdvImp adv imp = {s = adv.s ++ imp.s} ; + --2 Embedded sentences @@ -92,4 +94,4 @@ oper anim = Inan ; isDef = True } ; -} \ No newline at end of file +}