mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-17 23:30:14 -06:00
the names API in more languages
This commit is contained in:
@@ -40,6 +40,42 @@ lin
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionPN = \pn -> {
|
||||
t = "pn" ;
|
||||
s1 = heading1 ("Nombre Proprio" ++
|
||||
case pn.g of {
|
||||
Masc => "("+heading masculine_Parameter+")" ;
|
||||
Fem => "("+heading feminine_Parameter+")"
|
||||
}) ;
|
||||
s2 = pn.s
|
||||
} ;
|
||||
|
||||
InflectionGN = \gn -> {
|
||||
t = "pn" ;
|
||||
s1 = heading1 ("Nombre de Pila" ++
|
||||
case gn.g of {
|
||||
Masc => "("+heading masculine_Parameter+")" ;
|
||||
Fem => "("+heading feminine_Parameter+")"
|
||||
}) ;
|
||||
s2 = gn.s
|
||||
} ;
|
||||
|
||||
InflectionSN = \sn -> {
|
||||
t = "sn" ;
|
||||
s1 = heading1 "Apellido" ;
|
||||
s2 = sn.s ! Masc
|
||||
} ;
|
||||
|
||||
InflectionLN = \ln -> {
|
||||
t = "nl" ;
|
||||
s1 = heading1 ("Nombre del Lugar" ++
|
||||
case ln.g of {
|
||||
Masc => "("+heading masculine_Parameter+")" ;
|
||||
Fem => "("+heading feminine_Parameter+")"
|
||||
}) ;
|
||||
s2 = paragraph ln.s
|
||||
} ;
|
||||
|
||||
InflectionA, InflectionA2 = \adj -> {
|
||||
t = "a" ;
|
||||
s1 = heading1 (nounHeading adjective_Category).s ;
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
concrete NamesSpa of Names = CatSpa ** open Prelude, ResSpa, CommonRomance in {
|
||||
|
||||
lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> pn2np n ;
|
||||
lin GivenName = \n -> pn2np n ;
|
||||
lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ;
|
||||
lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ;
|
||||
lin PlSurname = \n -> heavyNPpol False {
|
||||
s = \\c => prepCase c ++ n.pl ;
|
||||
a = agrP3 Masc Pl
|
||||
} ;
|
||||
lin FullName gn sn = pn2np {
|
||||
s = gn.s ++ sn.s ;
|
||||
s = gn.s ++ sn.s ! gn.g ;
|
||||
g = gn.g
|
||||
} ;
|
||||
|
||||
@@ -30,18 +36,19 @@ lin UseLN n = heavyNP {
|
||||
|
||||
|
||||
lin InLN n = {
|
||||
s = n.p.s ++ case n.art of {
|
||||
UseArt => case n.g of {
|
||||
Fem => case n.num of {
|
||||
Sg => "la" ++ n.s;
|
||||
Pl => "las" ++ n.s} ;
|
||||
Masc => case n.num of {
|
||||
Sg => "el" ++ n.s;
|
||||
Pl => "los" ++ n.s
|
||||
}
|
||||
} ;
|
||||
NoArt => n.s
|
||||
} ;
|
||||
s = "en" ++
|
||||
case n.art of {
|
||||
UseArt => case n.g of {
|
||||
Fem => case n.num of {
|
||||
Sg => "la" ++ n.s;
|
||||
Pl => "las" ++ n.s} ;
|
||||
Masc => case n.num of {
|
||||
Sg => "el" ++ n.s;
|
||||
Pl => "los" ++ n.s
|
||||
}
|
||||
} ;
|
||||
NoArt => n.s
|
||||
} ;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -137,17 +137,38 @@ oper
|
||||
-- Proper names need a string and a gender.
|
||||
-- The default gender is feminine for names ending with "a", otherwise masculine.
|
||||
|
||||
mkPN : overload {
|
||||
mkPN : (Anna : Str) -> PN ; -- feminine for "-a"
|
||||
mkPN : (Pilar : Str) -> Gender -> PN ; -- force gender
|
||||
mkPN : N -> PN ; -- gender from noun
|
||||
} ;
|
||||
|
||||
mkGN = overload {
|
||||
mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine
|
||||
mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender
|
||||
} ;
|
||||
|
||||
mkSN = overload {
|
||||
mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ;
|
||||
mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ;
|
||||
} ;
|
||||
|
||||
mkLN = overload {
|
||||
mkLN : Str -> LN = \s ->
|
||||
lin LN {s = s ;
|
||||
onPrep = False ;
|
||||
art = NoArt ;
|
||||
g = Masc ;
|
||||
num = Sg} ;
|
||||
mkLN : Str -> Gender -> LN = \s,g ->
|
||||
lin LN {s = s ;
|
||||
p = {s = "en"; c = Nom; isDir = True} ;
|
||||
onPrep = False ;
|
||||
art = NoArt ;
|
||||
g = g ;
|
||||
num = Sg} ;
|
||||
|
||||
mkLN : Str -> Gender -> Number -> LN = \s,g,num ->
|
||||
lin LN {s = s ;
|
||||
p = {s = "en"; c = Nom; isDir = True} ;
|
||||
onPrep = False ;
|
||||
art = NoArt ;
|
||||
g = g ;
|
||||
num = num} ;
|
||||
@@ -155,14 +176,6 @@ oper
|
||||
|
||||
|
||||
defLN : LN -> LN = \n -> n ** {art = UseArt} ;
|
||||
prepLN : LN -> Prep -> LN = \n,p -> n ** {p = p} ;
|
||||
|
||||
mkPN : overload {
|
||||
mkPN : (Anna : Str) -> PN ; -- feminine for "-a"
|
||||
mkPN : (Pilar : Str) -> Gender -> PN ; -- force gender
|
||||
mkPN : N -> PN ; -- gender from noun
|
||||
} ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
@@ -350,8 +363,8 @@ oper
|
||||
Gender = MorphoSpa.Gender ;
|
||||
Number = MorphoSpa.Number ;
|
||||
CopulaType = DiffSpa.CopulaType ;
|
||||
masculine = Masc ;
|
||||
feminine = Fem ;
|
||||
masculine, male = Masc ;
|
||||
feminine, female = Fem ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
serCopula = DiffSpa.serCopula ;
|
||||
|
||||
Reference in New Issue
Block a user