forked from GitHub/gf-core
Maltese RG: fix implementation of CountNP
This commit is contained in:
@@ -35,7 +35,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
|
||||
book_N = mkN "ktieb" "kotba" ;
|
||||
boot_N = mkNColl "żarbuna" "żarbun" "żraben" ;
|
||||
boss_N = mkN "mgħallem" "mgħallmin" ;
|
||||
boy_N = mkN "tifel" "tfal" ;
|
||||
boy_N = mkN "tifel" "subien" ;
|
||||
bread_N = mkNColl "ħobża" "ħobż" "ħobżiet" ;
|
||||
breast_N = possN (mkN "sider" "sdur") ;
|
||||
brother_N2 = mkN2 (possN (mkN "ħu" "aħwa")) ;
|
||||
@@ -84,7 +84,7 @@ concrete LexiconMlt of Lexicon = CatMlt **
|
||||
friend_N = possN (mkN "ħabib" "ħbieb") ; -- genderedN
|
||||
fruit_N = mkNColl "frotta" "frott" "frottiet" "frottijiet" ;
|
||||
garden_N = mkN "ġnien" "ġonna" ;
|
||||
girl_N = mkN "tifla" "tfal" ;
|
||||
girl_N = mkN "tifla" "tfajliet" ;
|
||||
glove_N = mkN "ingwanta" "ingwanti" ;
|
||||
gold_N = mkNColl "deheb" "dehbijiet" ;
|
||||
grammar_N = mkN "grammatika" "grammatiki" ;
|
||||
|
||||
@@ -36,6 +36,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
|
||||
lin
|
||||
-- Det -> CN -> NP
|
||||
-- the man
|
||||
DetCN det cn =
|
||||
let
|
||||
-- To stop complaining about lock fields
|
||||
@@ -63,6 +64,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- Quant -> Num -> Det
|
||||
-- these five
|
||||
DetQuant quant num = {
|
||||
s = \\gen =>
|
||||
let gennum = case num.n of { NumX Sg => GSg gen ; _ => GPl }
|
||||
@@ -80,6 +82,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- Quant -> Num -> Ord -> Det
|
||||
-- these five best
|
||||
--- Almost an exact copy of DetQuant, consider factoring together
|
||||
DetQuantOrd quant num ord = {
|
||||
s = \\gen =>
|
||||
@@ -96,6 +99,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- Det -> NP
|
||||
-- these five
|
||||
DetNP det = {
|
||||
s = \\c => det.s ! Masc ;
|
||||
a = agrP3 (numform2num det.n) Masc ;
|
||||
@@ -120,6 +124,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- PN -> NP
|
||||
-- John
|
||||
UsePN pn = {
|
||||
s = \\c => pn.s ;
|
||||
a = pn.a ;
|
||||
@@ -128,6 +133,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- Pron -> NP
|
||||
-- he
|
||||
UsePron p = {
|
||||
s = table {
|
||||
NPNom => p.s ! Personal ;
|
||||
@@ -140,6 +146,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- Pron -> Quant
|
||||
-- my (house)
|
||||
PossPron p = {
|
||||
s = \\_ => p.s ! Possessive ;
|
||||
clitic = p.s ! Suffixed ;
|
||||
@@ -149,18 +156,22 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- Predet -> NP -> NP
|
||||
-- only the man
|
||||
PredetNP pred np = overwriteNPs np (\\c => pred.s ++ np.s ! c) ;
|
||||
|
||||
-- NP -> V2 -> NP
|
||||
-- the man seen
|
||||
PPartNP np v2 = case v2.hasPastPart of {
|
||||
True => overwriteNPs np (\\c => np.s ! c ++ (v2.s ! VPastPart (toGenNum np.a)).s1) ; -- raġel rieqed
|
||||
False => overwriteNPs np (\\c => np.s ! c ++ (v2.s ! VImpf (toVAgr np.a)).s1) -- mara tisma'
|
||||
} ;
|
||||
|
||||
-- NP -> RS -> NP
|
||||
-- Paris, which is here
|
||||
RelNP np rs = overwriteNPs np (\\c => np.s ! c ++ "," ++ rs.s ! np.a ) ;
|
||||
|
||||
-- NP -> Adv -> NP
|
||||
-- Paris today
|
||||
AdvNP np adv = overwriteNPs np (\\c => np.s ! c ++ adv.s) ;
|
||||
|
||||
-- Num
|
||||
@@ -171,23 +182,29 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
NumCard n = n ** {hasCard = True} ;
|
||||
|
||||
-- Digits -> Card
|
||||
-- 51
|
||||
NumDigits d = {s = d.s ; n = d.n} ;
|
||||
|
||||
-- Digits -> Ord
|
||||
-- 51st
|
||||
OrdDigits d = {s = d.s} ;
|
||||
|
||||
-- Numeral -> Card
|
||||
-- fifty-one
|
||||
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ;
|
||||
|
||||
-- Numeral -> Ord
|
||||
-- fifty-first
|
||||
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
|
||||
|
||||
-- AdN -> Card -> Card
|
||||
-- almost 51
|
||||
AdNum adn card = card ** {
|
||||
s = \\c => adn.s ++ card.s ! c ;
|
||||
} ;
|
||||
|
||||
-- A -> Ord
|
||||
-- warmest
|
||||
OrdSuperl a = {
|
||||
s = \\c => case a.hasComp of {
|
||||
True => a.s ! ASuperl ;
|
||||
@@ -196,6 +213,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- CN -> NP
|
||||
-- (beer)
|
||||
MassNP cn = {
|
||||
s = \\c => cn.s ! Collective ;
|
||||
a = agrP3 Sg cn.g ;
|
||||
@@ -204,18 +222,23 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- N -> CN
|
||||
-- house
|
||||
UseN n = n ;
|
||||
|
||||
-- N2 -> CN
|
||||
-- mother
|
||||
UseN2 n2 = n2 ; -- just ignore the c2
|
||||
|
||||
-- N3 -> N2
|
||||
-- distance (from this city)
|
||||
Use2N3 n3 = n3 ** { c2 = n3.c2 } ;
|
||||
|
||||
-- N3 -> N2
|
||||
-- distance (to Paris)
|
||||
Use3N3 n3 = n3 ** { c2 = n3.c3 } ;
|
||||
|
||||
-- N2 -> NP -> CN
|
||||
-- mother of the king
|
||||
ComplN2 n2 np = {
|
||||
s = \\num => n2.s ! num ++ prepNP n2.c2 np ;
|
||||
g = n2.g ;
|
||||
@@ -225,6 +248,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- N3 -> NP -> N2
|
||||
-- distance from this city (to Paris)
|
||||
ComplN3 n3 np = {
|
||||
s = \\num => n3.s ! num ++ prepNP n3.c3 np ;
|
||||
g = n3.g ;
|
||||
@@ -235,48 +259,49 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude in {
|
||||
} ;
|
||||
|
||||
-- AP -> CN -> CN
|
||||
-- big house
|
||||
AdjCN ap cn = overwriteCNs cn (\\num => preOrPost ap.isPre (ap.s ! mkGenNum num cn.g) (cn.s ! num)) ;
|
||||
|
||||
-- CN -> RS -> CN
|
||||
-- house that John bought
|
||||
RelCN cn rs = overwriteCNs cn (\\num => cn.s ! num ++ rs.s ! agrP3 (nounnum2num num) cn.g) ;
|
||||
|
||||
-- CN -> Adv -> CN
|
||||
-- house on the hill
|
||||
AdvCN cn adv = overwriteCNs cn (\\num => cn.s ! num ++ adv.s) ;
|
||||
|
||||
-- CN -> SC -> CN
|
||||
-- question where she sleeps
|
||||
SentCN cn sc = overwriteCNs cn (\\num => cn.s ! num ++ sc.s) ;
|
||||
|
||||
-- CN -> NP -> CN
|
||||
-- Appossition: city Paris
|
||||
ApposCN cn np = overwriteCNs cn (\\num => cn.s ! num ++ np.s ! NPNom) ; -- known to be overgenerating
|
||||
|
||||
-- CN -> NP -> CN
|
||||
-- Possessive: house of mine
|
||||
PossNP cn np = overwriteCNs cn (\\num => cn.s ! num ++ prepNP prep_ta np) ;
|
||||
|
||||
-- CN -> NP -> CN
|
||||
-- Partitive: glass of wine
|
||||
PartNP cn np = overwriteCNs cn (\\num => cn.s ! num ++ prepNP prep_ta np) ;
|
||||
|
||||
-- Det -> NP -> NP
|
||||
--- LEAKS ?
|
||||
-- CountNP det np = {
|
||||
-- s = \\c => det.s ! np.a.g ++ np.s ! c ;
|
||||
-- a = agrP3 (numform2num det.n) np.a.g ;
|
||||
-- isPron = False ;
|
||||
-- isDefn = np.isDefn ;
|
||||
-- } ;
|
||||
|
||||
oper
|
||||
prep_ta = lin Prep {
|
||||
s = table {
|
||||
Indefinite => "ta'" ;
|
||||
Definite => makePreFull "tal-" "ta" "t'"
|
||||
} ;
|
||||
enclitic : Agr => Str = \\agr => case toVAgr agr of {
|
||||
AgP1 Sg => "tiegħi" ;
|
||||
AgP2 Sg => "tiegħek" ;
|
||||
AgP3Sg Masc => "tiegħu" ;
|
||||
AgP3Sg Fem => "tagħha" ;
|
||||
AgP1 Pl => "tagħna" ;
|
||||
AgP2 Pl => "tagħkom" ;
|
||||
AgP2Pl => "tagħhom"
|
||||
-- three of them, some of the boys
|
||||
CountNP det np =
|
||||
let
|
||||
dets = case det.n of {
|
||||
NumX Sg => wiehed ! np.a.g ;
|
||||
_ => det.s ! np.a.g
|
||||
} ;
|
||||
takesDet = True ;
|
||||
joinsVerb = False ;
|
||||
in {
|
||||
s = \\c => case np.isPron of {
|
||||
True => dets ++ prep_minn.enclitic ! np.a;
|
||||
False => dets ++ prep_minn.s ! (bool2definiteness np.isDefn) ++ np.s ! c
|
||||
} ;
|
||||
a = agrP3 (numform2num det.n) np.a.g ;
|
||||
isPron = False ;
|
||||
isDefn = np.isDefn ;
|
||||
} ;
|
||||
|
||||
oper
|
||||
|
||||
@@ -348,6 +348,8 @@ resource ResMlt = ParamX ** open Prelude, Predef, Maybe in {
|
||||
isPresent = False ;
|
||||
} ;
|
||||
|
||||
{- Preposition ---------------------------------------------------------- -}
|
||||
|
||||
Preposition = {
|
||||
s : Definiteness => Str ;
|
||||
enclitic : Agr => Str ; -- when suffixed by pronouns; magħ-ha
|
||||
@@ -355,6 +357,42 @@ resource ResMlt = ParamX ** open Prelude, Predef, Maybe in {
|
||||
joinsVerb : Bool ; -- True for for_Prep (I.O. suffix)
|
||||
} ;
|
||||
|
||||
prep_ta : Preposition = {
|
||||
s = table {
|
||||
Indefinite => "ta'" ;
|
||||
Definite => makePreFull "tal-" "ta" "t'"
|
||||
} ;
|
||||
enclitic : Agr => Str = \\agr => case toVAgr agr of {
|
||||
AgP1 Sg => "tiegħi" ;
|
||||
AgP2 Sg => "tiegħek" ;
|
||||
AgP3Sg Masc => "tiegħu" ;
|
||||
AgP3Sg Fem => "tagħha" ;
|
||||
AgP1 Pl => "tagħna" ;
|
||||
AgP2 Pl => "tagħkom" ;
|
||||
AgP2Pl => "tagħhom"
|
||||
} ;
|
||||
takesDet = True ;
|
||||
joinsVerb = False ;
|
||||
} ;
|
||||
|
||||
prep_minn : Preposition = {
|
||||
s = table {
|
||||
Indefinite => "minn" ;
|
||||
Definite => makePreFull "mill-" "mi" "m"
|
||||
} ;
|
||||
enclitic : Agr => Str = \\agr => case toVAgr agr of {
|
||||
AgP1 Sg => "minni" ;
|
||||
AgP2 Sg => "minnek" ;
|
||||
AgP3Sg Masc => "minnu" ;
|
||||
AgP3Sg Fem => "minnha" ;
|
||||
AgP1 Pl => "minna" ;
|
||||
AgP2 Pl => "minnkom" ;
|
||||
AgP2Pl => "minnhom"
|
||||
} ;
|
||||
takesDet = True ;
|
||||
joinsVerb = False ;
|
||||
} ;
|
||||
|
||||
{- Pronoun -------------------------------------------------------------- -}
|
||||
|
||||
oper
|
||||
@@ -1164,6 +1202,12 @@ resource ResMlt = ParamX ** open Prelude, Predef, Maybe in {
|
||||
_ => False
|
||||
} ;
|
||||
|
||||
wiehed : Gender => Str =
|
||||
table {
|
||||
Masc => "wieħed" ;
|
||||
Fem => "waħda"
|
||||
} ;
|
||||
|
||||
artIndef : Str = [] ; --- is this a source of leaks?
|
||||
|
||||
artDef : Str =
|
||||
|
||||
@@ -33,18 +33,18 @@ concrete StructuralMlt of Structural = CatMlt **
|
||||
{- Determiner ----------------------------------------------------------- -}
|
||||
|
||||
all_Predet = ss "kollha" ;
|
||||
every_Det = mkDeterminer singular "kull" ; --- KULĦADD
|
||||
every_Det = mkDeterminer singular "kull" ;
|
||||
few_Det = mkDeterminer plural "ftit" ;
|
||||
many_Det = mkDeterminer plural "ħafna" ;
|
||||
most_Predet = ss "il-maġġoranza ta'" ; --- TAL-, TAN-
|
||||
most_Predet = ss "il-maġġoranza ta'" ; --- tal-, tan-
|
||||
much_Det = mkDeterminer singular "ħafna" ;
|
||||
only_Predet = ss "biss" ;
|
||||
someSg_Det = mkDeterminer singular "xi" ;
|
||||
somePl_Det = mkDeterminer plural "xi" ;
|
||||
somePl_Det = mkDeterminer plural "xi uħud" ;
|
||||
not_Predet = ss "mhux" ;
|
||||
|
||||
how8many_IDet = {
|
||||
s = "kemm" ; -- KEMM IL-...
|
||||
s = "kemm" ; -- kemm il-...
|
||||
n = plural
|
||||
} ;
|
||||
|
||||
@@ -76,7 +76,7 @@ concrete StructuralMlt of Structural = CatMlt **
|
||||
"qabli" "qablek" "qablu" "qabilha" "qabilna" "qabilkom" "qabilhom" ;
|
||||
behind_Prep = after_Prep ;
|
||||
between_Prep = mkPrep "bejn" ;
|
||||
by8agent_Prep = mkPrep "minn" "mill-" "mit-" ;
|
||||
by8agent_Prep = prep_minn ; -- mkPrep "minn" "mill-" "mit-" ;
|
||||
by8means_Prep = mkPrep "bi" "b'" "bil-" "bit-" "bl-" ;
|
||||
during_Prep = mkPrep "waqt" ;
|
||||
for_Prep = mkPrep "għal" "għall-" "għall-" "għat-" "għall-"
|
||||
@@ -87,7 +87,7 @@ concrete StructuralMlt of Structural = CatMlt **
|
||||
in_Prep = mkPrep "fi" "f'" "fil-" "fit-" "fl-" ;
|
||||
on_Prep = mkPrep "fuq" ;
|
||||
part_Prep = possess_Prep ;
|
||||
possess_Prep = mkPrep "ta'" "t'" "tal-" "tat-" "tal-" ;
|
||||
possess_Prep = prep_ta ; -- mkPrep "ta'" "t'" "tal-" "tat-" "tal-" ;
|
||||
through_Prep = mkPrep "minn ġo" "minn ġo" "minn ġol-" "minn ġot-" "minn ġol-"
|
||||
"minn ġo fija" "minn ġo fik" "minn ġo fih" "minn ġo fiha" "minn ġo fina" "minn ġo fikom" "minn ġo fihom"
|
||||
False ;
|
||||
@@ -125,8 +125,8 @@ concrete StructuralMlt of Structural = CatMlt **
|
||||
here_Adv = mkAdv "hawn" ;
|
||||
here7to_Adv = mkAdv ["s'hawnhekk"] ;
|
||||
here7from_Adv = mkAdv ["minn hawnhekk"] ;
|
||||
less_CAdv = C.mkCAdv "inqas" "minn" ; --- INQAS MILL-IEĦOR
|
||||
more_CAdv = C.mkCAdv "iktar" "minn" ; --- IKTAR MIT-TNEJN
|
||||
less_CAdv = C.mkCAdv "inqas" "minn" ; --- inqas mill-ieħor
|
||||
more_CAdv = C.mkCAdv "iktar" "minn" ; --- iktar mit-tnejn
|
||||
quite_Adv = mkAdv "pjuttost" ;
|
||||
so_AdA = mkAdA "allura" ;
|
||||
somewhere_Adv = mkAdv "x'imkien" ;
|
||||
|
||||
Reference in New Issue
Block a user