1
0
forked from GitHub/gf-rgl
Files
gf-rgl/src/gaelic/NounGla.gf
2025-11-06 13:47:58 +01:00

234 lines
5.5 KiB
Plaintext

concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
flags optimize=all_subs ;
lin
--2 Noun phrases
-- : Det -> CN -> NP
DetCN det cn = emptyNP ** {
art = det.s ! cn.g ;
s = \\c => case det.dt of {
DDef n sp => cn.s ! c ! sp ! n ;
DPoss n _ => cn.s ! c ! Def ! n -- ????????????????
} ;
voc = case det.dt of {
DDef n sp => cn.voc ! n ; -- ???????????????? guessed
DPoss n _ => cn.voc ! n -- ????????????????
} ;
a = NotPron det.dt ;
} ;
-- : PN -> NP ;
-- Assuming that lincat PN = lincat NP
-- UsePN pn = pn ;
-- : Pron -> NP ;
-- Assuming that lincat Pron = lincat NP
UsePron pron = emptyNP ** pron ** {
s = pron.s ;
a = IsPron pron.a
} ;
{-
-- : Predet -> NP -> NP ; -- only the man
PredetNP predet np =
-- A noun phrase can also be postmodified by the past participle of a
-- verb, by an adverb, or by a relative clause
-- low prio
-- : NP -> V2 -> NP ; -- the man seen
-- PPartNP np v2 = np ** {
-- s =
-- } ;
-- : NP -> Adv -> NP ; -- Paris today
AdvNP np adv = np ** {
s = np.s ++ "," ++ adv.s
} ;
-- : NP -> Adv -> NP ; -- boys, such as ..
ExtAdvNP np adv = AdvNP np {s = "," ++ adv.s} ;
-- : NP -> RS -> NP ; -- Paris, which is here
RelNP np rs = np ** {
} ;
-- Determiners can form noun phrases directly.
-- : Det -> NP ;
DetNP det = emptyNP ** {
s = \\_ => linDet det ;
} ;
-}
-- MassNP : CN -> NP ;
MassNP cn = emptyNP ** {
s = \\c => cn.s ! c ! Indef ! Sg -- no article, singular indefinite forms, open for cases+mutations
} ;
--2 Determiners
-- The determiner has a fine-grained structure, in which a 'nucleus'
-- quantifier and an optional numeral can be discerned.
-- : Quant -> Num -> Det ;
DetQuant quant num = quant ** {
s = \\g,c => getArt quant num.n g c ++ num.s ;
s2 = \\g,c => "DUMMY" ; -- "teen" from numbers like seventeen
dt = case quant.qt of {
QDef defi => DDef num.n defi ;
QPoss agr => DPoss num.n agr } ;
} ;
-- : Quant -> Num -> Ord -> Det ;
-- DetQuantOrd quant num ord = quant ** {
-- } ;
-- Whether the resulting determiner is singular or plural depends on the
-- cardinal.
-- All parts of the determiner can be empty, except $Quant$, which is
-- the "kernel" of a determiner. It is, however, the $Num$ that determines
-- the inherent number.
NumSg = {s = [] ; n = Sg} ;
NumPl = {s = [] ; n = Pl} ;
{-
-- : Card -> Num ; -- two
NumCard card = card ;
-- : Digits -> Card ;
NumDigits dig = -- probably like OrdDigits, but choose the NCard form
-- : Numeral -> Card ;
NumNumeral num = {
s = num.s ! NCard ;
n = num.n -- inherits grammatical number (Sg, Pl, …) from the Numeral
} ;
-- : AdN -> Card -> Card ;
AdNum adn card = card ** { s = adn.s ++ card.s } ;
-- : Digits -> Ord ;
OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
-- : Numeral -> Ord ;
OrdNumeral num = {
s = num.s ! NOrd
} ;
-- : A -> Ord ;
OrdSuperl a = {
s = "most" ++ a.s ! Superl
} ;
-- One can combine a numeral and a superlative.
-- : Numeral -> A -> Ord ; -- third largest
OrdNumeralSuperl num a = {
s = num.s ! NOrd ++ a.s ! Superl
} ;
-}
-- : Quant
DefArt = ResGla.defArt ;
-- : Quant
IndefArt = {
s = \\_ => [] ;
sp = [] ;
qt = QDef Indef ;
} ;
-- : Pron -> Quant -- my
PossPron pron = {
s = \\_ => pron.poss ;
sp = pron.poss ;
qt = QPoss pron.a ;
} ;
--2 Common nouns
-- : N -> CN
UseN n = n ;
{-
-- : N2 -> CN ;
UseN2 n2 =
-- : N2 -> NP -> CN ;
ComplN2 n2 np =
-- : N3 -> NP -> N2 ; -- distance from this city (to Paris)
ComplN3 n3 np =
-- : N3 -> N2 ; -- distance (from this city)
Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ;
-- : N3 -> N2 ; -- distance (to Paris)
Use3N3 n3 = lin N2 n3 ;
-}
-- : AP -> CN -> CN
AdjCN ap cn = {
s = \\c,s,n => cn.s ! c ! s ! n ++ ap.s ! aform c n cn.g ;
voc = \\n => cn.voc ! n ++ ap.voc ! cn.g ;
g = cn.g
} ;
{-
-- : CN -> RS -> CN ;
RelCN cn rs =
-- : CN -> Adv -> CN ;
AdvCN cn adv =
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications
-- to decide. Sentential complements are defined in VerbGla.
-- : CN -> SC -> CN ; -- question where she sleeps
SentCN cn sc =
--2 Apposition
-- This is certainly overgenerating.
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
ApposCN cn np = cn ** {
s =
} ;
--2 Possessive and partitive constructs
-- NB. Below this, the functions are not in the API, so lower prio to implement
-- : PossNP : CN -> NP -> CN ;
-- in English: book of someone; point is that we can add a determiner to the CN,
-- so it can become "a book of someone" or "the book of someone"
PossNP cn np =
-- : Det -> NP -> NP ; -- three of them, some of the boys
CountNP det np = -- Nonsense for DefArt or IndefArt, but don't worry about that! RGL can contain weird sentences, as long as it contains the non-weird stuff we want
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
PartNP cn np =
--3 Conjoinable determiners and ones with adjectives
-- : DAP -> AP -> DAP ; -- the large (one)
AdjDAP dap ap = dap ** {
} ;
-- : Det -> DAP ; -- this (or that)
DetDAP det = det ;
-}
}