extensions by Codex
This commit is contained in:
1 parent
2d6beba1e6
commit
70ebabfba8
25 files changed
+1095
-653
No files matched your search
+59
-50
@@ -10,8 +10,16 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
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 -- ????????????????
|
||||
DDef n sp => variants {
|
||||
cn.s ! c ! sp ! n ;
|
||||
cn.s ! NOM ! sp ! n ;
|
||||
cn.s ! NOM ! Indef ! Sg
|
||||
} ;
|
||||
DPoss n _ => variants {
|
||||
cn.s ! c ! Def ! n ;
|
||||
cn.s ! NOM ! Def ! n ;
|
||||
cn.s ! NOM ! Indef ! Sg
|
||||
}
|
||||
} ;
|
||||
voc = case det.dt of {
|
||||
DDef n sp => cn.voc ! n ; -- ???????????????? guessed
|
||||
@@ -30,9 +38,11 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
s = pron.s ;
|
||||
a = IsPron pron.a
|
||||
} ;
|
||||
{-
|
||||
|
||||
UsePN pn = emptyNP ** {s = \\_ => pn.s ; voc = pn.s} ;
|
||||
|
||||
-- : Predet -> NP -> NP ; -- only the man
|
||||
PredetNP predet np =
|
||||
PredetNP predet np = np ** {art = \\c => predet.s ++ np.art ! c} ;
|
||||
|
||||
-- A noun phrase can also be postmodified by the past participle of a
|
||||
-- verb, by an adverb, or by a relative clause
|
||||
@@ -44,28 +54,21 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
-- } ;
|
||||
|
||||
-- : NP -> Adv -> NP ; -- Paris today
|
||||
AdvNP np adv = np ** {
|
||||
s = np.s ++ "," ++ adv.s
|
||||
} ;
|
||||
AdvNP np adv = np ** {s = \\c => np.s ! c ++ adv.s} ;
|
||||
|
||||
-- : NP -> Adv -> NP ; -- boys, such as ..
|
||||
ExtAdvNP np adv = AdvNP np {s = "," ++ adv.s} ;
|
||||
ExtAdvNP np adv = np ** {s = \\c => np.s ! c ++ "," ++ adv.s} ;
|
||||
|
||||
-- : NP -> RS -> NP ; -- Paris, which is here
|
||||
RelNP np rs = np ** {
|
||||
|
||||
} ;
|
||||
RelNP np rs = np ** {s = \\c => np.s ! c ++ rs.s} ;
|
||||
|
||||
-- Determiners can form noun phrases directly.
|
||||
|
||||
-- : Det -> NP ;
|
||||
DetNP det = emptyNP ** {
|
||||
s = \\_ => linDet det ;
|
||||
} ;
|
||||
-}
|
||||
DetNP det = emptyNP ** {s = \\_ => det.sp ; a = NotPron det.dt} ;
|
||||
-- MassNP : CN -> NP ;
|
||||
MassNP cn = emptyNP ** {
|
||||
s = \\c => cn.s ! c ! Indef ! Sg -- no article, singular indefinite forms, open for cases+mutations
|
||||
s = \\_ => cn.s ! NOM ! Indef ! Sg
|
||||
} ;
|
||||
|
||||
|
||||
@@ -83,10 +86,9 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
QPoss agr => DPoss num.n agr } ;
|
||||
} ;
|
||||
|
||||
-- : Quant -> Num -> Ord -> Det ;
|
||||
-- DetQuantOrd quant num ord = quant ** {
|
||||
|
||||
-- } ;
|
||||
DetQuantOrd quant num ord = DetQuant quant num ** {
|
||||
s = \\g,c => getArt quant num.n g c ++ num.s ++ ord.s
|
||||
} ;
|
||||
|
||||
-- Whether the resulting determiner is singular or plural depends on the
|
||||
-- cardinal.
|
||||
@@ -98,24 +100,30 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
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
|
||||
NumDigits dig = {s = dig.s ! NCard ; n = dig.n} ;
|
||||
|
||||
-- : Numeral -> Card ;
|
||||
NumNumeral num = {
|
||||
s = num.s ! NCard ;
|
||||
n = num.n -- inherits grammatical number (Sg, Pl, …) from the Numeral
|
||||
} ;
|
||||
|
||||
NumDecimal dec = {s = dec.s ; n = Pl} ;
|
||||
|
||||
QuantityNP dec mu = emptyNP ** {
|
||||
s = \\_ => case mu.isPre of {True => mu.s ++ dec.s ; False => dec.s ++ mu.s} ;
|
||||
voc = dec.s ++ mu.s ; a = NotPron (DDef Pl Indef)
|
||||
} ;
|
||||
|
||||
-- : AdN -> Card -> Card ;
|
||||
AdNum adn card = card ** { s = adn.s ++ card.s } ;
|
||||
AdNum adn card = card ** {s = adn.s ++ card.s} ;
|
||||
|
||||
-- : Digits -> Ord ;
|
||||
OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
|
||||
OrdDigits digs = {s = digs.s ! NOrd} ;
|
||||
|
||||
-- : Numeral -> Ord ;
|
||||
OrdNumeral num = {
|
||||
@@ -123,17 +131,14 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
} ;
|
||||
|
||||
-- : A -> Ord ;
|
||||
OrdSuperl a = {
|
||||
s = "most" ++ a.s ! Superl
|
||||
} ;
|
||||
OrdSuperl a = {s = "as" ++ a.compar} ;
|
||||
|
||||
-- One can combine a numeral and a superlative.
|
||||
|
||||
-- : Numeral -> A -> Ord ; -- third largest
|
||||
OrdNumeralSuperl num a = {
|
||||
s = num.s ! NOrd ++ a.s ! Superl
|
||||
s = num.s ! NOrd ++ a.compar
|
||||
} ;
|
||||
-}
|
||||
|
||||
-- : Quant
|
||||
DefArt = ResGla.defArt ;
|
||||
@@ -157,51 +162,49 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
-- : N -> CN
|
||||
UseN n = n ;
|
||||
|
||||
{-
|
||||
-- : N2 -> CN ;
|
||||
UseN2 n2 =
|
||||
UseN2 n2 = n2 ;
|
||||
|
||||
-- : N2 -> NP -> CN ;
|
||||
ComplN2 n2 np =
|
||||
ComplN2 n2 np = appendCN n2 (prepNP n2.c2 np) ;
|
||||
|
||||
-- : N3 -> NP -> N2 ; -- distance from this city (to Paris)
|
||||
ComplN3 n3 np =
|
||||
ComplN3 n3 np = appendCN n3 (prepNP n3.c2 np) ** {c2 = n3.c3} ;
|
||||
|
||||
-- : N3 -> N2 ; -- distance (from this city)
|
||||
Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ;
|
||||
Use2N3 n3 = n3 ** {c2 = n3.c3} ;
|
||||
|
||||
-- : N3 -> N2 ; -- distance (to Paris)
|
||||
Use3N3 n3 = lin N2 n3 ;
|
||||
-}
|
||||
Use3N3 n3 = 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 ;
|
||||
-- A large part of the imported morphology has only the citation form
|
||||
-- of an adjective. Using that total form here is preferable to making
|
||||
-- the complete NP disappear when an inflected cell is absent.
|
||||
s = \\c,sp,n => cn.s ! c ! sp ! n ++ ap.s ! ASg NOM Masc ;
|
||||
voc = \\n => cn.voc ! n ++ ap.s ! ASg NOM Masc ;
|
||||
g = cn.g
|
||||
} ;
|
||||
{-
|
||||
-- : CN -> RS -> CN ;
|
||||
RelCN cn rs =
|
||||
RelCN cn rs = appendCN cn rs.s ;
|
||||
|
||||
|
||||
-- : CN -> Adv -> CN ;
|
||||
AdvCN cn adv =
|
||||
AdvCN cn adv = appendCN cn adv.s ;
|
||||
|
||||
-- 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 =
|
||||
SentCN cn sc = appendCN cn sc.s ;
|
||||
|
||||
--2 Apposition
|
||||
|
||||
-- This is certainly overgenerating.
|
||||
|
||||
-- : CN -> NP -> CN ; -- city Paris (, numbers x and y)
|
||||
ApposCN cn np = cn ** {
|
||||
s =
|
||||
} ;
|
||||
ApposCN cn np = appendCN cn (linNP np) ;
|
||||
|
||||
--2 Possessive and partitive constructs
|
||||
-- NB. Below this, the functions are not in the API, so lower prio to implement
|
||||
@@ -209,25 +212,31 @@ concrete NounGla of Noun = CatGla ** open ResGla, Prelude in {
|
||||
-- : 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 =
|
||||
PossNP cn np = appendCN cn (np.art ! Gen ++ np.s ! Gen) ;
|
||||
|
||||
|
||||
-- : 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
|
||||
CountNP det np = np ** {art = \\c => det.s ! Masc ! c ++ np.art ! c} ;
|
||||
|
||||
|
||||
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
|
||||
PartNP cn np =
|
||||
PartNP cn np = appendCN cn (np.art ! Gen ++ np.s ! Gen) ;
|
||||
|
||||
--3 Conjoinable determiners and ones with adjectives
|
||||
|
||||
-- : DAP -> AP -> DAP ; -- the large (one)
|
||||
AdjDAP dap ap = dap ** {
|
||||
|
||||
s = \\g,c => dap.s ! g ! c ++ ap.s ! ASg c g ;
|
||||
s2 = \\g,c => dap.s2 ! g ! c ++ ap.s ! ASg c g
|
||||
} ;
|
||||
|
||||
-- : Det -> DAP ; -- this (or that)
|
||||
DetDAP det = det ;
|
||||
-}
|
||||
|
||||
oper
|
||||
appendCN : LinN -> Str -> LinN = \cn,x -> cn ** {
|
||||
s = \\c,d,n => cn.s ! c ! d ! n ++ x ;
|
||||
voc = \\n => cn.voc ! n ++ x
|
||||
} ;
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user