From c85e7a514b51cf035c298710c1c219fda03ac008 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 22 Aug 2025 16:30:30 +0200 Subject: [PATCH] Add some prepositions, merge with pronouns (TODO: merge with articles too) --- src/gaelic/AdverbGla.gf | 15 +++++++--- src/gaelic/CatGla.gf | 2 +- src/gaelic/NounGla.gf | 1 + src/gaelic/ParadigmsGla.gf | 6 ++-- src/gaelic/ResGla.gf | 57 ++++++++++++++++++++++++++++++------- src/gaelic/SentenceGla.gf | 2 +- src/gaelic/StructuralGla.gf | 46 +++++++++++++++--------------- 7 files changed, 87 insertions(+), 42 deletions(-) diff --git a/src/gaelic/AdverbGla.gf b/src/gaelic/AdverbGla.gf index dd89e853..848ad644 100644 --- a/src/gaelic/AdverbGla.gf +++ b/src/gaelic/AdverbGla.gf @@ -1,6 +1,6 @@ concrete AdverbGla of Adverb = CatGla ** open ResGla, ParadigmsGla, Prelude in { -{- lin +{- -- : A -> Adv ; PositAdvAdj adj = @@ -10,10 +10,17 @@ lin -- : CAdv -> A -> S -> Adv ; -- more warmly than he runs ComparAdvAdjS cadv a s = - +-} -- : Prep -> NP -> Adv ; - PrepNP prep np = ; - + PrepNP prep np = { + s = prep.s ! np.a ++ + case of { + <_, NotPron _> | + => np.s ! CC (prep.c2 ! np.d) ; + _ => np.empty -- empty string to avoid metavariables + } + } ; +{- -- Adverbs can be modified by 'adadjectives', just like adjectives. -- : AdA -> Adv -> Adv ; -- very quickly diff --git a/src/gaelic/CatGla.gf b/src/gaelic/CatGla.gf index 815d006f..ecb85c9f 100644 --- a/src/gaelic/CatGla.gf +++ b/src/gaelic/CatGla.gf @@ -77,7 +77,7 @@ concrete CatGla of Cat = CommonX ** open ResGla, Coordination, Prelude in { -- coordinating a list of NPs with that Conj. } ; -- "[Ann and Bob] are children" → and_Conj.n = Pl Subj = SS ; - Prep = SS ; + Prep = ResGla.LinPrep ; diff --git a/src/gaelic/NounGla.gf b/src/gaelic/NounGla.gf index de0e57c6..8021bc64 100644 --- a/src/gaelic/NounGla.gf +++ b/src/gaelic/NounGla.gf @@ -9,6 +9,7 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in { -- : Det -> CN -> NP DetCN det cn = emptyNP ** { s = \\c => det.s ! cn.g ! c ++ cn.s ! getNForm det.n det.d c ; + a = NotPron det.n ; d = det.d } ; {- diff --git a/src/gaelic/ParadigmsGla.gf b/src/gaelic/ParadigmsGla.gf index 68984f3f..fe9ab02c 100644 --- a/src/gaelic/ParadigmsGla.gf +++ b/src/gaelic/ParadigmsGla.gf @@ -109,7 +109,7 @@ oper -- hidden from the document. Prep = CatGla.Prep ; - noPrep = mkPrep [] ; + noPrep = lin Prep ResGla.emptyPrep ; -- Add more overload instances if needed for all categories! @@ -178,12 +178,12 @@ oper ----- -} - +{- -- If prepositions take case, add that as argument to mkPrep mkPrep = overload { mkPrep : Str -> Prep = \s -> lin Prep {s = s} ; } ; -{- + mkConj = overload { mkConj : (and : Str) -> Conj = \s -> … mkConj : (either : Str) -> (or : Str) -> Conj = \s -> … diff --git a/src/gaelic/ResGla.gf b/src/gaelic/ResGla.gf index aaf19a71..61ae9d89 100644 --- a/src/gaelic/ResGla.gf +++ b/src/gaelic/ResGla.gf @@ -249,10 +249,11 @@ oper -- or do we have an exhaustive list of prepositions that merge, and we can make that into a param and put on a LHS here? s : Case => Str ; -- TODO: is lenition a separate dimension from case? - + empty : Str ; -- to avoid metavariables -- TODO can we make this combo of inherent params leaner? - n : Number ; - p : Person ; + a : Agr ; + -- n : Number ; + -- p : Person ; d : Definiteness ; } ; @@ -260,8 +261,10 @@ oper emptyNP : LinNP = { s = \\_ => [] ; - n = Sg ; - p = P3 ; + a = NotPron Sg ; + empty = [] ; + -- n = Sg ; + -- p = P3 ; d = Indefinite ; } ; @@ -371,12 +374,15 @@ oper -- more on preps: Lamb, p.224 +param + Agr = Sg1 | Sg2 | Sg3 Gender | Pl1 | Pl2 | Pl3 | NotPron Number ; + oper LinPrep : Type = { - s : Str ; - - c2 : Definiteness => Case ; -- most often dative + s : Agr => Str ; -- bare: aig 'on', inflected: agam 'on me', agad 'on you', … + c2 : Definiteness => CoreCase ; -- most often dative + replacesPron : Bool ; -- NP has to keep track of if it comes from a Pron -- If your language has both pre- and postpositions, you need an inherent parameter in Prep to record which one a given Prep is. -- position : PreOrPost ; @@ -384,7 +390,38 @@ oper -- Some cause lenition—is that separate from case? } ; + mkPrep : (replacesPron : Bool) + -> (indef,defi : CoreCase) + -> (aig,agam,agad,aige,aice,againn,agaibh,aca : Str) + -> LinPrep = + \replaces,casIndef,casDef,aig,agam,agad,aige,aice,againn,agaibh,aca -> { + s = table { + NotPron _ => aig ; Sg1 => agam ; Sg2 => agad ; + Sg3 Masc => aige ; Sg3 Fem => aice ; + Pl1 => againn ; Pl2 => agaibh ; Pl3 => aca } ; + c2 = table {Indefinite => casIndef ; Definite => casDef} ; + replacesPron = replaces + } ; + smartPrep : (aig,agam,agad,aige,aice,againn,agaibh,aca : Str) -> LinPrep = + mkPrep True Dat Dat ; + + emptyPrep : LinPrep = { + s = \\_ => [] ; + c2 = \\_ => Dat ; + replacesPron = False + } ; + + aigPrep : LinPrep = smartPrep "aig" "agam" "agad" "aige" "aice" "againn" "agaibh" "aca" ; + airPrep : LinPrep = smartPrep "air" "orm" "ort" "air" "oirre" "oirrn" "oirbh" "orra" ; + annPrep : LinPrep = smartPrep "ann" "annam" "annad" "ann" "innte" "annainn" "annaibh" "annta" ; + àsPrep : LinPrep = smartPrep "às" "asam" "asad" "às" "aiste" "asainn" "asaibh" "asda" ; + bhoPrep : LinPrep = smartPrep "bho" "bhuam" "bhuat" "bhuaithe" "bhuaipe" "bhuainn" "buaibh" "bhuapa" ; +{- dePrep : LinPrep = …-} + doPrep : LinPrep = smartPrep "do" "dhomh" "dhut" "dha" "dhi" "dhuinn" "dhuibh" "dhiubh" ; +{- eadarPrep : LinPrep = …-} +{- foPrep : LinPrep = …-} + guPrep : LinPrep = smartPrep "gu" "ugam" "ugad" "uige" "uice" "ugainn" "ugaibh" "uca" ; -------------------------------------------------------------------------------- -- Adjectives -- Lamb p. 220 basic morphology, degree @@ -400,7 +437,7 @@ oper -- Verbs param - VForm = TODOVF Number Person ; + VForm = TODOVF Agr; oper LinV : Type = { @@ -432,7 +469,7 @@ oper c2 : LinPrep ; } ; - linVP : LinVP -> Str = \vp -> vp.s ! TODOVF Sg P3 ; + linVP : LinVP -> Str = \vp -> vp.s ! TODOVF (NotPron Sg) ; -------------------------------------------------------------------------------- -- Cl, S diff --git a/src/gaelic/SentenceGla.gf b/src/gaelic/SentenceGla.gf index dd86a7dd..9483fe6a 100644 --- a/src/gaelic/SentenceGla.gf +++ b/src/gaelic/SentenceGla.gf @@ -13,7 +13,7 @@ lin subj = np.s ! CC Nom ; pred = -- table {something with tense+polarity => - vp.s ! TODOVF np.n np.p + vp.s ! TODOVF np.a -- TODO: all of the VP's tense and polarity should be open here! -- PredVP only decides the subject. -- } diff --git a/src/gaelic/StructuralGla.gf b/src/gaelic/StructuralGla.gf index e76d33ca..800be0d6 100644 --- a/src/gaelic/StructuralGla.gf +++ b/src/gaelic/StructuralGla.gf @@ -90,35 +90,35 @@ lin nothing_NP = lin somebody_NP = lin something_NP = -------- +-------} -- Prep -lin above_Prep = mkPrep "" ; -lin after_Prep = mkPrep "" ; -lin before_Prep = mkPrep "" ; -lin behind_Prep = mkPrep "" ; -lin between_Prep = = mkPrep "" ; -lin by8agent_Prep = mkPrep "" ; -lin by8means_Prep = mkPrep "" ; -lin during_Prep = mkPrep "" ; -lin except_Prep = mkPrep "" ; -lin for_Prep = mkPrep "" ; -lin from_Prep = mkPrep "" ; -lin in8front_Prep = mkPrep "" ; -lin in_Prep = mkPrep "" ; -lin on_Prep = mkPrep "" ; -lin part_Prep = mkPrep ; -lin possess_Prep = mkPrep "" ; -lin through_Prep = mkPrep "" ; -lin to_Prep = mkPrep "k" ; -lin under_Prep = mkPrep "" ; -lin with_Prep = mkPrep "" ; -lin without_Prep = mkPrep "" ; +-- lin above_Prep = mkPrep "" ; +-- lin after_Prep = mkPrep "" ; +-- lin before_Prep = mkPrep "" ; +-- lin behind_Prep = mkPrep "" ; +-- lin between_Prep = = mkPrep "" ; +-- lin by8agent_Prep = mkPrep "" ; +-- lin by8means_Prep = mkPrep "" ; +-- lin during_Prep = mkPrep "" ; +-- lin except_Prep = mkPrep "" ; +lin for_Prep = ResGla.doPrep ; +lin from_Prep = ResGla.bhoPrep ; +-- lin in8front_Prep = mkPrep "" ; +lin in_Prep = ResGla.annPrep ; +lin on_Prep = ResGla.airPrep ; +-- lin part_Prep = mkPrep "" ; +-- lin possess_Prep = mkPrep "" ; +-- lin through_Prep = mkPrep "" ; +lin to_Prep = ResGla.guPrep ; +-- lin under_Prep = mkPrep "" ; +-- lin with_Prep = mkPrep "" ; +-- lin without_Prep = mkPrep "" ; ------- -- Pron --- Pronouns are closed class, no constructor in ParadigmsGla. +{-- Pronouns are closed class, no constructor in ParadigmsGla. lin it_Pron = lin i_Pron = lin youPol_Pron =