mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-06-15 01:50:12 -06:00
the names API in more languages
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
concrete CatRus of Cat = CommonX ** open ResRus, Prelude in {
|
||||
flags coding=utf8 ; optimize=all ;
|
||||
lincat
|
||||
N, GN, SN, LN, PN = ResRus.NounForms ;
|
||||
N, PN = ResRus.NounForms ;
|
||||
GN = {
|
||||
s : Case => Str ;
|
||||
g : Sex ;
|
||||
} ;
|
||||
SN = {
|
||||
s : Sex => Case => Str ;
|
||||
p : Case => Str ;
|
||||
} ;
|
||||
LN = {
|
||||
s : Case => Str ;
|
||||
g : Gender ;
|
||||
n : Number ;
|
||||
anim : Animacy
|
||||
} ;
|
||||
N2 = ResRus.Noun2Forms ;
|
||||
N3 = ResRus.Noun3Forms ;
|
||||
|
||||
@@ -105,7 +119,7 @@ lincat
|
||||
linref
|
||||
N = \s -> s.snom ;
|
||||
PN = \s -> s.snom ;
|
||||
LN = \s -> s.snom ;
|
||||
LN = \s -> s.s ! Nom ;
|
||||
Pron = \s -> s.nom ;
|
||||
N2 = \s -> s.snom ++ s.c2.s ;
|
||||
N3 = \s -> s.snom ++ s.c2.s ++ s.c3.s ;
|
||||
|
||||
@@ -26,13 +26,79 @@ oper
|
||||
|
||||
lin
|
||||
InflectionN, InflectionN2, InflectionN3 = \noun -> {
|
||||
t = "s" ;
|
||||
t = "сущ." ;
|
||||
s1 = heading1 (heading noun_Category) ;
|
||||
s2 = inflNoun noun
|
||||
} ;
|
||||
|
||||
InflectionPN = \pn -> {
|
||||
t = "сущ.с." ;
|
||||
s1 = heading1 "Существительное Собственное" ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading nominative_Parameter) ++ td (pn.snom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ td (pn.sgen)) ++
|
||||
tr (th (heading dative_Parameter) ++ td (pn.sdat)) ++
|
||||
tr (th (heading accusative_Parameter) ++ td (pn.sacc)) ++
|
||||
tr (th ("творительный") ++ td (pn.sins)) ++
|
||||
tr (th ("предложный") ++ td (pn.sprep)) ++
|
||||
tr (th (heading partitive_Parameter) ++ td (pn.sptv)) ++
|
||||
tr (th ("местный") ++ td (pn.sloc)) ++
|
||||
tr (th ("звательный") ++ td (pn.svoc))
|
||||
) ;
|
||||
} ;
|
||||
|
||||
InflectionGN = \gn -> {
|
||||
t = "сущ.с." ;
|
||||
s1 = heading1 "Личное Имя" ;
|
||||
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)) ++
|
||||
tr (th ("творительный") ++ td (gn.s ! Ins)) ++
|
||||
tr (th ("предложный") ++ td (gn.s ! Pre)) ++
|
||||
tr (th (heading partitive_Parameter) ++ td (gn.s ! Ptv)) ++
|
||||
tr (th ("местный") ++ td (gn.s ! Loc)) ++
|
||||
tr (th ("звательный") ++ td (gn.s ! VocRus))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionSN = \sn -> {
|
||||
t = "сущ.с." ;
|
||||
s1 = heading1 "Фамилия" ;
|
||||
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)) ++
|
||||
tr (th ("творительный") ++ td (sn.s ! Male ! Ins)) ++
|
||||
tr (th ("предложный") ++ td (sn.s ! Male ! Pre)) ++
|
||||
tr (th (heading partitive_Parameter) ++ td (sn.s ! Male ! Ptv)) ++
|
||||
tr (th ("местный") ++ td (sn.s ! Male ! Loc)) ++
|
||||
tr (th ("звательный") ++ td (sn.s ! Male ! VocRus))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionLN = \ln -> {
|
||||
t = "сущ.с." ;
|
||||
s1 = heading1 "Название Местоположения" ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading nominative_Parameter) ++ td (ln.s ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ td (ln.s ! Gen)) ++
|
||||
tr (th (heading dative_Parameter) ++ td (ln.s ! Dat)) ++
|
||||
tr (th (heading accusative_Parameter) ++ td (ln.s ! Acc)) ++
|
||||
tr (th ("творительный") ++ td (ln.s ! Ins)) ++
|
||||
tr (th ("предложный") ++ td (ln.s ! Pre)) ++
|
||||
tr (th (heading partitive_Parameter) ++ td (ln.s ! Ptv)) ++
|
||||
tr (th ("местный") ++ td (ln.s ! Loc)) ++
|
||||
tr (th ("звательный") ++ td (ln.s ! VocRus))
|
||||
) ++
|
||||
heading2 (heading adverb_Category) ++
|
||||
paragraph "adv.s"
|
||||
} ;
|
||||
|
||||
InflectionA, InflectionA2 = \adj -> {
|
||||
t = "a" ;
|
||||
t = "пр" ;
|
||||
s1 = heading1 (heading adjective_Category) ;
|
||||
s2 = heading2 (heading feminine_Parameter) ++
|
||||
inflNoun (makeNFFromAF adj Fem Inanimate) ++
|
||||
@@ -45,89 +111,89 @@ lin
|
||||
} ;
|
||||
|
||||
InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> {
|
||||
t = "adv" ;
|
||||
t = "нар" ;
|
||||
s1 = heading1 (heading adverb_Category) ;
|
||||
s2 = paragraph adv.s
|
||||
} ;
|
||||
|
||||
InflectionPrep p = {
|
||||
t = "prep" ;
|
||||
t = "пред" ;
|
||||
s1 = heading1 (heading preposition_Category) ;
|
||||
s2 = paragraph ((S.mkAdv (lin Prep p) S.it_NP).s ++ ";" ++ (S.mkAdv (lin Prep p) S.we_NP).s)
|
||||
} ;
|
||||
|
||||
InflectionV v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2 v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV3 v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2V v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (S.mkVP (L.sleep_V)))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2S v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin S {s : Mood=>Str = \\m=>"..."}))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2Q v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP (lin QS {s: QForm=>Str = \\m=>"..."}))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2A v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.we_NP L.beautiful_A)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVV vv = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP vv (S.mkVP (L.sleep_V)))) ;
|
||||
s2 = inflVerb vv.v
|
||||
} ;
|
||||
|
||||
InflectionVS v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v (lin S {s : Mood=>Str = \\m=>"..."}))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVQ v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v (lin QS {s : Mood=>Str = \\m=>"..."}))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVA v = {
|
||||
t = "v" ;
|
||||
t = "гл" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v L.beautiful_A)) ;
|
||||
s2 = inflVerb v
|
||||
|
||||
@@ -1,31 +1,54 @@
|
||||
concrete NamesRus of Names = CatRus ** open ResRus, Prelude in {
|
||||
concrete NamesRus of Names = CatRus ** open ResRus, MorphoRus, Prelude in {
|
||||
|
||||
lin GivenName, MaleSurname, FemaleSurname, PlSurname = \pn ->
|
||||
{ s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ;
|
||||
lin GivenName gn =
|
||||
{ s=gn.s ;
|
||||
pron=False;
|
||||
a=Ag (gennum pn.g Sg) P3
|
||||
a=let g = case gn.g of {
|
||||
Male => Masc ;
|
||||
Female => Fem
|
||||
}
|
||||
in Ag (gennum g Sg) P3
|
||||
} ; -- Does NP need animacy?
|
||||
lin MaleSurname sn =
|
||||
{ s=\\cas => sn.s ! Male ! cas ;
|
||||
pron=False;
|
||||
a=Ag (GSg Masc) P3
|
||||
} ; -- Does NP need animacy?
|
||||
lin FemaleSurname sn =
|
||||
{ s=\\cas => sn.s ! Female ! cas ;
|
||||
pron=False;
|
||||
a=Ag (GSg Fem) P3
|
||||
} ; -- Does NP need animacy?
|
||||
lin PlSurname sn =
|
||||
{ s=sn.p ;
|
||||
pron=False;
|
||||
a=Ag GPl P3
|
||||
} ; -- Does NP need animacy?
|
||||
|
||||
lin FullName gn sn =
|
||||
{ s= table {
|
||||
Nom => gn.snom ++ sn.snom ;
|
||||
Gen => gn.snom ++ sn.sgen ;
|
||||
Dat => gn.snom ++ sn.sdat ;
|
||||
Acc => gn.snom ++ sn.sacc ;
|
||||
Ins => gn.snom ++ sn.sins ;
|
||||
Pre => gn.snom ++ sn.sprep ;
|
||||
Loc => gn.snom ++ sn.sloc ;
|
||||
Ptv => gn.snom ++ sn.sptv ;
|
||||
VocRus => gn.snom ++ sn.svoc
|
||||
} ;
|
||||
{ s=\\cas => gn.s ! Nom ++ sn.s ! gn.g ! cas ;
|
||||
pron=False;
|
||||
a=Ag (gennum gn.g Sg) P3
|
||||
a=let g = case gn.g of {
|
||||
Male => Masc ;
|
||||
Female => Fem
|
||||
}
|
||||
in Ag (GSg g) P3
|
||||
} ;
|
||||
|
||||
UseLN pn = {
|
||||
s=\\cas => (nounFormsNoun pn).s ! Sg ! cas ;
|
||||
UseLN, PlainLN = \ln -> {
|
||||
s=\\cas => ln.s ! cas ;
|
||||
pron=False;
|
||||
a=Ag (gennum pn.g Sg) P3
|
||||
a=Ag (gennum ln.g ln.n) P3
|
||||
} ; -- Does NP need animacy?
|
||||
|
||||
InLN ln = ss (applyPrep {s=v_prep_mod; c=Loc; hasPrep=True} {
|
||||
s=ln.s ;
|
||||
pron=False;
|
||||
a=Ag (gennum ln.g ln.n) P3
|
||||
}) ; -- Does NP need animacy?
|
||||
|
||||
AdjLN ap ln = ln ** {
|
||||
s=\\cas => preOrPost (notB ap.isPost) (ap.s ! (gennum ln.g ln.n) ! ln.anim ! cas) (ln.s ! cas)
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--1 Russian Lexical Paradigms
|
||||
|
||||
resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe in {
|
||||
resource ParadigmsRus = open CatRus, ResRus, (R=ResRus), ParamRus, (Z=InflectionRus), Prelude, Maybe, MorphoRus in {
|
||||
|
||||
--2 Parameters
|
||||
--
|
||||
@@ -14,6 +14,11 @@ oper
|
||||
neuter : Gender
|
||||
= Neut ;
|
||||
|
||||
male : Sex
|
||||
= Male ;
|
||||
female : Sex
|
||||
= Female ;
|
||||
|
||||
-- Abstracting numbers. Number is a parameter for mkPN, mkConj
|
||||
singular : Number
|
||||
= Sg ;
|
||||
@@ -380,6 +385,130 @@ oper
|
||||
= \word, g, anim, zi -> lin PN (noMinorCases (Z.makeNoun word g anim (Z.parseIndex zi))) ;
|
||||
} ;
|
||||
|
||||
mkGN = overload {
|
||||
mkGN : Str -> GN
|
||||
= \nom -> let nf = guessNounForms nom
|
||||
in lin GN {
|
||||
s = (nounFormsNoun nf).s ! Sg ;
|
||||
g = case nf.g of {
|
||||
Fem => Female ;
|
||||
_ => Male
|
||||
}
|
||||
} ;
|
||||
mkGN : Str -> Sex -> GN
|
||||
= \nom, sex ->
|
||||
let g = case sex of {
|
||||
Male => Masc ;
|
||||
Female => Fem
|
||||
} ;
|
||||
nf = guessLessNounForms nom g Animate
|
||||
in lin GN {
|
||||
s = (nounFormsNoun nf).s ! Sg ;
|
||||
g = sex
|
||||
} ;
|
||||
mkGN : Str -> Sex -> Z.ZNIndex -> GN
|
||||
= \nom, sex, z ->
|
||||
let g = case sex of {
|
||||
Male => Masc ;
|
||||
Female => Fem
|
||||
} ;
|
||||
nf = noMinorCases (Z.makeNoun nom g Animate z)
|
||||
in lin GN {
|
||||
s = (nounFormsNoun nf).s ! Sg ;
|
||||
g = sex
|
||||
} ;
|
||||
mkGN : Str -> Sex -> Str -> GN
|
||||
= \nom, sex, zi ->
|
||||
let g = case sex of {
|
||||
Male => Masc ;
|
||||
Female => Fem
|
||||
} ;
|
||||
nf = noMinorCases (Z.makeNoun nom g Animate (Z.parseIndex zi))
|
||||
in lin GN {
|
||||
s = (nounFormsNoun nf).s ! Sg ;
|
||||
g = sex
|
||||
} ;
|
||||
} ;
|
||||
|
||||
mkSN = overload {
|
||||
mkSN : Str -> SN
|
||||
= \nom -> lin SN {
|
||||
s = table {
|
||||
Male => (nounFormsNoun (guessLessNounForms nom Masc Animate)).s ! Sg ;
|
||||
Female => (nounFormsNoun (guessLessNounForms nom Fem Animate)).s ! Sg
|
||||
} ;
|
||||
p = (nounFormsNoun (guessLessNounForms nom Masc Animate)).s ! Pl ;
|
||||
} ;
|
||||
mkSN : Str -> Str -> SN
|
||||
= \male,female -> lin SN {
|
||||
s = table {
|
||||
Male => (nounFormsNoun (guessLessNounForms male Masc Animate)).s ! Sg ;
|
||||
Female => (nounFormsNoun (guessLessNounForms female Fem Animate)).s ! Sg
|
||||
} ;
|
||||
p = (nounFormsNoun (guessLessNounForms male Masc Animate)).s ! Pl ;
|
||||
} ;
|
||||
mkSN : Str -> Z.ZNIndex -> Str -> Z.ZNIndex -> SN
|
||||
= \male,zm,female,zf -> lin SN {
|
||||
s = table {
|
||||
Male => (nounFormsNoun (noMinorCases (Z.makeNoun male Masc Animate zm))).s ! Sg ;
|
||||
Female => (nounFormsNoun (noMinorCases (Z.makeNoun female Masc Animate zf))).s ! Sg
|
||||
} ;
|
||||
p = (nounFormsNoun (noMinorCases (Z.makeNoun male Masc Animate zm))).s ! Pl ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
mkLN = overload {
|
||||
mkLN : Str -> LN
|
||||
= \nom -> let nf = guessNounForms nom
|
||||
in lin LN {
|
||||
s = (nounFormsNoun nf).s ! Sg ;
|
||||
anim = nf.anim ;
|
||||
c = mkPrep v_prep_mod Loc ;
|
||||
g = nf.g ;
|
||||
n = Sg
|
||||
} ;
|
||||
mkLN : Str -> Gender -> LN
|
||||
= \nom, g ->
|
||||
let nf = guessLessNounForms nom g Animate
|
||||
in lin LN {
|
||||
s = (nounFormsNoun nf).s ! Sg ;
|
||||
anim = nf.anim ;
|
||||
c = mkPrep v_prep_mod Loc ;
|
||||
g = nf.g ;
|
||||
n = Sg
|
||||
} ;
|
||||
mkLN : Str -> Gender -> Number -> LN
|
||||
= \nom, g, n ->
|
||||
let nf = guessLessNounForms nom g Animate
|
||||
in lin LN {
|
||||
s = (nounFormsNoun nf).s ! n ;
|
||||
anim = nf.anim ;
|
||||
c = mkPrep v_prep_mod Loc ;
|
||||
g = nf.g ;
|
||||
n = n
|
||||
} ;
|
||||
mkLN : Str -> Gender -> Number -> Z.ZNIndex -> LN
|
||||
= \nom, g, n, z ->
|
||||
let nf = noMinorCases (Z.makeNoun nom g Animate z)
|
||||
in lin LN {
|
||||
s = (nounFormsNoun nf).s ! n ;
|
||||
anim = nf.anim ;
|
||||
c = mkPrep v_prep_mod Loc ;
|
||||
g = nf.g ;
|
||||
n = n
|
||||
} ;
|
||||
mkLN : Str -> Gender -> Number -> Str -> LN
|
||||
= \nom, g, n, zi ->
|
||||
let nf = noMinorCases (Z.makeNoun nom g Animate (Z.parseIndex zi))
|
||||
in lin LN {
|
||||
s = (nounFormsNoun nf).s ! n ;
|
||||
anim = nf.anim ;
|
||||
c = mkPrep v_prep_mod Loc ;
|
||||
g = nf.g ;
|
||||
n = n
|
||||
} ;
|
||||
} ;
|
||||
|
||||
---------------------
|
||||
-- Adjectives
|
||||
|
||||
|
||||
Reference in New Issue
Block a user