the names API in more languages

This commit is contained in:
Krasimir Angelov
2023-08-16 19:39:22 +02:00
parent d25d648134
commit 6bc965f6c2
69 changed files with 1584 additions and 270 deletions

View File

@@ -81,6 +81,9 @@ concrete CatDut of Cat =
N = Noun ;
N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ;
N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ;
GN, SN, LN, PN = {s : NPCase => Str} ;
PN = {s : NPCase => Str} ;
GN = {s : NPCase => Str; g : Sex} ;
SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ;
LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ;
}

View File

@@ -36,6 +36,30 @@ lin
)
} ;
InflectionPN = \pn -> {
t = "pn" ;
s1 = heading1 "Naam" ;
s2 = paragraph (pn.s ! NPNom)
} ;
InflectionLN = \ln -> {
t = "pn" ;
s1 = heading1 "Naam" ;
s2 = paragraph (ln.s ! Strong ! NPNom)
} ;
InflectionGN = \pn -> {
t = "vnm" ;
s1 = heading1 "Voornaam" ;
s2 = paragraph (pn.s ! NPNom)
} ;
InflectionSN = \pn -> {
t = "van" ;
s1 = heading1 "Van" ;
s2 = paragraph (pn.s ! Male ! NPNom)
} ;
InflectionA, InflectionA2 = \adj ->
let
gforms : AForm -> Str = \a ->
@@ -61,7 +85,7 @@ lin
InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> {
t = "adv" ;
s1 = heading1 (heading preposition_Category) ;
s1 = heading1 "Bijwoord" ;
s2 = paragraph adv.s
} ;

View File

@@ -1,9 +1,43 @@
concrete NamesDut of Names = CatDut ** open Prelude, ResDut in {
lin GivenName, MaleSurname, FemaleSurname = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ;
lin GivenName = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ;
lin MaleSurname = \n -> noMerge ** {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ;
lin FemaleSurname = \n -> noMerge ** {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ;
lin PlSurname = \n -> noMerge ** {s = n.pl ; a = agrP3 Sg ; isPron = False} ;
lin FullName gn sn =
noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ;
noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ;
lin UseLN pn = noMerge ** {s = pn.s ; a = agrP3 Sg ; isPron = False} ;
lin UseLN ln = noMerge ** {
s = \\c => case ln.hasArt of {
True => "de" ++ ln.s ! Weak ! c ;
False => ln.s ! Strong ! c
} ;
a = agrP3 ln.n ;
isPron = False
} ;
lin PlainLN ln = noMerge ** {
s = \\c => ln.s ! Strong ! c ;
a = agrP3 ln.n ;
isPron = False
} ;
lin InLN ln = {
s = "in" ++ case ln.hasArt of {
True => "de" ++ ln.s ! Weak ! NPAcc ;
False => ln.s ! Strong ! NPAcc
}
} ;
lin AdjLN ap ln = ln ** {
s = \\a,c =>
let gan : Gender*Adjf*NForm = case ap.isPre of {
True => <Utr,a,NF ln.n Nom> ;
False => <Neutr,Strong,NF Sg Nom> } ;
af = agrAdj gan.p1 gan.p2 gan.p3 ;
in preOrPost ap.isPre
(ap.s ! agrP3 Sg ! af)
(ln.s ! a ! c) ;
} ;
}

View File

@@ -76,6 +76,24 @@ oper
mkPN : N -> PN ; -- proper name from noun
} ;
mkGN = overload { -- given name
mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ;
mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ;
} ;
mkSN = overload { -- given name
mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ;
mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ;
} ;
mkLN = overload {
mkLN : Str -> LN -- location name
= \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ;
mkLN : Str -> Number -> LN -- location name
= \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ;
} ;
defLN : LN -> LN = \n -> n ** {hasArt = True} ;
--2 Adjectives
@@ -249,6 +267,10 @@ oper
de,utrum = Utr ;
nominative = Nom ;
genitive = Gen ;
male = Male ;
female = Female ;
singular = Sg ;
plural = Pl ;
mkA = overload {
mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ;