1
0
forked from GitHub/gf-rgl

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

@@ -83,6 +83,9 @@ concrete CatAfr 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

@@ -29,9 +29,9 @@ lin
} ;
InflectionLN = \ln -> {
t = "ln" ;
t = "pn" ;
s1 = heading1 "Naam" ;
s2 = paragraph (ln.s ! NPNom)
s2 = paragraph (ln.s ! Strong ! NPNom)
} ;
InflectionGN = \pn -> {
@@ -43,7 +43,7 @@ lin
InflectionSN = \pn -> {
t = "van" ;
s1 = heading1 "Van" ;
s2 = paragraph (pn.s ! NPNom)
s2 = paragraph (pn.s ! Male ! NPNom)
} ;
InflectionA, InflectionA2 = \adj ->

View File

@@ -1,9 +1,40 @@
concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in {
lin GivenName, MaleSurname, FemaleSurname = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ;
lin FullName gn sn =
{s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ;
lin GivenName = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ;
lin MaleSurname = \n -> {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ;
lin FemaleSurname = \n -> {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ;
lin PlSurname = \n -> {s = n.pl ; a = agrP3 Sg ; isPron = False} ;
lin UseLN pn = {s = pn.s ; a = agrP3 Sg ; isPron = False} ;
lin FullName gn sn =
{s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ;
lin UseLN ln = {
s = \\c => case ln.hasArt of {
True => "die" ++ ln.s ! Weak ! c ;
False => ln.s ! Strong ! c
} ;
a = agrP3 ln.n ;
isPron = False
} ;
PlainLN ln = {
s = \\c => ln.s ! Strong ! c ;
a = agrP3 ln.n ;
isPron = False
} ;
InLN ln = {
s = appPrep "in" (\\c => case ln.hasArt of {
True => "die" ++ ln.s ! Weak ! c ;
False => ln.s ! Strong ! c
})
} ;
AdjLN ap ln = ln ** {
s = \\a,c =>
preOrPost ap.isPre
(ap.s ! agrAdj Neutr a (NF ln.n Nom))
(ln.s ! a ! c) ;
} ;
}

View File

@@ -73,6 +73,25 @@ oper
mkPN : Str -> PN ; -- proper name
} ;
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
@@ -205,6 +224,8 @@ oper
feminine = Neutr ;
het,neuter = Neutr ;
de,utrum = Neutr ;
male = Male ;
female = Female ;
mkA = overload {
mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ;