forked from GitHub/gf-core
make the numeral-noun inflection the right way
This commit is contained in:
@@ -19,7 +19,7 @@ concrete CatBul of Cat = CommonX ** open ResBul, Prelude in {
|
||||
QCl = {s : ResBul.Tense => Anteriority => Polarity => QForm => Str} ;
|
||||
IP = {s : Str ; gn : GenNum} ;
|
||||
IComp = {s : Str} ;
|
||||
IDet = {s : Gender => Str ; n : Number; spec : Species} ;
|
||||
IDet = {s : DGender => Case => Str; n : Number; countable : Bool; spec : Species} ;
|
||||
|
||||
-- Verb
|
||||
|
||||
@@ -33,11 +33,12 @@ concrete CatBul of Cat = CommonX ** open ResBul, Prelude in {
|
||||
|
||||
-- Noun
|
||||
|
||||
CN = {s : Number => Case => Species => Str; g : Gender} ;
|
||||
CN = {s : NForm => Str; g : DGender} ;
|
||||
NP, Pron = {s : Case => Str ; a : Agr} ;
|
||||
Det = {s : Gender => Str ; n : Number; spec : Species} ;
|
||||
Num = {s : Str; n : Number } ;
|
||||
Quant = {s : AForm => Str; spec : Species} ;
|
||||
Det = {s : DGender => Case => Str ; n : Number; countable : Bool; spec : Species} ;
|
||||
Predet, Ord = {s : AForm => Str; empty : Bool} ;
|
||||
Num = {s : DGenderSpecies => Str; n : Number; empty : Bool} ;
|
||||
Quant = {s : GenNum => Str; spec : Species} ;
|
||||
|
||||
-- Numeral
|
||||
|
||||
@@ -57,5 +58,5 @@ concrete CatBul of Cat = CommonX ** open ResBul, Prelude in {
|
||||
|
||||
A = {s : AForm => Str} ;
|
||||
|
||||
N = {s : AForm => Str; g : Gender} ;
|
||||
N = {s : NForm => Str; g : DGender} ;
|
||||
}
|
||||
@@ -15,18 +15,17 @@ resource MorphoBul = ResBul ** open Prelude, (Predef=Predef) in {
|
||||
oper
|
||||
--2 Determiners
|
||||
|
||||
mkDeterminerSg : Str -> Str -> Str -> {s : Gender => Str; n : Number; spec : Species} = \vseki,vsiaka,vsiako ->
|
||||
{s = table Gender [vseki;vsiaka;vsiako]; n = Sg; spec = Indef} ;
|
||||
mkDeterminerPl : Str -> {s : Gender => Str ; n : Number; spec : Species} = \vsicki ->
|
||||
{s = \\_ => vsicki; n = Sg; spec = Indef} ;
|
||||
mkDeterminerSg : Str -> Str -> Str -> {s : DGender => Case => Str; n : Number; countable : Bool ; spec : Species} = \vseki,vsiaka,vsiako ->
|
||||
{s = \\g,_ => table DGender [vseki;vseki;vsiaka;vsiako] ! g; n = Sg; countable = False; spec = Indef} ;
|
||||
mkDeterminerPl : Str -> {s : DGender => Case => Str ; n : Number; countable : Bool ; spec : Species} = \vsicki ->
|
||||
{s = \\_,_ => vsicki; n = Pl; countable = False; spec = Indef} ;
|
||||
|
||||
mkQuant : Str -> Str -> Str -> Str -> {s : AForm => Str; spec : Species} = \tozi,tazi,towa,tezi -> {
|
||||
mkQuant : Str -> Str -> Str -> Str -> {s : GenNum => Str; spec : Species} = \tozi,tazi,towa,tezi -> {
|
||||
s = \\gn => case gn of {
|
||||
ASg Masc _ => tozi ;
|
||||
ASg Fem _ => tazi ;
|
||||
ASg Neut _ => towa ;
|
||||
APl _ => tezi ;
|
||||
AFullDef => tozi
|
||||
GSg Masc => tozi ;
|
||||
GSg Fem => tazi ;
|
||||
GSg Neut => towa ;
|
||||
GPl => tezi
|
||||
};
|
||||
spec = Indef
|
||||
} ;
|
||||
|
||||
@@ -4,27 +4,49 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
|
||||
|
||||
lin
|
||||
DetCN det cn =
|
||||
{ s = \\c => det.s ! cn.g ++ cn.s ! det.n ! c ! det.spec ;
|
||||
a = agrP3 (gennum cn.g det.n)
|
||||
{ s = \\c => let nf = case <det.n,det.spec> of {
|
||||
<Sg,Def> => case c of {
|
||||
Nom => NFSgDefNom ;
|
||||
_ => NF Sg Def
|
||||
} ;
|
||||
<Pl,Indef> => case det.countable of {
|
||||
True => NFPlCount ;
|
||||
False => NF Pl Indef
|
||||
} ;
|
||||
_ => NF det.n det.spec
|
||||
} ;
|
||||
in det.s ! cn.g ! c ++ cn.s ! nf ;
|
||||
a = {gn = gennum cn.g det.n; p = P3} ;
|
||||
} ;
|
||||
UsePron p = p ;
|
||||
|
||||
DetSg quant ord = {
|
||||
s = \\g => quant.s ! ASg g Indef ++ ord.s ;
|
||||
s = \\g,c => quant.s ! gennum g Sg ++
|
||||
ord.s ! aform (gennum g Sg) quant.spec c ;
|
||||
n = Sg ;
|
||||
spec=quant.spec
|
||||
countable = False ;
|
||||
spec=case ord.empty of {True => quant.spec; _ => Indef}
|
||||
} ;
|
||||
|
||||
DetPl quant num ord = {
|
||||
s = \\g => quant.s ! aformGenNum (gennum g num.n) ++ num.s ++ ord.s ;
|
||||
s = \\g,c => quant.s ! gennum g num.n ++
|
||||
num.s ! dgenderSpecies g quant.spec c ++
|
||||
ord.s ! aform (gennum g num.n) (case num.empty of {True => quant.spec; _ => Indef}) c ;
|
||||
n = num.n ;
|
||||
spec=quant.spec
|
||||
countable = True ;
|
||||
spec=case <num.empty,ord.empty> of {<True,True> => quant.spec; _ => Indef}
|
||||
} ;
|
||||
|
||||
PossPron p = {s = \\aform => p.s ! Gen aform; spec = Indef} ;
|
||||
PossPron p = {
|
||||
s = \\gn => p.s ! Gen (aform gn Def Nom) ;
|
||||
spec = Indef
|
||||
} ;
|
||||
|
||||
NoNum = {s = []; n = Pl } ;
|
||||
NoOrd = {s = []} ;
|
||||
NoNum = {s = \\_ => []; n = Pl; empty = True} ;
|
||||
NoOrd = {s = \\_ => []; empty = True} ;
|
||||
|
||||
NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; n = numeral.n; empty = False} ;
|
||||
OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform; empty = False} ;
|
||||
|
||||
DefArt = {
|
||||
s = \\_ => [] ;
|
||||
@@ -32,21 +54,14 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
|
||||
} ;
|
||||
|
||||
IndefArt = {
|
||||
s = \\_ => [] ;
|
||||
s = \\_ => [] ;
|
||||
spec = ResBul.Indef
|
||||
} ;
|
||||
|
||||
MassDet = {s = \\_ => [] ; n = Sg ; spec = Indef} ;
|
||||
|
||||
UseN noun = {
|
||||
s = \\n,c,dt => let aform = case n of {
|
||||
Sg => case <noun.g,c,dt> of {
|
||||
<Masc,Nom,Def> => AFullDef ;
|
||||
_ => ASg noun.g dt
|
||||
} ;
|
||||
Pl => APl dt
|
||||
}
|
||||
in noun.s ! aform ;
|
||||
g = noun.g
|
||||
MassDet = {
|
||||
s = \\_ => [] ;
|
||||
spec = Indef
|
||||
} ;
|
||||
|
||||
UseN noun = noun ;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ lin pot01 =
|
||||
unit => table {
|
||||
NCard DMascIndef => "åäèí" ;
|
||||
NCard DMascDef => "åäèíèÿ" ;
|
||||
NCard DMascNomDef => "åäèíèÿò" ;
|
||||
NCard DMascDefNom => "åäèíèÿò" ;
|
||||
NCard DMascPersonalIndef => "åäèí" ;
|
||||
NCard DMascPersonalDef => "åäèíèÿ" ;
|
||||
NCard DMascPersonalNomDef => "åäèíèÿò" ;
|
||||
NCard DMascPersonalDefNom => "åäèíèÿò" ;
|
||||
NCard DFemIndef => "åäíà" ;
|
||||
NCard DFemDef => "åäíàòà" ;
|
||||
NCard DNeutIndef => "åäíî" ;
|
||||
|
||||
@@ -19,7 +19,14 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
|
||||
param
|
||||
Case = Nom | Acc | Gen AForm ;
|
||||
|
||||
|
||||
NForm =
|
||||
NF Number Species
|
||||
| NFSgDefNom
|
||||
| NFPlCount
|
||||
| NFVocative
|
||||
;
|
||||
|
||||
GenNum = GSg Gender | GPl ;
|
||||
|
||||
-- Agreement of $NP$ is a record. We'll add $Gender$ later.
|
||||
@@ -56,19 +63,26 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
|
||||
AForm =
|
||||
ASg Gender Species
|
||||
| ASgMascDefNom
|
||||
| APl Species
|
||||
| AFullDef
|
||||
;
|
||||
|
||||
--2 For $Numeral$
|
||||
|
||||
DGender =
|
||||
DMasc
|
||||
| DMascPersonal
|
||||
| DFem
|
||||
| DNeut
|
||||
;
|
||||
|
||||
DGenderSpecies =
|
||||
DMascIndef
|
||||
| DMascDef
|
||||
| DMascNomDef
|
||||
| DMascDefNom
|
||||
| DMascPersonalIndef
|
||||
| DMascPersonalDef
|
||||
| DMascPersonalNomDef
|
||||
| DMascPersonalDefNom
|
||||
| DFemIndef
|
||||
| DFemDef
|
||||
| DNeutIndef
|
||||
@@ -81,12 +95,14 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
--2 Transformations between parameter types
|
||||
|
||||
oper
|
||||
agrP3 : GenNum -> Agr = \gn ->
|
||||
{gn = gn ; p = P3} ;
|
||||
|
||||
gennum : Gender -> Number -> GenNum = \g,n ->
|
||||
gennum : DGender -> Number -> GenNum = \g,n ->
|
||||
case n of {
|
||||
Sg => GSg g ;
|
||||
Sg => GSg (case g of {
|
||||
DMasc => Masc ;
|
||||
DMascPersonal => Masc ;
|
||||
DFem => Fem ;
|
||||
DNeut => Neut
|
||||
}) ;
|
||||
Pl => GPl
|
||||
} ;
|
||||
|
||||
@@ -96,12 +112,33 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
GPl => Pl
|
||||
} ;
|
||||
|
||||
aformGenNum : GenNum -> AForm = \gn ->
|
||||
aform : GenNum -> Species -> Case -> AForm = \gn,spec,c ->
|
||||
case gn of {
|
||||
GSg g => ASg g Indef ;
|
||||
GPl => APl Indef
|
||||
GSg g => case <g,spec,c> of {
|
||||
<Masc,Def,Nom> => ASgMascDefNom ;
|
||||
_ => ASg g spec
|
||||
} ;
|
||||
GPl => APl spec
|
||||
} ;
|
||||
|
||||
dgenderSpecies : DGender -> Species -> Case -> DGenderSpecies =
|
||||
\g,spec,c -> case <g,spec> of {
|
||||
<DMasc,Indef> => DMascIndef ;
|
||||
<DMasc,Def> => case c of {
|
||||
Nom => DMascDefNom ;
|
||||
_ => DMascDef
|
||||
} ;
|
||||
<DMascPersonal,Indef> => DMascPersonalIndef ;
|
||||
<DMascPersonal,Def> => case c of {
|
||||
Nom => DMascPersonalDefNom ;
|
||||
_ => DMascPersonalDef
|
||||
} ;
|
||||
<DFem ,Indef> => DFemIndef ;
|
||||
<DFem ,Def> => DFemDef ;
|
||||
<DNeut,Indef> => DNeutIndef ;
|
||||
<DNeut,Def> => DNeutDef
|
||||
} ;
|
||||
|
||||
oper
|
||||
-- For $Verb$.
|
||||
|
||||
@@ -120,7 +157,7 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
let pol : Polarity -> Str -> Str = \p,vf -> case p of { Pos => vf ; Neg => "íå" ++ vf }
|
||||
in { s = \\t,a,p,agr => let present = verb.s ! (VPres (numGenNum agr.gn) agr.p) ;
|
||||
aorist = verb.s ! (VAorist (numGenNum agr.gn) agr.p) ;
|
||||
perfect = verb.s ! (VPerfect (aformGenNum agr.gn)) ;
|
||||
perfect = verb.s ! (VPerfect (aform agr.gn Indef Acc)) ;
|
||||
vf = case <t,a> of {
|
||||
<Pres,Simul> => present ;
|
||||
<Pres,Anter> => auxBe.s ! (VPres (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
@@ -129,7 +166,7 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
<Fut, Simul> => "ùå" ++ present ;
|
||||
<Fut, Anter> => "ùå" ++ auxBe.s ! (VPres (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
<Cond,Simul> => auxWould.s ! (VAorist (numGenNum agr.gn) agr.p) ++ perfect ;
|
||||
<Cond,Anter> => auxWould.s ! (VAorist (numGenNum agr.gn) agr.p) ++ auxBe.s ! (VPerfect (aformGenNum agr.gn)) ++ perfect
|
||||
<Cond,Anter> => auxWould.s ! (VAorist (numGenNum agr.gn) agr.p) ++ auxBe.s ! (VPerfect (aform agr.gn Indef Acc)) ++ perfect
|
||||
} ;
|
||||
in pol p vf ;
|
||||
imp = \\p,n => pol p (verb.s ! VImperative n) ;
|
||||
@@ -210,7 +247,7 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
s = table {
|
||||
ASg Masc Indef => dobyr ;
|
||||
ASg Masc Def => dobria ;
|
||||
AFullDef => dobriat ;
|
||||
ASgMascDefNom => dobriat ;
|
||||
ASg Fem Indef => dobra ;
|
||||
ASg Fem Def => dobrata ;
|
||||
ASg Neut Indef => dobro ;
|
||||
@@ -332,7 +369,7 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
mkCardOrd : Str -> Str -> Str -> Str -> CardOrd => Str =
|
||||
\dva, dvama, dve, vtori ->
|
||||
table {
|
||||
NCard dg => digitGender dva dvama dve ! dg ;
|
||||
NCard dg => digitGenderSpecies dva dvama dve ! dg ;
|
||||
NOrd aform => let vtora = init vtori + "à" ;
|
||||
vtoro = init vtori + "î"
|
||||
in (mkAdjective vtori
|
||||
@@ -346,7 +383,7 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
(vtori+"òå")).s ! aform
|
||||
} ;
|
||||
|
||||
digitGender : Str -> Str -> Str -> DGenderSpecies => Str =
|
||||
digitGenderSpecies : Str -> Str -> Str -> DGenderSpecies => Str =
|
||||
\dva, dvama, dve
|
||||
-> let addDef : Str -> Str =
|
||||
\s -> case s of {
|
||||
@@ -357,10 +394,10 @@ resource ResBul = ParamX ** open Prelude in {
|
||||
in table {
|
||||
DMascIndef => dva ;
|
||||
DMascDef => addDef dva ;
|
||||
DMascNomDef => addDef dva ;
|
||||
DMascDefNom => addDef dva ;
|
||||
DMascPersonalIndef => dvama ;
|
||||
DMascPersonalDef => addDef dvama ;
|
||||
DMascPersonalNomDef => addDef dvama ;
|
||||
DMascPersonalDefNom => addDef dvama ;
|
||||
DFemIndef => dve ;
|
||||
DFemDef => addDef dve ;
|
||||
DNeutIndef => dve ;
|
||||
|
||||
@@ -46,7 +46,7 @@ concrete StructuralBul of Structural = CatBul **
|
||||
everything_NP = regNP "everything" Sg ;
|
||||
-}
|
||||
everywhere_Adv = ss "íàâñÿêúäå" ;
|
||||
few_Det = mkDeterminerPl "íÿêîëêî" ;
|
||||
few_Det = {s = \\_,_ => "íÿêîëêî"; n = Pl; countable = True; spec = Indef} ;
|
||||
--- first_Ord = ss "first" ; DEPRECATED
|
||||
for_Prep = ss "çà" ;
|
||||
from_Prep = ss "îò" ;
|
||||
|
||||
@@ -14,7 +14,7 @@ concrete VerbBul of Verb = CatBul ** open ResBul in {
|
||||
|
||||
ReflV2 v = insertObj (\\_ => v.c2 ++ ["ñåáå ñè"]) (predV v) ;
|
||||
|
||||
PassV2 v = insertObj (\\a => v.s ! VPassive (aformGenNum a.gn)) (predV auxBe) ;
|
||||
PassV2 v = insertObj (\\a => v.s ! VPassive (aform a.gn Indef Acc)) (predV auxBe) ;
|
||||
|
||||
CompNP np = {s = \\_ => np.s ! Acc} ;
|
||||
CompAdv a = {s = \\_ => a.s} ;
|
||||
|
||||
Reference in New Issue
Block a user