1
0
forked from GitHub/gf-rgl

make it possible to add more cardinals

This commit is contained in:
Krasimir Angelov
2018-07-06 19:03:31 +02:00
parent 41c9cc80a6
commit 326d9edb22
9 changed files with 40 additions and 33 deletions

View File

@@ -73,9 +73,9 @@ concrete CatEng of Cat = CommonX - [Pol,SC] ** open ResEng, Prelude in {
DAP, Det = {s : Str ; sp : Gender => Bool => NPCase => Str ; n : Number ; hasNum : Bool} ; DAP, Det = {s : Str ; sp : Gender => Bool => NPCase => Str ; n : Number ; hasNum : Bool} ;
Predet = {s : Str} ; Predet = {s : Str} ;
Ord = { s : Case => Str } ; Ord = { s : Case => Str } ;
Num = {s : Case => Str ; n : Number ; hasCard : Bool} ; Num = {s,sp : Bool => Case => Str ; n : Number ; hasCard : Bool} ;
Card = {s : Case => Str ; n : Number} ; Card = {s,sp : Bool => Case => Str ; n : Number} ;
Quant = {s : Bool => Number => Str ; sp : Gender => Bool => Number => NPCase => Str} ; Quant = {s : Bool => Number => Str ; sp : Gender => Bool => Number => NPCase => Str; isDef : Bool} ;
-- Numeral -- Numeral

View File

@@ -5,8 +5,8 @@ concrete CompatibilityEng of Compatibility = CatEng ** open Prelude, ResEng in {
-- from Noun 19/4/2008 -- from Noun 19/4/2008
lin lin
NumInt n = {s = addGenitiveS n.s ; n = Pl ; hasCard = True} ; NumInt n = {s,sp = \\_ => addGenitiveS n.s ; n = Pl ; hasCard = True} ;
OrdInt n = {s = \\c => n.s ++ (regGenitiveS "th")!c } ; OrdInt n = {s = \\c => n.s ++ (regGenitiveS "th")!c } ;
oper oper
-- Note: this results in a space before 's, but there's -- Note: this results in a space before 's, but there's

View File

@@ -30,10 +30,10 @@ concrete ExtendEng of Extend =
ParadigmsEng in { ParadigmsEng in {
lin lin
GenNP np = {s = \\_,_ => np.s ! npGen ; sp = \\_,_,_,_ => np.s ! npGen} ; GenNP np = {s = \\_,_ => np.s ! npGen ; sp = \\_,_,_,_ => np.s ! npGen ; isDef = True} ;
GenIP ip = {s = \\_ => ip.s ! NCase Gen} ; GenIP ip = {s = \\_ => ip.s ! NCase Gen} ;
GenRP nu cn = { GenRP nu cn = {
s = \\c => "whose" ++ nu.s ! Nom ++ s = \\c => "whose" ++ nu.s ! False ! Nom ++
case c of { case c of {
RC _ (NCase Gen) => cn.s ! nu.n ! Gen ; RC _ (NCase Gen) => cn.s ! nu.n ! Gen ;
_ => cn.s ! nu.n ! Nom _ => cn.s ! nu.n ! Nom
@@ -313,7 +313,7 @@ concrete ExtendEng of Extend =
lin lin
ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ; ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
ReflPron = {s = reflPron} ; ReflPron = {s = reflPron} ;
ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ; ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! True ! Nom ++ cn.s ! num.n ! Nom} ;
PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ; PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;
ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ; ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ;

View File

@@ -2,10 +2,10 @@ concrete ExtraEng of ExtraEngAbs = CatEng **
open ResEng, Coordination, Prelude, MorphoEng, ParadigmsEng in { open ResEng, Coordination, Prelude, MorphoEng, ParadigmsEng in {
lin lin
GenNP np = {s = \\_,_ => np.s ! npGen ; sp = \\_,_,_,_ => np.s ! npGen} ; GenNP np = {s = \\_,_ => np.s ! npGen ; sp = \\_,_,_,_ => np.s ! npGen; isDef = True} ;
GenIP ip = {s = \\_ => ip.s ! NCase Gen} ; GenIP ip = {s = \\_ => ip.s ! NCase Gen} ;
GenRP nu cn = { GenRP nu cn = {
s = \\c => "whose" ++ nu.s ! Nom ++ s = \\c => "whose" ++ nu.s ! False ! Nom ++
case c of { case c of {
RC _ (NCase Gen) => cn.s ! nu.n ! Gen ; RC _ (NCase Gen) => cn.s ! nu.n ! Gen ;
_ => cn.s ! nu.n ! Nom _ => cn.s ! nu.n ! Nom
@@ -288,7 +288,7 @@ lin
lin lin
ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ; ReflRNP vps rnp = insertObjPre (\\a => vps.c2 ++ rnp.s ! a) vps ;
ReflPron = {s = reflPron} ; ReflPron = {s = reflPron} ;
ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! Nom ++ cn.s ! num.n ! Nom} ; ReflPoss num cn = {s = \\a => possPron ! a ++ num.s ! True ! Nom ++ cn.s ! num.n ! Nom} ;
PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ; PredetRNP predet rnp = {s = \\a => predet.s ++ rnp.s ! a} ;
ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ; ConjRNP conj rpns = conjunctDistrTable Agr conj rpns ;

View File

@@ -36,19 +36,20 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
a = np.a a = np.a
} ; } ;
DetQuant quant num = { DetQuant quant num = {
s = quant.s ! num.hasCard ! num.n ++ num.s ! Nom; s = quant.s ! num.hasCard ! num.n ++ num.s ! quant.isDef ! Nom;
sp = \\g,hasAdj,c => case num.hasCard of { sp = \\g,hasAdj,c => case num.hasCard of {
False => quant.sp ! g ! (orB hasAdj num.hasCard) ! num.n ! c ++ num.s ! Nom ; False => quant.sp ! g ! hasAdj ! num.n ! c ++ num.s ! quant.isDef ! Nom ;
True => quant.s ! num.hasCard ! num.n ++ num.s ! npcase2case c True => quant.s ! True ! num.n ++ num.sp ! quant.isDef ! npcase2case c
} ; } ;
n = num.n ; n = num.n ;
hasNum = num.hasCard hasNum = num.hasCard
} ; } ;
DetQuantOrd quant num ord = { DetQuantOrd quant num ord = {
s = quant.s ! num.hasCard ! num.n ++ num.s ! Nom ++ ord.s ! Nom; s = quant.s ! num.hasCard ! num.n ++ num.s ! quant.isDef ! Nom ++ ord.s ! Nom;
sp = \\g,_,c => quant.s ! num.hasCard ! num.n ++ num.s ! Nom ++ ord.s ! npcase2case c ; sp = \\g,_,c => quant.s ! num.hasCard ! num.n ++ num.s ! quant.isDef ! Nom ++ ord.s ! npcase2case c ;
n = num.n ; n = num.n ;
hasNum = True hasNum = True
} ; } ;
@@ -64,21 +65,24 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
sp = \\_,hasAdj,_,c => case hasAdj of { sp = \\_,hasAdj,_,c => case hasAdj of {
True => p.s ! NCase Gen ; True => p.s ! NCase Gen ;
False => p.sp ! npcase2case c False => p.sp ! npcase2case c
} } ;
isDef = True
} ; } ;
NumSg = {s = \\c => []; n = Sg ; hasCard = False} ; NumSg = {s,sp = \\_,c => []; n = Sg ; hasCard = False} ;
NumPl = {s = \\c => []; n = Pl ; hasCard = False} ; NumPl = {s,sp = \\_,c => []; n = Pl ; hasCard = False} ;
NumCard n = n ** {hasCard = True} ; NumCard n = n ** {hasCard = True} ;
NumDigits n = {s = n.s ! NCard ; n = n.n} ; NumDigits n = {s,sp = \\_ => n.s ! NCard ; n = n.n} ;
OrdDigits n = {s = n.s ! NOrd} ; OrdDigits n = {s = n.s ! NOrd} ;
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; NumNumeral numeral = {s,sp = \\_ => numeral.s ! NCard; n = numeral.n} ;
OrdNumeral numeral = {s = numeral.s ! NOrd} ; OrdNumeral numeral = {s = numeral.s ! NOrd} ;
AdNum adn num = {s = \\c => adn.s ++ num.s!c ; n = num.n} ; AdNum adn num = {s = \\_,c => adn.s ++ num.s !False!c ;
sp = \\_,c => adn.s ++ num.sp!False!c ;
n = num.n} ;
OrdSuperl a = {s = \\c => a.s ! AAdj Superl c } ; OrdSuperl a = {s = \\c => a.s ! AAdj Superl c } ;
@@ -90,7 +94,8 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
<Sg,False> => table { NCase Gen => table Gender ["its"; "his"; "her"] ! g; _ => table Gender ["it"; "he"; "she"] ! g } ; <Sg,False> => table { NCase Gen => table Gender ["its"; "his"; "her"] ! g; _ => table Gender ["it"; "he"; "she"] ! g } ;
<Pl,False> => table { NCase Nom => "they"; NPAcc => "them"; _ => "theirs" } ; <Pl,False> => table { NCase Nom => "they"; NPAcc => "them"; _ => "theirs" } ;
_ => \\c => artDef _ => \\c => artDef
} } ;
isDef = True
} ; } ;
IndefArt = { IndefArt = {
@@ -102,7 +107,8 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
<Sg,False> => table {NCase Gen => "one's"; _ => "one" }; <Sg,False> => table {NCase Gen => "one's"; _ => "one" };
<Pl,False> => table {NCase Gen => "ones'"; _ => "ones" } ; <Pl,False> => table {NCase Gen => "ones'"; _ => "ones" } ;
_ => \\c => [] _ => \\c => []
} } ;
isDef = False
} ; } ;
MassNP cn = { MassNP cn = {

View File

@@ -443,7 +443,8 @@ mkInterj : Str -> Interj
s = \\_ => table { Sg => sg ; Pl => pl } ; s = \\_ => table { Sg => sg ; Pl => pl } ;
sp = \\g,_ => table { sp = \\g,_ => table {
Sg => \\c => regGenitiveS (case g of {Masc=>sg1'; Fem=>sg1'; Neutr=>sg2'}) ! npcase2case c ; Sg => \\c => regGenitiveS (case g of {Masc=>sg1'; Fem=>sg1'; Neutr=>sg2'}) ! npcase2case c ;
Pl => \\c => regGenitiveS (case g of {Masc=>pl1'; Fem=>pl1'; Neutr=>pl2'}) ! npcase2case c} Pl => \\c => regGenitiveS (case g of {Masc=>pl1'; Fem=>pl1'; Neutr=>pl2'}) ! npcase2case c} ;
isDef = True
} ; } ;
mkOrd : Str -> Ord = \x -> lin Ord { s = regGenitiveS x}; mkOrd : Str -> Ord = \x -> lin Ord { s = regGenitiveS x};

View File

@@ -15,7 +15,7 @@ concrete PhraseEng of Phrase = CatEng ** open Prelude, ResEng in {
UttVP vp = {s = infVP VVInf vp False Simul CPos (agrP3 Sg)} ; UttVP vp = {s = infVP VVInf vp False Simul CPos (agrP3 Sg)} ;
UttAdv adv = adv ; UttAdv adv = adv ;
UttCN n = {s = n.s ! Sg ! Nom} ; UttCN n = {s = n.s ! Sg ! Nom} ;
UttCard n = {s = n.s ! Nom} ; UttCard n = {s = n.s ! False ! Nom} ;
UttAP ap = {s = ap.s ! agrP3 Sg} ; UttAP ap = {s = ap.s ! agrP3 Sg} ;
UttInterj i = i ; UttInterj i = i ;

View File

@@ -47,7 +47,7 @@ concrete QuestionEng of Question = CatEng ** open ResEng, Prelude in {
} ; } ;
IdetQuant idet num = { IdetQuant idet num = {
s = idet.s ! num.n ++ num.s ! Nom ; s = idet.s ! num.n ++ num.s ! False ! Nom ;
n = num.n n = num.n
} ; } ;

View File

@@ -6,7 +6,7 @@ lin
SymbPN i = {s = addGenitiveS i.s ; g = Neutr} ; SymbPN i = {s = addGenitiveS i.s ; g = Neutr} ;
IntPN i = {s = addGenitiveS i.s ; g = Neutr} ; IntPN i = {s = addGenitiveS i.s ; g = Neutr} ;
FloatPN i = {s = addGenitiveS i.s ; g = Neutr} ; FloatPN i = {s = addGenitiveS i.s ; g = Neutr} ;
NumPN i = {s = i.s ; g = Neutr} ; NumPN i = {s = i.s ! False ; g = Neutr} ;
CNIntNP cn i = { CNIntNP cn i = {
s = \\c => cn.s ! Sg ! Nom ++ (addGenitiveS i.s) ! npcase2case c ; s = \\c => cn.s ! Sg ! Nom ++ (addGenitiveS i.s) ! npcase2case c ;
a = agrgP3 Sg cn.g a = agrgP3 Sg cn.g
@@ -16,14 +16,14 @@ lin
a = agrgP3 det.n cn.g a = agrgP3 det.n cn.g
} ; } ;
CNNumNP cn i = { CNNumNP cn i = {
s = \\c => cn.s ! Sg ! Nom ++ i.s ! npcase2case c ; s = \\c => cn.s ! Sg ! Nom ++ i.s ! False ! npcase2case c ;
a = agrgP3 Sg cn.g a = agrgP3 Sg cn.g
} ; } ;
SymbS sy = sy ; SymbS sy = sy ;
SymbNum sy = { s = addGenitiveS sy.s ; n = Pl ; hasCard = True } ; SymbNum sy = { s,sp = \\_ => addGenitiveS sy.s ; n = Pl ; hasCard = True } ;
SymbOrd sy = { s = \\c => sy.s ++ (regGenitiveS "th")!c} ; SymbOrd sy = { s = \\c => sy.s ++ (regGenitiveS "th")!c} ;
lincat lincat