forked from GitHub/gf-rgl
the names API in more languages
This commit is contained in:
@@ -102,7 +102,8 @@ concrete CatGer of Cat =
|
||||
N3 = ResGer.Noun ** {c2,c3 : Preposition} ;
|
||||
GN = {s : Case => Str; g : Sex} ;
|
||||
SN = {s : Sex => Case => Str} ;
|
||||
LN, PN = {s : Case => Str; g : Gender; n : Number} ;
|
||||
PN = {s : Case => Str; g : Gender; n : Number} ;
|
||||
LN = {s : Adjf => Case => Str; hasArt : Bool; g : Gender; n : Number} ;
|
||||
|
||||
-- tense with possibility to choose conjunctive forms
|
||||
|
||||
|
||||
@@ -40,6 +40,66 @@ lin
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionPN = \pn -> {
|
||||
t = "pn" ;
|
||||
s1 = heading1 ("Eigenname" ++
|
||||
"("+case <pn.g,pn.n> of {
|
||||
<Masc,Sg> => heading masculine_Parameter ;
|
||||
<Fem,Sg> => heading feminine_Parameter ;
|
||||
<Neutr,Sg> => heading neuter_Parameter ;
|
||||
<_,Pl> => heading plural_Parameter
|
||||
} ++")") ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading nominative_Parameter) ++ td (pn.s ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ td (pn.s ! Gen)) ++
|
||||
tr (th (heading dative_Parameter) ++ td (pn.s ! Dat)) ++
|
||||
tr (th (heading accusative_Parameter) ++ td (pn.s ! Acc))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionGN = \gn -> {
|
||||
t = "vn" ;
|
||||
s1 = heading1 ("Vorname" ++
|
||||
case gn.g of {
|
||||
Male => "(männlich)" ;
|
||||
Female => "(weiblich)"
|
||||
}) ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading nominative_Parameter) ++ td (gn.s ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ td (gn.s ! Gen)) ++
|
||||
tr (th (heading dative_Parameter) ++ td (gn.s ! Dat)) ++
|
||||
tr (th (heading accusative_Parameter) ++ td (gn.s ! Acc))
|
||||
) ;
|
||||
} ;
|
||||
|
||||
InflectionSN = \sn -> {
|
||||
t = "fn" ;
|
||||
s1 = heading1 ("Familienname") ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading nominative_Parameter) ++ td (sn.s ! Male ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ td (sn.s ! Male ! Gen)) ++
|
||||
tr (th (heading dative_Parameter) ++ td (sn.s ! Male ! Dat)) ++
|
||||
tr (th (heading accusative_Parameter) ++ td (sn.s ! Male ! Acc))
|
||||
) ;
|
||||
} ;
|
||||
|
||||
InflectionLN = \ln -> {
|
||||
t = "pn" ;
|
||||
s1 = heading1 ("Standortnamen" ++
|
||||
"("+case <ln.g,ln.n> of {
|
||||
<Masc,Sg> => heading masculine_Parameter ;
|
||||
<Fem,Sg> => heading feminine_Parameter ;
|
||||
<Neutr,Sg> => heading neuter_Parameter ;
|
||||
<_,Pl> => heading plural_Parameter
|
||||
} ++")") ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading nominative_Parameter) ++ td (ln.s ! Strong ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ td (ln.s ! Strong ! Gen)) ++
|
||||
tr (th (heading dative_Parameter) ++ td (ln.s ! Strong ! Dat)) ++
|
||||
tr (th (heading accusative_Parameter) ++ td (ln.s ! Strong ! Acc))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionA, InflectionA2 = \adj ->
|
||||
let
|
||||
gforms : Degree -> ResGer.Case -> Str = \d,c ->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete NamesGer of Names = CatGer ** open ResGer in {
|
||||
concrete NamesGer of Names = CatGer ** open ResGer, Prelude in {
|
||||
|
||||
lin GivenName gn = {
|
||||
s = \\c => usePrepC c (\k -> gn.s ! k) ;
|
||||
@@ -31,15 +31,40 @@ lin PlSurname sn = {
|
||||
lin FullName gn sn = {
|
||||
s = \\c => usePrepC c (\k -> gn.s ! Nom ++ sn.s ! gn.g ! k) ;
|
||||
a = agrgP3 (sex2gender gn.g) Sg ;
|
||||
w = WLight ;
|
||||
rc, ext = []
|
||||
} ;
|
||||
|
||||
lin UseLN ln = {
|
||||
s = \\c => case ln.hasArt of {
|
||||
True => artDefContr (gennum ln.g ln.n) c ++ usePrepC c (\k -> ln.s ! Weak ! k) ;
|
||||
False => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k)
|
||||
} ;
|
||||
a = agrgP3 ln.g ln.n ;
|
||||
w = WLight ;
|
||||
rc, ext = []
|
||||
} ;
|
||||
|
||||
lin UseLN pn = {
|
||||
s = \\c => usePrepC c (\k -> pn.s ! k) ;
|
||||
a = agrgP3 pn.g pn.n ;
|
||||
lin PlainLN ln = {
|
||||
s = \\c => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k) ;
|
||||
a = agrgP3 ln.g ln.n ;
|
||||
w = WLight ;
|
||||
rc, ext = []
|
||||
} ;
|
||||
|
||||
lin InLN ln = {
|
||||
s = let c = NPP CInDat
|
||||
in case ln.hasArt of {
|
||||
True => artDefContr (gennum ln.g ln.n) c ++ usePrepC c (\k -> ln.s ! Weak ! k) ;
|
||||
False => usePrepC c (\k -> ln.s ! adjfCase Strong k ! k)
|
||||
} ;
|
||||
} ;
|
||||
|
||||
lin AdjLN ap ln = ln ** {
|
||||
s = \\a,c =>
|
||||
preOrPost ap.isPre
|
||||
(ap.c.p1 ++ ap.c.p2 ++ ap.s ! agrAdj ln.g a ln.n c ++ ap.ext)
|
||||
(ln.s ! a ! c) ;
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -165,6 +165,32 @@ mkN : overload {
|
||||
mkSN : (nom,acc,dat,gen : Str) -> GN ; -- name with all case forms
|
||||
} ;
|
||||
|
||||
mkLN = overload {
|
||||
mkLN : Str -> LN = \s -> regLN s Masc ; -- regular name with genitive in "s", masculine
|
||||
mkLN : Str -> Number -> LN = \s,n -> regLN s Masc ** {n=n} ; -- regular name with genitive in "s", masculine
|
||||
mkLN : Str -> Gender -> LN = regLN ; -- regular name with genitive in "s"
|
||||
|
||||
-- If only the genitive differs, two strings are needed.
|
||||
|
||||
mkLN : (nom,gen : Str) -> Gender -> LN = mk2LN ; -- name with other genitive
|
||||
|
||||
-- In the worst case, all four forms are needed.
|
||||
|
||||
mkLN : (nom,acc,dat,gen : Str) -> Gender -> LN = \nom,acc,dat,gen,g ->
|
||||
lin LN {s = \\a => table {Nom => nom ; Acc => acc ; Dat => dat ; Gen => gen} ;
|
||||
g = g ; n = Sg ;
|
||||
hasArt = False}
|
||||
|
||||
} ;
|
||||
|
||||
defLN : LN -> LN = \n -> n ** {hasArt = True} ;
|
||||
|
||||
mk2LN : (karolus, karoli : Str) -> Gender -> LN = \karolus, karoli, g ->
|
||||
lin LN {s = \\a => table {Gen => karoli ; _ => karolus} ; g = g ; n = Sg ;
|
||||
hasArt = False} ;
|
||||
regLN : (horst : Str) -> Gender -> LN = \horst, g ->
|
||||
mk2LN horst (ifTok Tok (Predef.dp 1 horst) "s" horst (horst + "s")) g ;
|
||||
|
||||
-- To extract the number of a noun phrase
|
||||
|
||||
ifPluralNP : NP -> Bool
|
||||
|
||||
@@ -25,7 +25,6 @@ resource ResGer = ParamX ** open Prelude in {
|
||||
param
|
||||
Case = Nom | Acc | Dat | Gen ;
|
||||
Gender = Masc | Fem | Neutr ;
|
||||
Sex = Male | Female ;
|
||||
|
||||
-- Complex $CN$s, like adjectives, have strong and weak forms.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user