1
0
forked from GitHub/gf-rgl

Add some prepositions, merge with pronouns (TODO: merge with articles too)

This commit is contained in:
Inari Listenmaa
2025-08-22 16:30:30 +02:00
parent a539db3d55
commit c85e7a514b
7 changed files with 87 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
concrete AdverbGla of Adverb = CatGla ** open ResGla, ParadigmsGla, Prelude in { concrete AdverbGla of Adverb = CatGla ** open ResGla, ParadigmsGla, Prelude in {
{-
lin lin
{-
-- : A -> Adv ; -- : A -> Adv ;
PositAdvAdj adj = PositAdvAdj adj =
@@ -10,10 +10,17 @@ lin
-- : CAdv -> A -> S -> Adv ; -- more warmly than he runs -- : CAdv -> A -> S -> Adv ; -- more warmly than he runs
ComparAdvAdjS cadv a s = ComparAdvAdjS cadv a s =
-}
-- : Prep -> NP -> Adv ; -- : Prep -> NP -> Adv ;
PrepNP prep np = ; PrepNP prep np = {
s = prep.s ! np.a ++
case <prep.replacesPron, np.a> of {
<_, NotPron _> | <False, _>
=> np.s ! CC (prep.c2 ! np.d) ;
_ => np.empty -- empty string to avoid metavariables
}
} ;
{-
-- Adverbs can be modified by 'adadjectives', just like adjectives. -- Adverbs can be modified by 'adadjectives', just like adjectives.
-- : AdA -> Adv -> Adv ; -- very quickly -- : AdA -> Adv -> Adv ; -- very quickly

View File

@@ -77,7 +77,7 @@ concrete CatGla of Cat = CommonX ** open ResGla, Coordination, Prelude in {
-- coordinating a list of NPs with that Conj. -- coordinating a list of NPs with that Conj.
} ; -- "[Ann and Bob] are children" → and_Conj.n = Pl } ; -- "[Ann and Bob] are children" → and_Conj.n = Pl
Subj = SS ; Subj = SS ;
Prep = SS ; Prep = ResGla.LinPrep ;

View File

@@ -9,6 +9,7 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
-- : Det -> CN -> NP -- : Det -> CN -> NP
DetCN det cn = emptyNP ** { DetCN det cn = emptyNP ** {
s = \\c => det.s ! cn.g ! c ++ cn.s ! getNForm det.n det.d c ; s = \\c => det.s ! cn.g ! c ++ cn.s ! getNForm det.n det.d c ;
a = NotPron det.n ;
d = det.d d = det.d
} ; } ;
{- {-

View File

@@ -109,7 +109,7 @@ oper
-- hidden from the document. -- hidden from the document.
Prep = CatGla.Prep ; Prep = CatGla.Prep ;
noPrep = mkPrep [] ; noPrep = lin Prep ResGla.emptyPrep ;
-- Add more overload instances if needed for all categories! -- Add more overload instances if needed for all categories!
@@ -178,12 +178,12 @@ oper
----- -----
-} -}
{-
-- If prepositions take case, add that as argument to mkPrep -- If prepositions take case, add that as argument to mkPrep
mkPrep = overload { mkPrep = overload {
mkPrep : Str -> Prep = \s -> lin Prep {s = s} ; mkPrep : Str -> Prep = \s -> lin Prep {s = s} ;
} ; } ;
{-
mkConj = overload { mkConj = overload {
mkConj : (and : Str) -> Conj = \s -> … mkConj : (and : Str) -> Conj = \s -> …
mkConj : (either : Str) -> (or : Str) -> Conj = \s -> … mkConj : (either : Str) -> (or : Str) -> Conj = \s -> …

View File

@@ -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? -- 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? 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? -- TODO can we make this combo of inherent params leaner?
n : Number ; a : Agr ;
p : Person ; -- n : Number ;
-- p : Person ;
d : Definiteness ; d : Definiteness ;
} ; } ;
@@ -260,8 +261,10 @@ oper
emptyNP : LinNP = { emptyNP : LinNP = {
s = \\_ => [] ; s = \\_ => [] ;
n = Sg ; a = NotPron Sg ;
p = P3 ; empty = [] ;
-- n = Sg ;
-- p = P3 ;
d = Indefinite ; d = Indefinite ;
} ; } ;
@@ -371,12 +374,15 @@ oper
-- more on preps: Lamb, p.224 -- more on preps: Lamb, p.224
param
Agr = Sg1 | Sg2 | Sg3 Gender | Pl1 | Pl2 | Pl3 | NotPron Number ;
oper oper
LinPrep : Type = { LinPrep : Type = {
s : Str ; s : Agr => Str ; -- bare: aig 'on', inflected: agam 'on me', agad 'on you', …
c2 : Definiteness => Case ; -- most often dative
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. -- 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 ; -- position : PreOrPost ;
@@ -384,7 +390,38 @@ oper
-- Some cause lenition—is that separate from case? -- 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 -- Adjectives
-- Lamb p. 220 basic morphology, degree -- Lamb p. 220 basic morphology, degree
@@ -400,7 +437,7 @@ oper
-- Verbs -- Verbs
param param
VForm = TODOVF Number Person ; VForm = TODOVF Agr;
oper oper
LinV : Type = { LinV : Type = {
@@ -432,7 +469,7 @@ oper
c2 : LinPrep ; c2 : LinPrep ;
} ; } ;
linVP : LinVP -> Str = \vp -> vp.s ! TODOVF Sg P3 ; linVP : LinVP -> Str = \vp -> vp.s ! TODOVF (NotPron Sg) ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Cl, S -- Cl, S

View File

@@ -13,7 +13,7 @@ lin
subj = np.s ! CC Nom ; subj = np.s ! CC Nom ;
pred = pred =
-- table {something with tense+polarity => -- 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! -- TODO: all of the VP's tense and polarity should be open here!
-- PredVP only decides the subject. -- PredVP only decides the subject.
-- } -- }

View File

@@ -90,35 +90,35 @@ lin nothing_NP =
lin somebody_NP = lin somebody_NP =
lin something_NP = lin something_NP =
------- -------}
-- Prep -- Prep
lin above_Prep = mkPrep "" ; -- lin above_Prep = mkPrep "" ;
lin after_Prep = mkPrep "" ; -- lin after_Prep = mkPrep "" ;
lin before_Prep = mkPrep "" ; -- lin before_Prep = mkPrep "" ;
lin behind_Prep = mkPrep "" ; -- lin behind_Prep = mkPrep "" ;
lin between_Prep = = mkPrep "" ; -- lin between_Prep = = mkPrep "" ;
lin by8agent_Prep = mkPrep "" ; -- lin by8agent_Prep = mkPrep "" ;
lin by8means_Prep = mkPrep "" ; -- lin by8means_Prep = mkPrep "" ;
lin during_Prep = mkPrep "" ; -- lin during_Prep = mkPrep "" ;
lin except_Prep = mkPrep "" ; -- lin except_Prep = mkPrep "" ;
lin for_Prep = mkPrep "" ; lin for_Prep = ResGla.doPrep ;
lin from_Prep = mkPrep "" ; lin from_Prep = ResGla.bhoPrep ;
lin in8front_Prep = mkPrep "" ; -- lin in8front_Prep = mkPrep "" ;
lin in_Prep = mkPrep "" ; lin in_Prep = ResGla.annPrep ;
lin on_Prep = mkPrep "" ; lin on_Prep = ResGla.airPrep ;
lin part_Prep = mkPrep ; -- lin part_Prep = mkPrep "" ;
lin possess_Prep = mkPrep "" ; -- lin possess_Prep = mkPrep "" ;
lin through_Prep = mkPrep "" ; -- lin through_Prep = mkPrep "" ;
lin to_Prep = mkPrep "k" ; lin to_Prep = ResGla.guPrep ;
lin under_Prep = mkPrep "" ; -- lin under_Prep = mkPrep "" ;
lin with_Prep = mkPrep "" ; -- lin with_Prep = mkPrep "" ;
lin without_Prep = mkPrep "" ; -- lin without_Prep = mkPrep "" ;
------- -------
-- Pron -- Pron
-- Pronouns are closed class, no constructor in ParadigmsGla. {-- Pronouns are closed class, no constructor in ParadigmsGla.
lin it_Pron = lin it_Pron =
lin i_Pron = lin i_Pron =
lin youPol_Pron = lin youPol_Pron =