forked from GitHub/gf-rgl
started a separate module for names
This commit is contained in:
@@ -107,6 +107,11 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in {
|
||||
N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ;
|
||||
N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ;
|
||||
GN, SN, PN = {s : Case => Str ; g : Gender} ;
|
||||
LN = {s : Case => Str;
|
||||
p : Str; -- preposition "in Scandinavia", "on the Balkans"
|
||||
art : Bool; -- plain name "United States" vs "the United States"
|
||||
a : Agr;
|
||||
} ;
|
||||
|
||||
lindef
|
||||
SSlash = \s -> {s = s; c2 = ""} ;
|
||||
|
||||
@@ -474,13 +474,6 @@ lin CardCNCard card cn =
|
||||
lin theyFem_Pron = mkPron "they" "them" "their" "theirs" plural P3 feminine ;
|
||||
lin theyNeutr_Pron = mkPron "they" "them" "their" "theirs" plural P3 nonhuman ;
|
||||
|
||||
lin GivenName gn = gn ;
|
||||
lin MaleSurname, FemaleSurname = \sn -> sn ;
|
||||
lin FullName gn sn = {
|
||||
s = \\c => gn.s ! Nom ++ sn.s ! c ;
|
||||
g = gn.g
|
||||
} ;
|
||||
|
||||
lin AnaphPron np =
|
||||
case np.a of {
|
||||
AgP1 Sg => i_Pron ;
|
||||
|
||||
@@ -14,7 +14,8 @@ concrete GrammarEng of Grammar =
|
||||
TextX - [Pol,PPos,PNeg,SC,CAdv],
|
||||
StructuralEng,
|
||||
IdiomEng,
|
||||
TenseX - [Pol,PPos,PNeg,SC,CAdv]
|
||||
TenseX - [Pol,PPos,PNeg,SC,CAdv],
|
||||
NamesEng
|
||||
** open ResEng, Prelude in {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
31
src/english/NamesEng.gf
Normal file
31
src/english/NamesEng.gf
Normal file
@@ -0,0 +1,31 @@
|
||||
concrete NamesEng of Names = CatEng ** open Prelude, ResEng in {
|
||||
|
||||
lin GivenName gn = {s = \\c => gn.s ! npcase2case c ; a = agrgP3 Sg gn.g} ;
|
||||
lin MaleSurname, FemaleSurname = \sn -> {s = \\c => sn.s ! npcase2case c ; a = agrgP3 Sg sn.g} ;
|
||||
lin FullName gn sn = {s = \\c => gn.s ! Nom ++ sn.s ! npcase2case c ; a = agrgP3 Sg gn.g} ;
|
||||
|
||||
lin UseLN n = {
|
||||
s = \\c => case n.art of {
|
||||
True => "the" ++ n.s ! npcase2case c ;
|
||||
False => n.s ! npcase2case c
|
||||
} ;
|
||||
a = n.a
|
||||
} ;
|
||||
|
||||
lin PlainLN n = {
|
||||
s = \\c => n.s ! npcase2case c ;
|
||||
a = n.a
|
||||
} ;
|
||||
|
||||
lin InLN n = {
|
||||
s = n.p ++ case n.art of {
|
||||
True => "the" ++ n.s ! Nom ;
|
||||
False => n.s ! Nom
|
||||
} ;
|
||||
} ;
|
||||
|
||||
lin AdjLN ap n = n ** {
|
||||
s = \\c => preOrPost ap.isPre (ap.s ! n.a) (n.s ! c) ;
|
||||
} ;
|
||||
|
||||
}
|
||||
@@ -129,6 +129,24 @@ oper
|
||||
--
|
||||
-- Proper names, with a regular genitive, are formed from strings.
|
||||
|
||||
oper
|
||||
mkLN = overload {
|
||||
mkLN : Str -> LN = \s ->
|
||||
lin LN {s = table {Gen => s + "'s" ; _ => s} ;
|
||||
p = "in" ;
|
||||
art = False ;
|
||||
a = agrP3 Sg} ;
|
||||
|
||||
mkLN : Str -> Number -> LN = \s,n ->
|
||||
lin LN {s = table {Gen => s + "'s" ; _ => s} ;
|
||||
p = "in" ;
|
||||
art = False ;
|
||||
a = agrP3 n} ;
|
||||
} ;
|
||||
|
||||
defLN : LN -> LN = \n -> n ** {art = True} ;
|
||||
prepLN : LN -> Str -> LN = \n,s -> n ** {p = s} ;
|
||||
|
||||
mkPN : overload {
|
||||
|
||||
mkPN : Str -> PN ;
|
||||
|
||||
Reference in New Issue
Block a user