extend the names API

This commit is contained in:
Krasimir Angelov
2023-02-07 08:47:34 +01:00
parent a6faaeb351
commit 828bf9c677
33 changed files with 182 additions and 57 deletions
+2 -1
View File
@@ -56,7 +56,8 @@ lincat
N2 = {s : Case => Number => Str; g : AGender; c : Prep} ;
N3 = {s : Case => Number => Str; g : AGender; c : Prep} ;
GN, SN = {s : Case => Str; g : AGender};
GN = {s : Case => Str; g : Sex};
SN = {s : Sex => Case => Str};
PN = {s : Case => Str; g : AGender; n : Number};
linref
+5 -3
View File
@@ -57,10 +57,12 @@ lin
youPolPl_Pron = youPol_Pron ;
youPolPlFem_Pron = youPlFem_Pron ;
lin GivenName, Surname = \n -> n ** {n = Sg} ;
lin GivenName = \n -> {s = n.s; g = sex2agender n.g; n = Sg} ;
lin MaleSurname = \n -> {s = n.s ! Male; g = AMasc Animate; n = Sg} ;
lin FemaleSurname = \n -> {s = n.s ! Female; g = AFem; n = Sg} ;
lin FullName gn sn = {
s = \\c => gn.s ! Nom ++ sn.s ! c ;
g = gn.g ;
s = \\c => gn.s ! Nom ++ sn.s ! gn.g ! c ;
g = sex2agender gn.g ;
n = Sg
} ;
+41
View File
@@ -16,6 +16,9 @@ oper
feminine = AFem;
neuter = ANeut;
male = Male ;
female = Female ;
singular : Number = Sg ;
dual : Number = Dl ;
plural : Number = Pl ;
@@ -200,6 +203,44 @@ oper
};
} ;
mkGN = overload {
mkGN : Str -> Sex -> GN =
\s,g -> lin GN {
s = \\_ => s ;
g = g
};
mkGN : (_,_,_,_,_,_ : Str) -> Sex -> GN =
\nom,gen,dat,acc,loc,instr,g -> lin GN {
s = table {
Nom => nom;
Gen => gen;
Dat => dat;
Acc => acc;
Loc => loc;
Instr => instr
};
g = g
};
} ;
mkSN = overload {
mkSN : Str -> SN =
\s -> lin SN {
s = \\_,_ => s
};
mkPN : (_,_,_,_,_,_ : Str) -> SN =
\nom,gen,dat,acc,loc,instr -> lin SN {
s = \\_ => table {
Nom => nom;
Gen => gen;
Dat => dat;
Acc => acc;
Loc => loc;
Instr => instr
}
};
} ;
mkV = overload {
mkV : (inf : Str) -> V = \v -> regV v (dp 2 v) ;
mkV : (inf,stem : Str) -> V = regV ;
+7
View File
@@ -4,6 +4,7 @@ param
Case = Nom | Gen | Dat | Acc | Loc | Instr;
Number = Sg | Dl | Pl ;
Gender = Masc | Fem | Neut ;
Sex = Male | Female ;
Person = P1 | P2 | P3 ;
Species = Indef | Def ;
Animacy = Animate | Inanimate ;
@@ -180,4 +181,10 @@ oper
Neut => ANeut
} ;
sex2agender : Sex -> AGender = \g ->
case g of {
Male => AMasc Animate ;
Female => AFem
} ;
}