mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 08:58:55 -06:00
progress on the Names API
This commit is contained in:
@@ -14,6 +14,7 @@ fun
|
||||
InflectionN2 : N2 -> Inflection ;
|
||||
InflectionN3 : N3 -> Inflection ;
|
||||
InflectionPN : PN -> Inflection ;
|
||||
InflectionLN : LN -> Inflection ;
|
||||
InflectionGN : GN -> Inflection ;
|
||||
InflectionSN : SN -> Inflection ;
|
||||
InflectionA : A -> Inflection ;
|
||||
|
||||
@@ -28,6 +28,12 @@ lin
|
||||
s2 = paragraph (pn.s ! NPNom)
|
||||
} ;
|
||||
|
||||
InflectionLN = \ln -> {
|
||||
t = "ln" ;
|
||||
s1 = heading1 "Naam" ;
|
||||
s2 = paragraph (ln.s ! NPNom)
|
||||
} ;
|
||||
|
||||
InflectionGN = \pn -> {
|
||||
t = "vnm" ;
|
||||
s1 = heading1 "Voornaam" ;
|
||||
|
||||
@@ -3,4 +3,7 @@ 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 UseLN pn = {s = pn.s ; a = agrP3 Sg ; isPron = False} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,8 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, (
|
||||
N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ;
|
||||
GN = {s : Str; g : Sex} ;
|
||||
SN = {s : Sex => Str; pl : Str} ;
|
||||
LN, PN = {s : Str; gn : GenNum} ;
|
||||
LN = {s : Species => Str; c : Preposition; gn : GenNum} ;
|
||||
PN = {s : Str; gn : GenNum} ;
|
||||
|
||||
lindef
|
||||
SSlash = \s -> {s = \\_ => s; c2 = {s=""; c=Acc}};
|
||||
|
||||
@@ -92,6 +92,21 @@ lin
|
||||
s3 = ""
|
||||
} ;
|
||||
|
||||
InflectionLN = \n -> {
|
||||
t = "същ.с." ;
|
||||
s1= heading1 ("Име за Място"++
|
||||
case n.gn of {
|
||||
GSg Masc => "(м.р.)" ;
|
||||
GSg Fem => "(ж.р.)" ;
|
||||
GSg Neut => "(ср.р.)" ;
|
||||
GPl => "(мн.ч.)"
|
||||
}) ;
|
||||
s2 = paragraph (n.s ! Indef) ++
|
||||
heading1 ("Наречие") ++
|
||||
paragraph (n.c.s ++ linCase n.c.c Pos ++ n.s ! Def) ;
|
||||
s3 = ""
|
||||
} ;
|
||||
|
||||
InflectionGN = \gn -> {
|
||||
t = "същ.с.л." ;
|
||||
s1= heading1 (case gn.g of {
|
||||
|
||||
@@ -291,6 +291,17 @@ oper
|
||||
\s,gn -> {s = s; gn = gn ; lock_PN = <>} ;
|
||||
} ;
|
||||
|
||||
mkLN = overload {
|
||||
mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = GSg Masc} ;
|
||||
mkLN : Str -> Gender -> LN =
|
||||
\s,g -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = GSg g} ;
|
||||
mkLN : Str -> GenNum -> LN =
|
||||
\s,gn -> lin LN {s = \\_ => s; c = {s = vyv_Str; c = CPrep}; gn = gn} ;
|
||||
mkLN : Str -> Str -> GenNum -> LN =
|
||||
\s1,s2,gn -> lin LN {s = table Species [s2; s1]; c = {s = vyv_Str; c = CPrep}; gn = gn} ;
|
||||
} ;
|
||||
|
||||
prepLN : LN -> Prep -> LN = \n,p -> n ** {c = p} ;
|
||||
|
||||
--2 IAdv
|
||||
--
|
||||
|
||||
@@ -36,4 +36,21 @@ lin FullName gn sn = {
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
|
||||
lin UseLN, PlainLN = \n -> {
|
||||
s = table { RObj c => linCase c Pos ++ n.s ! Def ;
|
||||
_ => n.s ! Def
|
||||
} ;
|
||||
gn = n.gn ;
|
||||
p = NounP3 Pos
|
||||
} ;
|
||||
|
||||
InLN n = {s = n.c.s ++ linCase n.c.c Pos ++ n.s ! Def} ;
|
||||
|
||||
AdjLN ap n = n ** {
|
||||
s = \\sp => case ap.isPre of {
|
||||
True => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ;
|
||||
False => n.s ! sp ++ ap.s ! aform n.gn sp RSubj ! P3
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -859,4 +859,9 @@ resource ResBul = ParamX ** open Prelude, Predef in {
|
||||
Female => Fem
|
||||
} ;
|
||||
|
||||
vyv_Str : Str
|
||||
= pre { "в" ;
|
||||
"във" / strs {"в" ; "ф" ; "В" ; "Ф"}
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,9 +44,7 @@ concrete StructuralBul of Structural = CatBul **
|
||||
if_Subj = ss "ако" ;
|
||||
in8front_Prep = mkPrep "пред" ;
|
||||
i_Pron = mkPron "аз" "мой" "моя" "моят" "моя" "моята" "мое" "моето" "мои" "моите" (GSg Masc) PronP1 ;
|
||||
in_Prep = mkPrep (pre { "в" ;
|
||||
"във" / strs {"в" ; "ф" ; "В" ; "Ф"}
|
||||
}) ;
|
||||
in_Prep = mkPrep vyv_Str ;
|
||||
it_Pron = mkPron "то" "негов" "неговия" "неговият" "негова" "неговата" "негово" "неговото" "негови" "неговите" (GSg Neut) PronP3 ;
|
||||
less_CAdv = X.mkCAdv "по-малко" "от" ;
|
||||
many_Det = mkDeterminerPl "много" ;
|
||||
|
||||
@@ -117,6 +117,12 @@ lin
|
||||
s2 = n.s
|
||||
} ;
|
||||
|
||||
InflectionLN = \n -> {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Location Name" ;
|
||||
s2 = n.s
|
||||
} ;
|
||||
|
||||
InflectionGN = \n -> {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Given Name" ;
|
||||
|
||||
@@ -6,4 +6,6 @@ lin FullName gn sn = {
|
||||
det = []
|
||||
} ;
|
||||
|
||||
lin UseLN pn = pn ** {det = []} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@ lin GivenName, MaleSurname, FemaleSurname = \n -> noMerge ** {s = n.s ; a = agrP
|
||||
lin FullName gn sn =
|
||||
noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! c ; a = agrP3 Sg ; isPron = False} ;
|
||||
|
||||
lin UseLN pn = noMerge ** {s = pn.s ; a = agrP3 Sg ; isPron = False} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in {
|
||||
LN = {s : Case => Str;
|
||||
p : Str; -- preposition "in Scandinavia", "on the Balkans"
|
||||
art : Bool; -- plain name "United States" vs "the United States"
|
||||
a : Agr;
|
||||
n : Number;
|
||||
} ;
|
||||
|
||||
lindef
|
||||
|
||||
@@ -38,6 +38,23 @@ lin
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionLN = \n -> {
|
||||
t = "ln" ;
|
||||
s1 = heading1 ("Location Name" ++
|
||||
case n.n of {
|
||||
Sg => "";
|
||||
Pl => "(plural)"
|
||||
}) ;
|
||||
s2 = frameTable (
|
||||
tr (th "nom" ++ th "gen") ++
|
||||
tr (td (n.s ! Nom) ++ td (n.s ! Gen))
|
||||
) ++
|
||||
heading1 ("Adverb") ++
|
||||
paragraph (n.p ++ case n.art of {
|
||||
True => "the" ++ n.s ! Nom ;
|
||||
False => n.s ! Nom}) ;
|
||||
} ;
|
||||
|
||||
InflectionGN = \pn -> {
|
||||
t = "gn" ;
|
||||
s1 = heading1 ("Given Name" ++
|
||||
|
||||
@@ -9,12 +9,12 @@ lin UseLN n = {
|
||||
True => "the" ++ n.s ! npcase2case c ;
|
||||
False => n.s ! npcase2case c
|
||||
} ;
|
||||
a = n.a
|
||||
a = agrP3 n.n
|
||||
} ;
|
||||
|
||||
lin PlainLN n = {
|
||||
s = \\c => n.s ! npcase2case c ;
|
||||
a = n.a
|
||||
a = agrP3 n.n
|
||||
} ;
|
||||
|
||||
lin InLN n = {
|
||||
@@ -25,7 +25,7 @@ lin InLN n = {
|
||||
} ;
|
||||
|
||||
lin AdjLN ap n = n ** {
|
||||
s = \\c => preOrPost ap.isPre (ap.s ! n.a) (n.s ! c) ;
|
||||
s = \\c => preOrPost ap.isPre (ap.s ! agrP3 n.n) (n.s ! c) ;
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -135,13 +135,13 @@ oper
|
||||
lin LN {s = table {Gen => s + "'s" ; _ => s} ;
|
||||
p = "in" ;
|
||||
art = False ;
|
||||
a = agrP3 Sg} ;
|
||||
n = Sg} ;
|
||||
|
||||
mkLN : Str -> Number -> LN = \s,n ->
|
||||
lin LN {s = table {Gen => s + "'s" ; _ => s} ;
|
||||
p = "in" ;
|
||||
art = False ;
|
||||
a = agrP3 n} ;
|
||||
n = n} ;
|
||||
} ;
|
||||
|
||||
defLN : LN -> LN = \n -> n ** {art = True} ;
|
||||
|
||||
@@ -11,4 +11,10 @@ lin FullName gn sn = emptyNP ** {
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
lin UseLN pn = emptyNP ** {
|
||||
s = \\c => pn.s ! npform2case Sg c ;
|
||||
a = agrP3 Sg ;
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,12 @@ lin
|
||||
s2 = inflPN (\c -> pn.s ! c)
|
||||
} ;
|
||||
|
||||
InflectionLN = \pn -> {
|
||||
t = "s" ;
|
||||
s1 = heading1 (heading noun_Category) ;
|
||||
s2 = inflPN (\c -> pn.s ! c)
|
||||
} ;
|
||||
|
||||
InflectionGN = \pn -> {
|
||||
t = "s" ;
|
||||
s1 = heading1 "Etunimi" ;
|
||||
|
||||
@@ -11,4 +11,10 @@ lin FullName gn sn = {
|
||||
isPron = False ; isNeg = False
|
||||
} ;
|
||||
|
||||
lin UseLN pn = {
|
||||
s = snoun2np Sg pn ;
|
||||
a = agrP3 Sg ;
|
||||
isPron = False ; isNeg = False
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ lin PlainLN n = heavyNP {
|
||||
a = {g = n.g ; n = n.num ; p = P3}
|
||||
} ;
|
||||
|
||||
|
||||
lin UseLN n = heavyNP {
|
||||
s = \\c => case n.art of {
|
||||
AlwaysArt | UseArt => artDef True n.g n.num c ++ n.s ;
|
||||
|
||||
@@ -151,7 +151,7 @@ oper
|
||||
|
||||
defLN : LN -> LN = \n -> n ** {art = AlwaysArt} ;
|
||||
useDefLN : LN -> LN = \n -> n ** {art = UseArt} ;
|
||||
prepLN : LN -> Compl -> LN = \n,s -> n ** {p = s} ;
|
||||
prepLN : LN -> Prep -> LN = \n,p -> n ** {p = p} ;
|
||||
|
||||
mkPN : overload {
|
||||
mkPN : Str -> PN ; -- feminine if ends with "e", otherwise masculine
|
||||
|
||||
@@ -35,4 +35,11 @@ lin FullName gn sn = {
|
||||
rc, ext = []
|
||||
} ;
|
||||
|
||||
lin UseLN pn = {
|
||||
s = \\c => usePrepC c (\k -> pn.s ! k) ;
|
||||
a = agrgP3 pn.g pn.n ;
|
||||
w = WLight ;
|
||||
rc, ext = []
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,4 +6,6 @@ lin FullName gn sn = {
|
||||
p = gn.p
|
||||
} ;
|
||||
|
||||
UseLN pn = pn ;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,4 +13,11 @@ lin FullName gn sn = {
|
||||
isDefn = False
|
||||
} ;
|
||||
|
||||
lin UseLN pn = {
|
||||
s = \\c => pn.s ;
|
||||
a = pn.a ;
|
||||
isPron = False ;
|
||||
isDefn = False ;
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,25 @@ lin
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionLN = \pn -> {
|
||||
t = "im" ;
|
||||
s1 = heading1 ("Imię" ++ case pn.gn of {
|
||||
MascPersSg|MascAniSg|MascInaniSg|MascPersPl => "(męskorzeczowy)";
|
||||
FemSg => "(żeński)";
|
||||
NeutSg => "(nijaki)";
|
||||
_ => ""
|
||||
}) ;
|
||||
s2 = frameTable (
|
||||
tr (th "mianownik" ++ td (pn.nom)) ++
|
||||
tr (th "dopełniacz" ++ td (pn.dep ! GenPrep)) ++
|
||||
tr (th "celownik" ++ td (pn.dep ! DatPrep)) ++
|
||||
tr (th "biernik" ++ td (pn.dep ! AccPrep)) ++
|
||||
tr (th "narzędnik" ++ td (pn.dep ! InstrC)) ++
|
||||
tr (th "miejscownik" ++ td (pn.dep ! LocPrep)) ++
|
||||
tr (th "wołacz" ++ td (pn.voc))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionGN = \pn -> {
|
||||
t = "im" ;
|
||||
s1 = heading1 ("Imię" ++ case pn.gn of {
|
||||
|
||||
@@ -9,4 +9,6 @@ lin FullName gn sn = {
|
||||
p = gn.p
|
||||
} ;
|
||||
|
||||
lin UseLN n = n;
|
||||
|
||||
}
|
||||
|
||||
@@ -31,4 +31,19 @@ lin FullName gn sn = -- KA: guessed
|
||||
indForm = gn.s ! No ++ sn.s ! No
|
||||
} ;
|
||||
|
||||
lin UseLN pn = let
|
||||
g = pn.g ;
|
||||
n = pn.n ;
|
||||
ag = agrP3 g n ;
|
||||
hc = getClit pn.a
|
||||
in {
|
||||
s = \\c => {comp = pn.s ! c ;
|
||||
clit = \\cs => if_then_Str hc ((genCliticsCase ag c).s ! cs) [] } ;
|
||||
|
||||
a = ag;
|
||||
nForm = if_then_else NForm hc HasClit (HasRef False) ;
|
||||
isPronoun = False ; isPol = False;
|
||||
indForm = pn.s ! No
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -22,4 +22,10 @@ lin FullName gn sn =
|
||||
a=Ag (gennum gn.g Sg) P3
|
||||
} ;
|
||||
|
||||
UseLN pn = {
|
||||
s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ;
|
||||
pron=False;
|
||||
a=Ag (gennum pn.g Sg) P3
|
||||
} ; -- Does NP need animacy?
|
||||
|
||||
}
|
||||
|
||||
@@ -108,7 +108,8 @@ incomplete concrete CatScand of Cat =
|
||||
-- {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
N2 = Noun ** {c2 : Complement} ;
|
||||
N3 = Noun ** {c2,c3 : Complement} ;
|
||||
GN, SN, LN, PN = {s : Case => Str ; g : Gender} ;
|
||||
LN = {s : Case => Str ; c : Complement ; g : Gender ; n : Number} ;
|
||||
GN, SN, PN = {s : Case => Str ; g : Gender} ;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,4 +21,10 @@ lin FullName gn sn = {
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
lin UseLN pn = {
|
||||
s = pn.s;
|
||||
a = {g=agender2gender pn.g; n=pn.n; p=P3};
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -15,4 +15,11 @@ lin FullName gn sn = {
|
||||
empty = [] ;
|
||||
} ;
|
||||
|
||||
UseLN pn = pn ** {
|
||||
s = \\c => pn.s ;
|
||||
isPron = False ;
|
||||
st = Definite ;
|
||||
empty = [] ;
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -155,6 +155,7 @@ 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"
|
||||
|
||||
@@ -32,16 +32,18 @@ lin
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionPN = \pn -> {
|
||||
InflectionLN = \n -> {
|
||||
t = "nm" ;
|
||||
s1 = heading1 ("Namn" ++ case pn.g of {
|
||||
s1 = heading1 ("Platsnamn" ++ case n.g of {
|
||||
Utr => "(utr)" ;
|
||||
Neutr => "(neutr)"
|
||||
}) ;
|
||||
s2 = frameTable (
|
||||
tr (th "nom" ++ td (pn.s ! Nom)) ++
|
||||
tr (th "gen" ++ td (pn.s ! Gen))
|
||||
)
|
||||
tr (th "nom" ++ td (n.s ! Nom)) ++
|
||||
tr (th "gen" ++ td (n.s ! Gen))
|
||||
) ++
|
||||
heading1 ("Adverb") ++
|
||||
paragraph (n.c.s ++ n.s ! caseNP accusative) ;
|
||||
} ;
|
||||
|
||||
InflectionGN = \pn -> {
|
||||
|
||||
@@ -11,4 +11,12 @@ lin FullName gn sn = {
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
UseLN, PlainLN = \n -> {
|
||||
s = \\c => n.s ! caseNP c ;
|
||||
a = agrP3 n.g n.n ;
|
||||
isPron = False
|
||||
} ;
|
||||
|
||||
InLN n = {s = n.c.s ++ n.s ! caseNP accusative} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -154,6 +154,14 @@ oper
|
||||
|
||||
geoPN : Str -> PN ; -- neuter, with identical genitive if ends in a vowel
|
||||
|
||||
mkLN = overload {
|
||||
mkLN : Str -> LN = \s -> lin LN (regPN s) ** {c={s="i";hasPrep=True}; n=Sg}; -- default gender utrum
|
||||
mkLN : Str -> Gender -> LN = \s,g -> lin LN (regGenPN s g) ** {c={s="i";hasPrep=True}; n=Sg} ; -- set other gender
|
||||
mkLN : Str -> Gender -> Number -> LN = \s,g,n -> lin LN (regGenPN s g) ** {c={s="i";hasPrep=True}; n=n} ; -- set other gender
|
||||
} ;
|
||||
|
||||
prepLN : LN -> Prep -> LN = \n,p -> n ** {c = mkComplement p.s} ;
|
||||
|
||||
--2 Adjectives
|
||||
|
||||
-- Adjectives need one to seven forms.
|
||||
|
||||
@@ -16,4 +16,10 @@ lin FullName gn sn = {
|
||||
a = {n = Sg; p = P3}
|
||||
} ;
|
||||
|
||||
lin UsePN pn = {
|
||||
s = \\c => pn.s ! c;
|
||||
h = pn.h;
|
||||
a = {n = pn.n; p = P3}
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user