1
0
forked from GitHub/gf-rgl

Oridnal numerals added ; many fixes

This commit is contained in:
Roman Suzi
2020-08-08 20:30:28 +03:00
parent bbbe9bbb03
commit c0734bdfbb
25 changed files with 4063 additions and 427 deletions

View File

@@ -1,12 +1,12 @@
concrete AdjectiveRus of Adjective = CatRus ** open ResRus, Prelude, Coordination in {
lin
-- : A -> AP ; -- warm - тёплый
PositA a = adjFormsAdjective a ** {isPost = False} ;
PositA a = adjFormsAdjective a ** {isPost = a.p} ;
-- : A2 -> AP ; -- married
UseA2 a = adjFormsAdjective a ** {isPost = False} ;
-- : A -> AP ; -- warmer - теплее
-- : A -> AP ; -- warmer - теплее
UseComparA a = adjFormsAdjective (immutableAdjForms a.comp)
** {isPost = False; preferShort = PrefShort} ; -- TODO: non-qual
** {isPost = a.p; preferShort = PrefShort} ; -- TODO: non-qual
-- : AP -> Adv -> AP ; -- warm by nature
AdvAP ap adv = ap ** {s = \\gn,a,c => adv.s ++ ap.s ! gn ! a ! c ; isPost = False} ;
@@ -29,7 +29,7 @@ lin
} ;
-- : Ord -> AP ; -- warmest
AdjOrd ord = adjFormsAdjective ord ** {isPost = False; preferShort = PrefFull} ;
AdjOrd ord = adjFormsAdjective ord ** {isPost = False; preferShort = PreferFull} ;
-- : A2 -> NP -> AP ; -- married to him - замужем за ним (NB: gender change requires different word!)
ComplA2 a2 np = let af=adjFormsAdjective a2 in {

View File

@@ -63,7 +63,9 @@ lincat
Predet = ResRus.Adjective ** {size : NumSize} ;
IQuant = ResRus.Adjective ** {g: Gender; c: Case} ;
Quant = ResRus.Adjective ** {g: Gender; c: Case; type: DetType} ;
Num, Numeral, Card = NumDet ;
Numeral = NumeralForms ;
Num = NumDet ;
Card = NumDet ;
Digits = {s : Str ; size: NumSize} ;
QS = {s : QForm => Str} ;
@@ -99,8 +101,8 @@ linref
N = \s -> s.snom ;
PN = \s -> s.snom ;
Pron = \s -> s.nom ;
N2 = \s -> s.snom ++ s.c2.s ; -- TODO
N3 = \s -> s.snom ++ s.c2.s ++ s.c3.s ; -- TODO
N2 = \s -> s.snom ++ s.c2.s ;
N3 = \s -> s.snom ++ s.c2.s ++ s.c3.s ;
A = \s -> case s.preferShort of {PrefShort => s.sm ; _ => s.msnom} ;
A2 = \s -> case s.preferShort of {PrefShort => s.sm ; _ => s.msnom} ++ s.c.s ; -- ?
V = \s -> verbInf s ;

View File

@@ -125,7 +125,7 @@ concrete ConjunctionRus of Conjunction =
BaseCN x y = {
s1 = x.s ;
s2 = y.s ;
g = y.g ;
g = conjGender x.g y.g ;
mayben = JustPl ;
anim = conjAnim x.anim y.anim
} ;
@@ -202,6 +202,6 @@ concrete ConjunctionRus of Conjunction =
= \sfp1,sfp2 ->
case <sfp1,sfp2> of {
<PrefShort, PrefShort> => PrefShort ;
_ => PrefFull
_ => PreferFull
} ;
}

View File

@@ -7,7 +7,7 @@ concrete ConstructionRus of Construction = CatRus **
lin
hungry_VP = mkVP (P.mkA "голодный" "" "1*a/c'" PrefShort) ;
thirsty_VP = mkVP want_VV (mkVP (P.mkV Imperfective "пить" "пью" "пьёт")) ;
tired_VP = mkVP (P.mkA "усталый" "" "1*a/c'" PrefFull) ;
tired_VP = mkVP (P.mkA "усталый" "" "1*a/c'" PreferFull) ;
scared_VP = mkVP (P.mkV Imperfective "бояться" "боюсь" "боится") ; -- intran
ill_VP = mkVP ( P.mkA "больной" "" "1*b" PrefShort) ;
ready_VP = mkVP L.ready_A ;
@@ -87,9 +87,8 @@ lin
timeHour h = P.mkAdv (in_Prep.s ++ h.s) ;
-- : Hour -> Card -> Adv ; -- at six forty a.m./p.m.
timeHourMinute h card = P.mkAdv ((timeHour h).s ++ BIND ++ ":" ++ BIND ++ card.s ! Neut ! Inanimate ! Nom) ; -- TODO: ?
timeHourMinute h card = P.mkAdv ((timeHour h).s ++ BIND ++ ":" ++ BIND ++ card.s ! Neut ! Inanimate ! Nom) ; -- TODO: 00?
-- TODO: Fix the following (genders)
-- : Weekday -> Adv ; -- on Monday
weekdayPunctualAdv w = P.mkAdv (in_Prep.s ++ w.sacc) ; -- on Sunday
-- : Weekday -> Adv ; -- on Mondays
@@ -134,7 +133,7 @@ lin
++ cn.s ! numSizeNum Nom card.size ! (numSizeCase Nom card.size)) in { --? Nom?
s=\\gn,anim,cas=> ap.s!gn!anim!cas ++ as_n_units ;
short=\\a=> ap.short ! a ++ as_n_units ;
preferShort=PrefFull ;
preferShort=PreferFull ;
isPost=True
} ;
-- This does not work in Russian naturally

View File

@@ -1,5 +1,5 @@
concrete DictRus of DictRusAbs = CatRus ** open ParadigmsRus, Prelude,
ZaliznyakAlgo, -- TODO: convert to Str-based index and remove
ZaliznyakAlgo,
ResRus in {
flags optimize=values ; coding=utf8 ;
-- About 1000 most frequent nouns (source: wiktionary)

View File

@@ -140,7 +140,7 @@ oper
inflVerb : CatRus.V -> Str = \v ->
let fut : Agr=>Str = \\a => verbFutAgree v a in
let pres : Agr=>Str = \\a => verbPresAgree v a in
let past : Agr=>Str = \\a => (verbPastAgree v a "").p2 in
let past : Agr=>Str = \\a => verbPastAgree v a "" in
let imp : Agr=>Str = \\a => ((verbImperativeAgree v a).p1 ++ (verbImperativeAgree v a).p2) in
let ppp : GenNum=>Str = \\gn => shortPastPassPart v gn in
case v.asp of {Imperfective => "несовершенного вида" ; Perfective => "совершенного вида"} ++ "," ++

View File

@@ -20,17 +20,21 @@ concrete ExtendRus of Extend =
--ConjRNP, ConjVPS, ConsVPS, Cons_nr_RNP, Cons_rr_RNP, DetNPMasc, DetNPFem, EmbedPresPart, EmptyRelSlash,
ExistsNP,
-- ExistCN, ExistMassCN, ExistPluralCN,
ProDrop,
--ProDrop,
-- FocusAP, FocusAdV, FocusAdv, FocusObj, GenIP, GenModIP, GenModNP, GenNP, GenRP,
-- GerundAdv, GerundCN, GerundNP, IAdvAdv, ICompAP,
InOrderToVP,
-- MkVPS, NominalizeVPSlashNP,
-- PassAgentVPSlash, PassVPSlash, ProgrVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN,
-- PassAgentVPSlash, PassVPSlash, ProgrVPSlash,
PastPartAP,
-- PastPartAgentAP, PositAdVAdj, PredVPS, PredVPSVV, PredetRNP, PrepCN,
-- EmbedSSlash, PresPartAP,
PurposeVP,
-- ReflPoss, ReflPron, ReflRNP, SlashBareV2S, SlashV2V, StrandQuestSlash, StrandRelSlash,
PredIAdvVP
-- UncontractedNeg, UttAccIP, UttAccNP, UttAdV, UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2
PredIAdvVP,
-- UncontractedNeg, UttAccIP, UttAccNP,
UttAdV
-- UttDatIP, UttDatNP, UttVPShort, WithoutVP, BaseVPS2, ConsVPS2, ConjVPS2, ComplVPS2, MkVPS2
]
with (Grammar=GrammarRus)
** open Prelude, ResRus, ParadigmsRus, (M = MorphoRus) in {
@@ -73,8 +77,21 @@ lin
iFem_Pron = personalPron (Ag (GSg Fem) P1) ;
youFem_Pron = personalPron (Ag (GSg Fem) P2) ;
-- : N -> N -> N ;
CompoundN n1 n2 = mkCompoundN n1 "-" n2 ;
-- VPSlash -> AP ; -- lost (opportunity) ; (opportunity) lost in space
PastPartAP vps = {
s=\\gn,anim,cas => vps.adv ! (genNumAgrP3 gn)
++ (shortPastPassPart vps.verb gn) ++ vps.dep ++ vps.compl ! (genNumAgrP3 gn) ;
short=\\a => vps.adv ! a ++ (shortPastPassPart vps.verb (agrGenNum a)) ++ vps.dep ++ vps.compl ! a ++ vps.c.s ; --
isPost = False ;
preferShort=PreferFull
} ;
-- PresPartAP : VP -> AP ; -- (the man) looking at Mary
-- use PlP2 + "ый"
-- : Pron -> Pron ; -- unstressed subject pronoun becomes empty: "am tired"
ProDrop pron = {
nom,gen,dat,acc,ins,prep=[] ;
@@ -82,4 +99,7 @@ lin
poss={msnom,fsnom,nsnom,pnom,msgen,fsgen,pgen,msdat,fsacc,msins,fsins,pins,msprep=[]} ;
a=pron.a
} ;
-- : AdV -> Utt ; -- always(!)
UttAdV adv = {s=adv.s} ;
} ;

View File

@@ -3,14 +3,13 @@
concrete ExtraRus of ExtraRusAbs = CatRus **
open ResRus, MorphoRus, (P=ParadigmsRus), Prelude, NounRus in {
flags optimize=all ; coding=utf8 ;
lin
obj_no_Prep = {s="" ; c=Acc ; hasPrep=False} ;
to2_Prep = P.mkPrep "в" Acc ;
to2_Prep = P.mkPrep v_prep_mod Acc ;
on_to_Prep = P.mkPrep "до" Gen ;
along_Prep = P.mkPrep "по" Loc ;
from2_Prep = from2 ;
about_Prep = P.mkPrep "о" Pre ;
about_Prep = P.mkPrep o_prep_pre_mod Pre ;
have_V3 = P.mkV3 est_ell_V nom_Prep u_Prep;
have2_V3 = P.mkV3 est_V nom_Prep u_Prep;

View File

@@ -30,7 +30,7 @@ lin
} ;
-- : NP -> Cl ; -- there is a house
ExistNP np = {subj=np.s ! Nom ; compl="" ; verb=to_exist ; dep=[] ; adv=[] ; a=np.a} ; -- TODO: Different order?
ExistNP np = {subj=np.s ! Nom ; compl="" ; verb=to_exist ; dep=[] ; adv=[] ; a=np.a} ;
-- : IP -> QCl ; -- which houses are there
ExistIP ip = {
@@ -41,25 +41,36 @@ lin
compl=[];
a=ip.a
} ;
-- TODO: ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris
-- TODO: ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
-- : NP -> Adv -> Cl ; -- there is a house in Paris
ExistNPAdv np adv = {
subj=np.s ! Nom ;
compl="" ;
verb=to_exist ;
dep=[] ;
adv=adv.s ;
a=np.a
} ;
-- : IP -> Adv -> QCl ; -- which houses are there in Paris
ExistIPAdv ip adv = {
subj=ip.nom ; -- gen?
adv=adv.s ;
verb=to_exist;
dep=[] ;
compl=[];
a=ip.a
} ;
-- : VP -> VP ; -- be sleeping
ProgrVP vp = vp ;
-- : VP -> Utt ; -- let's go
ImpPl1 vp =
let a = Ag GPl P1 in
let pol = PPos in
let parts = verbAgr vp.verb Infinitive Pres a pol.p in -- colloquial, should be Fut, but then present fails...
let p1 = "давайте" in {
s = p1 ++ pol.s ++ vp.adv ! a ++ parts.p2 ++ vp.dep ++ vp.compl ! a
let a = Ag GPl P1 in {
s = (verbEnvAgr "давайте" (vp.adv ! a) vp.verb Infinitive Pres a PPos) ++ vp.dep ++ vp.compl ! a
} ;
-- : NP -> VP -> Utt ; -- let John walk
ImpP3 np vp =
let pol = PPos in
let parts = verbAgr vp.verb Ind Pres np.a pol.p in
let p1 = "пусть" in {
s = p1 ++ pol.s ++ vp.adv ! np.a ++ np.s ! Nom ++ parts.p2 ++ vp.dep ++ vp.compl ! np.a
} ;
ImpP3 np vp = {
s = (verbEnvAgr "пусть" (vp.adv ! np.a ++ np.s ! Nom) vp.verb Ind Pres np.a PPos) ++ vp.dep ++ vp.compl ! np.a
} ;
-- : VP -> VP ; -- is at home himself
SelfAdvVP vp = vp ** {compl=\\a => vp.compl ! a ++ (adjFormsAdjective sam).s ! agrGenNum a ! Animate ! Nom} ;

View File

@@ -12,5 +12,41 @@ oper
who_pl = doKPron "к" (Ag GPl P3) Animate ;
somebody = pronFormsPronoun ((appendToIP who_sg (BIND ++ "-то")) ** {nPrefix=False}) ;
nobody = pronFormsPronoun ((doKPron "ник" (Ag (GSg Masc) P3) Animate) ** {nPrefix=False}) ;
such = adjFormsAdjective (makeAdjectiveForms "такой" "" "3b" PrefFull) ;
such = adjFormsAdjective (makeAdjectiveForms "такой" "" "3b" PreferFull) ;
-- Situations, when prepositions are modified (approximate, full rules may be much more complex)
sconsonant : pattern Str = #(("с"|"з"|"ж"|"ш"|"С"|"З"|"Ж"|"Ш") +
("б"|"в"|"г"|"д"|"ж"|"з"|"й"|"к"|"л"|"м"|"н"|"п"|"р"|"с"|"т"|"ф"|"х"|"ц"|"ч"|"ш"|"щ" |
"Б"|"В"|"Г"|"Д"|"Ж"|"З"|"Й"|"К"|"Л"|"М"|"Н"|"П"|"Р"|"С"|"Т"|"Ф"|"Х"|"Ц"|"Ч"|"Ш"|"Щ")) ;
vconsonant : pattern Str = #(("в"|"ф"|"В"|"Ф") +
("б"|"в"|"г"|"д"|"ж"|"з"|"й"|"к"|"л"|"м"|"н"|"п"|"р"|"с"|"т"|"ф"|"х"|"ц"|"ч"|"ш"|"щ" |
"Б"|"В"|"Г"|"Д"|"Ж"|"З"|"Й"|"К"|"Л"|"М"|"Н"|"П"|"Р"|"С"|"Т"|"Ф"|"Х"|"Ц"|"Ч"|"Ш"|"Щ")) ;
s_prep_mod : Str = pre {
#sconsonant => "со" ;
("льв"|"льд"|"льн"|"лба"|"мха"|"рва"|"рта"|"лбом"|"мхом"|"рвом"|"ртом"|"мной"|"мною") => "со" ;
("вш"|"всем"|"всех"|"всей"|"всею"|"всег"|"всяк"|"всяческ"|"вторник"|"втор"|"многи"|"многом"|"многог") => "со" ;
("щ"|"Щ") => "со" ;
_ => "с"
} ;
v_prep_mod : Str = pre {#vconsonant => "во" ; ("мног"|"множ"|"все"|"весь"|"имя"|"мне") => "во" ; _ => "в"} ;
k_prep_dat_mod : Str = pre {
("льву"|"льду"|"льну"|"лбу"|"мху"|"рву"|"ржи"|"рту"|"всякому"|"всему"|"всяческому"|"вторнику"|"второму"|"многому") => "ко" ;
_ => "к"
} ;
ot_prep_gen_mod : Str = pre {
("льва"|"льда"|"льна"|"лба"|"мха"|"рва"|"ржи"|"рта") => "ото" ;
_ => "от"
} ;
pod_prep_mod : Str = pre {
("львом"|"льдом"|"льном"|"лбом"|"мхом"|"рвом"|"ртом") => "подо" ;
_ => "под"
} ;
above_prep_ins_mod : Str = pre {
("львом"|"льдом"|"льном"|"лбом"|"мхом"|"рвом"|"ртом") => "надо" ;
_ => "над"
} ;
o_prep_pre_mod : Str = pre { -- rules are approximate
("всем"|"всём"|"мне"|"всех"|"всей") => "обо" ;
("а"|"и"|"о"|"у"|"э"|"А"|"И"|"О"|"У"|"Э") => "об" ;
_ => "о"} ;
}

View File

@@ -30,7 +30,7 @@ lin
-- : Predet -> NP -> NP ; -- only the man
PredetNP predet np = np ** {s=\\cas => predet.s ! (agrGenNum np.a) ! Inanimate ! cas ++ np.s ! numSizeCase cas predet.size} ;
-- : NP -> V2 -> NP ; -- the man seen
-- : NP -> V2 -> NP ; -- the man seen
PPartNP np v2 = np ** {
s = \\cas => np.s ! cas ++ (shortPastPassPart v2 (agrGenNum np.a))
} ;
@@ -112,10 +112,15 @@ lin
NumPl = {s = \\_,_,_ => [] ; size = NumAll } ;
-- Digits -> Ord ; -- 51st
OrdDigits d = immutableAdjForms d.s ; -- TODO: better implementation
OrdDigits d = ith_forms d.s ;
-- TODO: : Numeral -> Ord ; -- fifty-first
OrdNumeral numeral = variants {} ;
-- : Numeral -> Ord ; -- fifty-first
OrdNumeral numeral = numeral.o ** {
sm,sf,sn,sp=[] ;
comp=[] ;
p=False ;
preferShort=PreferFull
} ;
-- : A -> Ord ;
OrdSuperl a = long_superlative a ;
@@ -127,7 +132,7 @@ lin
short=\\a=>[] ;
g=Neut ;
c=Nom ;
preferShort=PrefFull
preferShort=PreferFull
} ;
-- : AdN -> Card -> Card
@@ -188,7 +193,7 @@ lin
-- : Det -> NP -> NP ; -- three of them, some of the boys
CountNP det np = {
s=\\cas => det.s ! Neut ! Inanimate ! cas ++ selectCase np.s from2 ;
s=\\cas => det.s ! Neut ! Inanimate ! cas ++ applyPrep from2 np ;
pron=False ;
a=numSizeGenAgr det.size Neut P3
} ;
@@ -214,7 +219,7 @@ lin
c=Nom ;
g=Neut ;
size=Num1 ;
preferShort=PrefFull
preferShort=PreferFull
} ;
-- : Quant ; -- a (house), (houses)
IndefArt = {
@@ -224,7 +229,7 @@ lin
c=Nom ;
g=Neut ;
size=Num1 ;
preferShort=PrefFull
preferShort=PreferFull
} ;
}

View File

@@ -1,272 +1,447 @@
--# -path=.:../abstract:../common:../../prelude
concrete NumeralRus of Numeral = CatRus [Numeral,Digits] ** open ResRus, Prelude in {
concrete NumeralRus of Numeral = CatRus [Numeral,Digits] ** open ResRus, ZaliznyakAlgo, Prelude in {
flags coding=utf8 ;
-- Toiska, 13/8/2000, AR with Arto Mustajoki.
-- Nikita Frolov, 2011
lincat Digit = {s : DForm => Gender => Animacy => Case => Str ; size : NumSize} ;
lincat Sub10 = {s : Place => DForm => Gender => Animacy => Case => Str ; size : NumSize} ;
lincat Sub100 = {s : Place => Gender => Animacy => Case => Str ; size : NumSize} ;
lincat Sub1000 = {s : Place => Gender => Animacy => Case => Str ; size : NumSize} ;
lincat Sub1000000 = {s : Gender => Animacy => Case => Str ; size : NumSize} ;
lincat Digit = {s : DForm => DetTable ; size : NumSize ; o : DForm => PronForms} ;
lincat Sub10 = {s : Place => DForm => DetTable ; size : NumSize ; o : Place => DForm => PronForms ; just1 : Bool} ;
lincat Sub100 = {s : Place => DetTable ; size : NumSize ; o : Place => PronForms; just1 : Bool} ;
lincat Sub1000 = {s : Place => DetTable ; size : NumSize ; o : Place => PronForms; just1 : Bool} ;
lincat Sub1000000 = {s : DetTable ; size : NumSize ; o : PronForms; just1 : Bool} ;
-- just1 to correctly generate exactly 1000
lin num x = {s = \\ g,a,c => x.s ! g ! a ! c; n = Pl ; size = x.size};
-- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
lin num x = {
s = \\ g,a,c => x.s ! g ! a ! c ;
o = x.o ;
size = x.size
};
lin n3 =
{s = table {unit => tri ;
teen => nadsat "три" ;
ten => n2030 "три" ;
hund => sta tri} ;
size = Num2_4} ;
lin n4 =
{s = table {unit => chetyre ;
teen => nadsat "четыр" ;
ten => \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "сорок";
<(Gen|Ptv|Dat|Ins|Pre|Loc), _ > => "сорока" } ;
hund => sta chetyre } ;
size = Num2_4} ;
lin n5 =
{s = table {unit => n59 "пят" ;
teen => nadsat "пят" ;
ten => n5070 "пят" ;
hund => sot (n59 "пят")} ;
size = Num5} ;
lin n6 =
{s = table {unit => n59 "шест" ;
teen => nadsat "шест" ;
ten => n5070 "шест" ;
hund => sot (n59 "шест")} ;
size = Num5} ;
lin n7 =
{s = table {unit => n59 "сем" ;
teen => nadsat "сем" ;
ten => n5070 "сем" ;
hund => sot (n59 "сем") } ;
size = Num5} ;
lin n8 =
{s = table {unit => vosem ;
teen => nadsat "восем" ;
ten => \\ g, a, c =>
-- : Digit
lin n3 = {
s = table {
unit => tri ;
teen => nadsat "три" ;
ten => n2030 "три" ;
hund => sta tri
} ;
o = table {
unit => pronoun6AstA "третий" ;
teen => pronounAdj1A "тринадцатый" ;
ten => pronounAdj1A "тридцатый" ;
hund => pronounAdj1A "трёхсотый"
} ;
size = Num2_4
} ;
lin n4 = {
s = table {
unit => chetyre ;
teen => nadsat "четыр" ;
ten => \\g,a,c => case <c, g> of {
<(Nom|VocRus|Acc), _> => "сорок";
<(Gen|Ptv|Dat|Ins|Pre|Loc), _> => "сорока"
} ;
hund => sta chetyre
} ;
o = table {
unit => pronounAdj1A "четвёртый" ;
teen => pronounAdj1A "четырнадцатый" ;
ten => pronounAdj1B "сороковой" ;
hund => pronounAdj1A "четырёхсотый"
} ;
size = Num2_4
} ;
lin n5 = {
s = table {
unit => n59 "пят" ;
teen => nadsat "пят" ;
ten => n5070 "пят" ;
hund => sot (n59 "пят")
} ;
o = table {
unit => pronounAdj1A "пятый" ;
teen => pronounAdj1A "пятнадцатый" ;
ten => pronounAdj1A "пятидесятый" ;
hund => pronounAdj1A "пятисотый"
} ;
size = Num5
} ;
lin n6 = {
s = table {
unit => n59 "шест" ;
teen => nadsat "шест" ;
ten => n5070 "шест" ;
hund => sot (n59 "шест")
} ;
o = table {
unit => pronounAdj1B "шестой" ;
teen => pronounAdj1A "шестнадцатый" ;
ten => pronounAdj1A "шестидесятый" ;
hund => pronounAdj1A "шестисотый"
} ;
size = Num5
} ;
lin n7 = {
s = table {
unit => n59 "сем" ;
teen => nadsat "сем" ;
ten => n5070 "сем" ;
hund => sot (n59 "сем")
} ;
o = table {
unit => pronounAdj1B "седьмой" ;
teen => pronounAdj1A "семнадцатый" ;
ten => pronounAdj1A "семидесятый" ;
hund => pronounAdj1A "семисотый"
} ;
size = Num5
} ;
lin n8 = {
s = table {
unit => vosem ;
teen => nadsat "восем" ;
ten => \\g,a,c => case <c, g> of {
<(Nom|VocRus|Acc), _> => "восемьдесят";
<(Gen|Ptv|Dat|Pre|Loc), _> => "восьмидесяти" ;
<Ins, _> => "восемьюдесятью"
};
hund => sot vosem
} ;
o = table {
unit => pronounAdj1B "восьмой" ;
teen => pronounAdj1A "восемнадцатый" ;
ten => pronounAdj1A "восьмидесятый" ;
hund => pronounAdj1A "восьмисотый"
} ;
size = Num5
} ;
lin n9 = {
s = table {
unit => n59 "девят" ;
teen => nadsat "девят" ;
ten => \\g,a,c =>
case <c, g> of {
<(Nom|VocRus|Acc), _> => "девяносто" ;
<(Gen|Ptv|Dat|Ins|Pre|Loc), _> => "девяноста"
};
hund => sot (n59 "девят")
} ;
o = table {
unit => pronounAdj1A "девятый" ;
teen => pronounAdj1A "девятнадцатый" ;
ten => pronounAdj1A "девяностый" ;
hund => pronounAdj1A "девятисотый"
} ;
size = Num5
} ;
oper n59 : Str -> DetTable =
\n -> \\g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "восемьдесят";
<(Gen|Ptv|Dat|Pre|Loc), _ > => "восьмидесяти" ;
<Ins, _ > => "восемьюдесятью"
};
hund => sot vosem
} ;
size = Num5} ;
lin n9 =
{s = table {unit => n59 "девят" ;
teen => nadsat "девят" ;
ten => \\ g, a, c =>
<(Nom|VocRus|Acc), _> => n + "ь" ;
<(Gen|Ptv|Dat|Pre|Loc), _> => n + "и" ;
<Ins, _> => n + "ью"
} ;
oper n2030 : Str -> DetTable =
\n -> \\g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "девяносто";
<(Gen|Ptv|Dat|Ins|Pre|Loc), _ > => "девяноста"
};
hund => sot (n59 "девят") } ;
size = Num5} ;
<(Nom|VocRus|Acc), _> => n + "дцать" ;
<(Gen|Ptv|Dat|Pre|Loc), _> => n + "дцати" ;
<Ins, _> => n + "дцатью"
} ;
oper n59 : Str -> (Gender => Animacy => Case => Str) = \ n -> \\ g, a, c =>
oper n5070 : Str -> DetTable =
\n -> \\g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => n + "ь";
<(Gen|Ptv|Dat|Pre|Loc), _ > => n + "и";
<Ins, _ > => n + "ью"
};
<(Nom|VocRus|Acc), _> => n + "ьдесят" ;
<(Gen|Ptv|Dat|Pre|Loc), _> => n + "идесяти" ;
<Ins, _> => n + "ьюдесятью"
} ;
oper n2030 : Str -> (Gender => Animacy => Case => Str) = \ n -> \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => n + "дцать";
<(Gen|Ptv|Dat|Pre|Loc), _ > => n + "дцати" ;
<Ins, _ > => n + "дцатью"
};
oper tri : DetTable =
\\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _> => "три";
<(Gen|Ptv|Pre|Loc), _> => "трёх";
<Dat, _> => "трём";
<Ins, _> => "тремя"
} ;
oper n5070 : Str -> (Gender => Animacy => Case => Str) = \ n -> \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => n + "ьдесят";
<(Gen|Ptv|Dat|Pre|Loc), _ > => n + "идесяти" ;
<Ins, _ > => n + "ьюдесятью"
};
oper chetyre : DetTable =
\\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _> => "четыре" ;
<(Gen|Ptv|Pre|Loc), _> => "четырех" ;
<Dat, _> => "четырем" ;
<Ins, _> => "четырьмя"
} ;
oper tri : Gender => Animacy => Case => Str = \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "три";
<(Gen|Ptv|Pre|Loc), _ > => "трех";
<Dat, _ > => "трем";
<Ins, _ > => "тремя"
};
oper chetyre : Gender => Animacy => Case => Str = \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "четыре";
<(Gen|Ptv|Pre|Loc), _ > => "четырех";
<Dat, _ > => "четырем";
<Ins, _ > => "четырьмя"
};
oper vosem : Gender => Animacy => Case => Str = \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "восемь";
<(Gen|Ptv|Dat|Pre|Loc), _ > => "восьми";
<Ins, _ > => "восемью"
};
oper vosem : DetTable =
\\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _> => "восемь" ;
<(Gen|Ptv|Dat|Pre|Loc), _> => "восьми ";
<Ins, _> => "восемью"
} ;
-- a little tribute to Burgess
oper nadsat : Str -> (Gender => Animacy => Case => Str) = \ n -> \\ g, a, c =>
oper nadsat : Str -> DetTable
= \n -> \\g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => n + "надцать";
<(Gen|Ptv|Dat|Pre|Loc), _ > => n + "надцати";
<Ins, _ > => n + "надцатью"
};
<(Nom|VocRus|Acc), _> => n + "надцать" ;
<(Gen|Ptv|Dat|Pre|Loc), _> => n + "надцати" ;
<Ins, _> => n + "надцатью"
} ;
oper sta : (Gender => Animacy => Case => Str) -> (Gender => Animacy => Case => Str) = \ n -> \\ g, a, c =>
oper sta : DetTable -> DetTable
= \n -> \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => n ! Fem ! Animate ! c + "ста";
<Gen|Ptv, _ > => n ! Fem ! Animate ! c + "сот";
<Dat, _ > => n ! Fem ! Animate ! c + "стам";
<Ins, _ > => n ! Fem ! Animate ! c + "стами";
<Pre|Loc, _ > => n ! Fem ! Animate ! c + "стах"
};
<(Nom|VocRus|Acc), _> => n ! Fem ! Animate ! c + "ста" ;
<Gen|Ptv, _> => n ! Fem ! Animate ! c + "сот" ;
<Dat, _> => n ! Fem ! Animate ! c + "стам" ;
<Ins, _> => n ! Fem ! Animate ! c + "стами" ;
<Pre|Loc, _> => n ! Fem ! Animate ! c + "стах"
} ;
oper sot : (Gender => Animacy => Case => Str) -> (Gender => Animacy => Case => Str) = \ n -> \\ g, a, c =>
oper sot : DetTable -> DetTable
= \n -> \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => n ! Fem ! Animate ! c + "сот";
<Gen|Ptv, _ > => n ! Fem ! Animate ! c + "сот";
<Dat, _ > => n ! Fem ! Animate ! c + "стам";
<Ins, _ > => n ! Fem ! Animate ! c + "стами";
<Pre|Loc, _ > => n ! Fem ! Animate ! c + "ста"
};
<(Nom|VocRus|Acc), _> => n ! Fem ! Animate ! c + "сот" ;
<Gen|Ptv, _> => n ! Fem ! Animate ! c + "сот" ;
<Dat, _> => n ! Fem ! Animate ! c + "стам" ;
<Ins, _> => n ! Fem ! Animate ! c + "стами" ;
<Pre|Loc, _> => n ! Fem ! Animate ! c + "ста"
} ;
lin pot01 =
{s = table {attr => table {hund => \\ g, a, c =>
case <g, a, c> of {
<_, _, (Nom|VocRus|Acc) > => "сто";
<_, _, (Gen|Ptv|Dat|Pre|Loc) > => "ста";
<_, _, Ins > => "сотней"
};
_ => \\ g, a, c => []} ;
_ => table {hund => \\ g, a, c =>
case <g, a, c> of {
<_, _, (Nom|VocRus|Acc) > => "сто";
<_, _, (Gen|Ptv|Dat|Pre|Loc) > => "ста";
-- TODO: case agreement with nouns
<_, _, Ins > => "сотней"
};
_ => \\ g, a, c =>
case <g, a, c> of {
<Masc, Animate, Acc> => "одного";
<Masc, Inanimate, Acc> => "один";
<Masc, _, Nom|VocRus > => "один";
<Masc, _, Gen|Ptv > => "одного";
<Masc, _, Dat > => "одному";
<Masc, _, Ins > => "одним";
<Masc, _, Pre|Loc > => "одном";
<Fem, _, Nom|VocRus > => "одна";
<Fem, _, (Gen|Ptv|Dat|Ins|Pre|Loc) > => "одной";
<Fem, _, Acc> => "одну";
<Neut, _, (Nom|VocRus|Acc) > => "одно";
<Neut, _, Gen|Ptv > => "одного";
<Neut, _, Dat > => "одному";
<Neut, _, Ins > => "одним";
<Neut, _, Pre|Loc > => "одном"}}} ;
size = Num1} ;
lin n2 = {
s = table {
unit => \\ g, a, c => case <c, g, a> of {
<(Nom|VocRus|Acc), Fem, _> => "две" ;
<(Nom|VocRus|Acc), (Masc|Neut), Inanimate> => "два" ;
<Nom|VocRus, (Masc|Neut), Animate> => "два" ;
<Acc , _, Animate> => "двух" ;
<(Gen|Ptv|Pre|Loc), _, _> => "двух" ;
<Dat, _, _> => "двум" ;
<Ins, _, _> => "двумя"
};
teen => nadsat "две" ;
ten => n2030 "два" ;
hund => \\ g, a, c => case <c, g> of {
<(Nom|VocRus|Acc), _> => "двести" ;
<Gen|Ptv, _> => "двухсот" ;
<Dat, _> => "двумстам" ;
<Ins, _> => "двумястами" ;
<Pre|Loc, _> => "двухстах"
}
} ;
o = table {
unit => pronounAdj1B "второй" ;
teen => pronounAdj1A "двенадцатый" ;
ten => pronounAdj1A "двадцатый" ;
hund => pronounAdj1A "двухсотый"
} ;
size = Num2_4
} ;
lin n2 =
{s = table {unit => \\ g, a, c =>
case <c, g, a> of {
<(Nom|VocRus|Acc), Fem, _ > => "две";
<(Nom|VocRus|Acc), (Masc|Neut), Inanimate > => "два";
<Nom|VocRus, (Masc|Neut), Animate > => "два";
<Acc , _, Animate > => "двух";
<(Gen|Ptv|Pre|Loc), _, _ > => "двух";
<Dat, _, _ > => "двум";
<Ins, _, _ > => "двумя"
};
teen => nadsat "две" ;
ten => n2030 "два" ;
hund => \\ g, a, c =>
case <c, g> of {
<(Nom|VocRus|Acc), _ > => "двести";
<Gen|Ptv, _ > => "двухсот";
<Dat, _ > => "двумстам";
<Ins, _ > => "двумястами";
<Pre|Loc, _ > => "двухстах"} } ;
size = Num2_4} ;
-- : Sub10 ; -- 1
lin pot01 = {
s = table {
attr => table {
hund => \\ g, a, c => case <g, a, c> of {
<_, _, (Nom|VocRus|Acc)> => "сто";
<_, _, (Gen|Ptv|Dat|Pre|Loc)> => "ста";
<_, _, Ins> => "сотней"
} ;
_ => \\ g, a, c => []
} ;
indep => table {
hund => \\ g, a, c => case <g, a, c> of {
<_, _, (Nom|VocRus|Acc)> => "сто";
<_, _, (Gen|Ptv|Dat|Pre|Loc)> => "ста";
<_, _, Ins> => "сотней"
};
_ => \\ g, a, c => case <g, a, c> of {
<Masc, Animate, Acc> => "одного";
<Masc, Inanimate, Acc> => "один";
<Masc, _, Nom|VocRus> => "один";
<Masc, _, Gen|Ptv> => "одного";
<Masc, _, Dat> => "одному";
<Masc, _, Ins> => "одним";
<Masc, _, Pre|Loc> => "одном";
<Fem, _, Nom|VocRus> => "одна";
<Fem, _, (Gen|Ptv|Dat|Ins|Pre|Loc)> => "одной";
<Fem, _, Acc> => "одну";
<Neut, _, (Nom|VocRus|Acc)> => "одно";
<Neut, _, Gen|Ptv> => "одного";
<Neut, _, Dat> => "одному";
<Neut, _, Ins> => "одним";
<Neut, _, Pre|Loc> => "одном"
}
}
} ;
o = table {
attr => table {
hund => immutableAdjectiveCases "сто" ; -- as in "сто второй"?
_ => immutableAdjectiveCases ""
} ;
indep => table {
hund => pronounAdj1A "сотый" ;
_ => pronounAdj1A "первый"
}
} ;
just1 = True ;
size = Num1
} ;
lin pot0 d =
{s = table {_ => d.s} ; size = d.size} ;
lin pot110 =
{s = \\ p => n59 "десят" ; size = Num5} ;
lin pot111 =
{s = \\ p => nadsat "один" ; size = Num5} ; --- 11
lin pot1to19 d =
{s = table {_ => d.s ! teen} ; size = Num5} ;
lin pot0as1 n =
{s = table {p => n.s ! p ! unit} ; size = n.size} ;
lin pot1 d =
{s = table {_ => d.s ! ten} ; size = Num5} ; ---
lin pot1plus d e =
{s = table {_ => \\ g, a, c => d.s ! ten ! g ! a ! c ++ e.s ! indep ! unit ! g ! a ! c} ; size = e.size} ;
lin pot1as2 n =
{s = n.s ; size = n.size} ;
lin pot2 d =
{s = table {p => d.s ! p ! hund} ; size = Num5} ;
lin pot2plus d e =
{s = \\ p, g, a, c => d.s ! p ! hund ! g ! a ! c ++ e.s ! indep ! g ! a ! c ; size = e.size} ;
lin pot2as3 n =
{s = n.s ! indep ; size = n.size} ;
lin pot3 n =
{s = \\ g, a, c => n.s ! attr ! Fem ! a ! c ++ mille.s ! numSizeNum c n.size ! numSizeCase c n.size ; size = Num5} ;
lin pot3plus n m =
{s = \\ g, a, c => n.s ! attr ! Fem ! a ! c ++ mille.s ! numSizeNum c n.size ! numSizeCase c n.size ++ m.s ! indep ! g ! a ! c ; size = Num5} ;
-- : Digit -> Sub10 ; -- d * 1
lin pot0 d = {
s = table {_ => d.s} ;
o = table {_ => d.o} ;
just1 = False ;
size = d.size
} ;
--- TODO
--- raz/odin
-- : Sub100 ; -- 10
lin pot110 = {
s = \\p => n59 "десят" ;
o = \\p => pronounAdj1A "десятый" ;
just1 = False ;
size = Num5
} ;
-- : Sub100 ; -- 11
lin pot111 = {
s = \\p => nadsat "один" ;
o = \\p => pronounAdj1A "одиннадцатый" ;
just1 = False ;
size = Num5
} ;
-- : Digit -> Sub100 ; -- 10 + d
lin pot1to19 d = {
s = table {_ => d.s ! teen} ;
o = table {_ => d.o ! teen} ;
just1 = False ;
size = Num5
} ;
-- : Sub10 -> Sub100 ; -- coercion of 1..9
lin pot0as1 n = {
s = table {p => n.s ! p ! unit} ;
o = table {p => n.o ! p ! unit} ; --?
just1 = n.just1 ;
size = n.size
} ;
-- : Digit -> Sub100 ; -- d * 10
lin pot1 d = {
s = table {_ => d.s ! ten} ;
o = table {_ => d.o ! ten} ;
just1 = False ;
size = Num5
} ; ---
-- : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
lin pot1plus d e = {
s = table {_ => \\g, a, c => d.s ! ten ! g ! a ! c ++ e.s ! indep ! unit ! g ! a ! c} ;
o = \\p => prependPF (d.s ! ten ! Masc ! Inanimate ! Nom) (e.o ! p ! unit) ;
just1 = False ;
size = e.size
} ;
-- : Sub100 -> Sub1000 ; -- coercion of 1..99
lin pot1as2 n = {s = n.s ; size = n.size ; just1 = n.just1 ; o = n.o} ;
-- : Sub10 -> Sub1000 ; -- m * 100
lin pot2 d = {
s = table {p => d.s ! p ! hund} ;
o = table {p => d.o ! p ! hund} ;
just1 = False ;
size = Num5
} ;
-- : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
lin pot2plus d e = {
s = \\p, g, a, c => d.s ! p ! hund ! g ! a ! c ++ e.s ! indep ! g ! a ! c ;
o = \\p => prependPF (d.s ! p ! hund ! Masc ! Inanimate ! Nom) (e.o ! p) ;
just1 = False ;
size = e.size
} ;
-- : Sub1000 -> Sub1000000 ; -- coercion of 1..999
lin pot2as3 n = {
s = n.s ! indep ;
o = n.o ! indep ; -- ???
just1 = n.just1 ; -- ???
size = n.size
} ;
-- : Sub1000 -> Sub1000000 ; -- m * 1000
lin pot3 n = { -- TODO: fix cases like: 111000, 100000
s = \\g, a, c => n.s ! attr ! Fem ! a ! c ++ mille.s ! numSizeNum c n.size ! numSizeCase c n.size ;
o = prependPF (case n.just1 of {
False => n.s ! attr ! Neut ! Inanimate ! Gen ++ BIND ;
True => ""
}
)
(pronounAdj1AstA "тысячный") ; --TODO: not as simple. Gen or Nom?
just1 = False ;
size = Num5
} ;
-- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
lin pot3plus n m = {
s = \\g, a, c => n.s ! attr ! Fem ! a ! c
++ mille.s ! numSizeNum c n.size ! numSizeCase c n.size
++ m.s ! indep ! g ! a ! c ;
o = prependPF (n.s ! attr ! Neut ! Inanimate ! Nom ++ mille.s ! numSizeNum Nom n.size ! numSizeCase Nom n.size)
(m.o ! indep) ; -- TODO: chk
just1 = False ;
size = Num5
} ;
-- numerals as sequences of digits
lincat
Dig = TDigit ;
lincat
Dig = TDigit ;
lin
IDig d = {s = d.s ; n = d.n ; size = d.size} ;
lin
IDig d = {s = d.s ; n = d.n ; size = d.size} ;
IIDig d i = {
s = d.s ++ BIND ++ i.s ;
n = Pl ;
size = i.size
} ;
D_0 = mk2Dig "0" Num5 ;
D_1 = mk4Dig "1" "1" Sg Num1 ; ----
D_2 = mk2Dig "2" Num2_4 ;
D_3 = mk2Dig "3" Num2_4 ;
D_4 = mk2Dig "4" Num2_4 ;
D_5 = mk2Dig "5" Num5 ;
D_6 = mk2Dig "6" Num5 ;
D_7 = mk2Dig "7" Num5 ;
D_8 = mk2Dig "8" Num5 ;
D_9 = mk2Dig "9" Num5 ;
oper
mk3Dig : Str -> Str -> NumSize -> TDigit = \c,o,size -> mk4Dig c o Pl size ;
mk2Dig : Str -> NumSize -> TDigit = \c,size -> mk3Dig c (c + "o") size ;
mk4Dig : Str -> Str -> Number -> NumSize -> TDigit = \c,o,n,size -> {
s = c ; ---- gender
n = n ;
size = size
} ;
TDigit = {
n : Number ;
s : Str ;
size : NumSize
IIDig d i = {
s = d.s ++ BIND ++ i.s ;
n = Pl ;
size = i.size
} ;
D_0 = mk2Dig "0" Num5 ;
D_1 = mk4Dig "1" "1" Sg Num1 ; ----
D_2 = mk2Dig "2" Num2_4 ;
D_3 = mk2Dig "3" Num2_4 ;
D_4 = mk2Dig "4" Num2_4 ;
D_5 = mk2Dig "5" Num5 ;
D_6 = mk2Dig "6" Num5 ;
D_7 = mk2Dig "7" Num5 ;
D_8 = mk2Dig "8" Num5 ;
D_9 = mk2Dig "9" Num5 ;
oper
mk3Dig : Str -> Str -> NumSize -> TDigit = \c,o,size -> mk4Dig c o Pl size ;
mk2Dig : Str -> NumSize -> TDigit = \c,size -> mk3Dig c (c + "o") size ;
mk4Dig : Str -> Str -> Number -> NumSize -> TDigit = \c,o,n,size -> {
s = c ; ---- gender
n = n ;
size = size
} ;
TDigit = {
n : Number ;
s : Str ;
size : NumSize
} ;
}

View File

@@ -30,7 +30,7 @@ oper
short : ShortFormPreference
= PrefShort ;
full : ShortFormPreference
= PrefFull ;
= PreferFull ;
-- Animacy is needed for nouns and some pronouns.
animate : Animacy
@@ -132,14 +132,15 @@ oper
ShortenA : A -> A ;
-- Two-place adjectives need a preposition and a case as extra arguments.
-- Two-place adjectives need a preposition
-- TODO: ? mkA2 : A -> Str -> Case -> A2 ; -- "делим на"
mkA2 : A -> Prep -> A2 ;
mkA2 : overload {
mkA2 : A -> Prep -> A2 ;
} ;
mkOrd : overload {
mkOrd : (nom : Str) -> Ord ;
} ;
} ;
-------------------------
--2 Verbs
@@ -275,7 +276,7 @@ oper
mkA : Str -> Str -> A
= \nom, comp -> lin A ((guessAdjectiveForms nom) ** {comp=comp}) ;
mkA : Str -> Str -> Str -> A
= \nom, comp, zi -> lin A (makeAdjectiveForms nom comp zi PrefFull) ;
= \nom, comp, zi -> lin A (makeAdjectiveForms nom comp zi PreferFull) ;
mkA : Str -> Str -> Str -> ShortFormPreference -> A
= \nom, comp, zi, spf -> lin A (makeAdjectiveForms nom comp zi spf) ;
} ;
@@ -285,14 +286,17 @@ oper
-- Two-place adjectives need a preposition and a case as extra arguments.
-- TODO: ? mkA2 : A -> Str -> Case -> A2 ; -- "делим на"
mkA2 : A -> Prep -> A2
= \a,p -> lin A2 (a ** {c = p}) ;
mkA2 = overload {
mkA2 : A -> Prep -> A2
= \a,p -> lin A2 (a ** {c = p}) ;
mkA2 : A -> Str -> Case -> A2
= \a,p,cas -> lin A2 (a ** {c = mkPrep p cas}) ;
} ;
mkOrd = overload {
mkOrd : (nom : Str) -> Ord
= \nom -> lin Ord (guessAdjectiveForms nom) ;
} ;
} ;
-------------------------
-- Verbs

View File

@@ -28,9 +28,9 @@ param
Case = Nom | Gen | Dat | Acc | Ins | Pre -- падеж, "малые падежи":
| Loc | Ptv | VocRus ; -- "minor cases", usually Loc = Pre, Ptv = Gen, VocRus = Nom
ShortFormPreference = PrefShort | PrefFull ;
ShortFormPreference = PrefShort | PreferFull ;
CopulaType = NomCopula | InsCopula | EllCopula | ExplicitCopula ;
SpecialFuture = NormalFuture | BeFuture | CanFuture | WantFuture | NullFuture ;
SpecialFuture = NormalFuture | BeFuture | BeFuture2 | CanFuture | WantFuture | NullFuture ;
DetType = NormalDet | EmptyDef | EmptyIndef ; -- artificial parameter to side-step DetNP parsing issues
oper
MaybeAgr = Maybe Agr ;
@@ -72,6 +72,7 @@ oper
sm, sf, sn, sp, -- short forms
comp -- comparative variants
: Str ;
p : Bool ;
preferShort : ShortFormPreference
} ;

View File

@@ -19,8 +19,8 @@ lin
-- : IP -> ClSlash -> QCl ; -- whom does John love
QuestSlash ip cls = cls ** {
subj=(applyIPronPrep cls.c ip) ++ cls.subj ; -- cls.subj ???
a=ip.a
subj=(applyIPronPrep cls.c ip) ++ cls.subj ;
a=cls.a
} ;
-- : IAdv -> Cl -> QCl ; -- why does John walk

View File

@@ -8,11 +8,11 @@ concrete RelativeRus of Relative = CatRus ** open
lin
-- : Cl -> RCl ; -- such that John loves her
RelCl cl = {
subj=such.s ;
adv=\\a=> cl.subj ++ comma ++ "что" ++ cl.adv ; -- TODO: this should be after subj in this case
subj=\\gn,anim,cas => such.s ! gn ! anim ! cas ++ comma ++ "что" ++ cl.subj ;
adv=\\a => cl.adv ;
verb=cl.verb ;
dep=cl.dep ;
compl=\\a=>cl.compl ;
compl=\\a => cl.compl ;
a=Just Agr cl.a
} ;
-- : RP -> ClSlash -> RCl ; -- whom John loves

View File

@@ -197,14 +197,6 @@ oper
AgrTable = Agr => Str ;
agree : ComplementCase -> AgrTable
= \c -> table {
_ => c.s -- TODO: implement
} ;
selectCase : (Case => Str) -> ComplementCase -> Str
= \np,prep -> prep.s ++ np ! prep.c ; -- TODO: NP - pronoun special treatment
from2 = {s="из"; c=Gen; hasPrep=True} ;
mkCompoundN : NounForms -> Str -> NounForms -> NounForms
@@ -246,7 +238,8 @@ oper
sn = [] ;
sp = [] ;
comp = [] ;
preferShort = PrefFull
preferShort = PreferFull ;
p = False
} ;
immutableAdjForms = immutableAdjectiveCases ;
@@ -346,33 +339,43 @@ oper
preferShort = forms.preferShort
} ;
doGuessAdjectiveForms : Str -> AdjForms
= \word -> case word of {
_ + "шеий" => makeAdjective word (ZA 6 No A_ NoC) PreferFull ;
_ + "цый" => makeAdjective word (ZA 5 No A_ NoC) PreferFull ;
_ + ("к"|"г"|"х") +"ий" => makeAdjective word (ZA 3 No A_ NoC) PreferFull ;
_ + ("ш"|"ж"|"ч"|"щ")+"ий" => makeAdjective word (ZA 4 No A_ NoC) PreferFull ;
_ + #consonant + "ный" => makeAdjective word (ZA 1 Ast A_ NoC) PreferFull ;
_ + #consonant + "ний" => makeAdjective word (ZA 2 Ast A_ NoC) PreferFull ;
_ + "ый" => makeAdjective word (ZA 1 No A_ NoC) PreferFull ;
_ + "ой" => makeAdjective word (ZA 1 No B_ NoC) PreferFull ;
_ + "ий" => makeAdjective word (ZA 2 No A_ NoC) PreferFull ;
_ => makeAdjective word (ZA 1 No A_ NoC) PreferFull
} ;
guessAdjectiveForms : Str -> AdjForms
= \word ->
let stem = Predef.tk 2 word in
case word of {
_ + "шеий" => makeAdjective word (ZA 6 No A_ NoC) PrefFull ;
_ + "цый" => makeAdjective word (ZA 5 No A_ NoC) PrefFull ;
_ + ("к"|"г"|"х") +"ий" => makeAdjective word (ZA 3 No A_ NoC) PrefFull ;
_ + ("ш"|"ж"|"ч"|"щ")+"ий" => makeAdjective word (ZA 4 No A_ NoC) PrefFull ;
_ + #consonant + "ный" => makeAdjective word (ZA 1 Ast A_ NoC) PrefFull ;
_ + #consonant + "ний" => makeAdjective word (ZA 2 Ast A_ NoC) PrefFull ;
_ + "ый" => makeAdjective word (ZA 1 No A_ NoC) PrefFull ;
_ + "ой" => makeAdjective word (ZA 1 No B_ NoC) PrefFull ;
_ + "ий" => makeAdjective word (ZA 2 No A_ NoC) PrefFull ;
_ => makeAdjective word (ZA 1 No A_ NoC) PrefFull
} ;
= \word -> case word of {
s + "ся" => appendToAF (doGuessAdjectiveForms s) "ся" ;
_ => doGuessAdjectiveForms word
} ;
doMakeAdjectiveForms : Str -> Str -> Str -> ShortFormPreference -> AdjForms
= \nom, comp, zi, spf ->
let af = makeAdjective nom (parseAdjIndex zi) spf in
let comp' = case (Predef.length comp) of {0 => af.comp; _ => comp} in
af ** {comp=comp'} ;
makeAdjectiveForms : Str -> Str -> Str -> ShortFormPreference -> AdjForms
= \nom, comp, zi, spf ->
let af = makeAdjective nom (parseAdjIndex zi) spf in
let comp' = case (Predef.length comp) of {0 => af.comp; _ => comp} in
af ** {comp=comp'} ;
= \nom, comp, zi, spf -> case nom of {
s + "ся" => appendToAF (doMakeAdjectiveForms s comp zi spf) "ся" ;
_ => doMakeAdjectiveForms nom comp zi spf
} ;
makeAdjectiveFromNoun : Noun -> Adjective
= \n -> {
s = \\gn,anim,cas=> n.s ! numGenNum gn ! cas ;
short=\\a=>[] ;
preferShort=PrefFull
preferShort=PreferFull
} ;
the_most = guessAdjectiveForms "самый" ;
@@ -401,10 +404,45 @@ oper
sp = the_most.sp ++ af.sp ;
comp = the_most.comp ++ af.comp ;
g=af.g ;
-- a=af.a ;
preferShort = PrefFull
preferShort = PreferFull ;
p = af.p
} ;
prependPF : Str -> PronForms -> PronForms
= \s,pf -> {
msnom = s ++ pf.msnom ;
fsnom = s ++ pf.fsnom ;
nsnom = s ++ pf.nsnom ;
pnom = s ++ pf.pnom ;
msgen = s ++ pf.msgen ;
fsgen = s ++ pf.fsgen ;
pgen = s ++ pf.pgen ;
msdat = s ++ pf.msdat ;
fsacc = s ++ pf.fsacc ;
msins = s ++ pf.msins ;
fsins = s ++ pf.fsins ;
pins = s ++ pf.pins ;
msprep= s ++ pf.msprep
} ;
appendToAF : AdjForms -> Str -> AdjForms
= \af,s -> af ** {
msnom = af.msnom ++ BIND ++ s;
fsnom = af.fsnom ++ BIND ++ s;
nsnom = af.nsnom ++ BIND ++ s;
pnom = af.pnom ++ BIND ++ s;
msgen = af.msgen ++ BIND ++ s;
fsgen = af.fsgen ++ BIND ++ s;
pgen = af.pgen ++ BIND ++ s;
msdat = af.msdat ++ BIND ++ s;
fsacc = af.fsacc ++ BIND ++ s;
msins = af.msins ++ BIND ++ s;
fsins = af.fsins ++ BIND ++ s;
pins = af.pins ++ BIND ++ s;
msprep= af.msprep ++ BIND ++ s;
} ;
makeNFFromAF : AdjForms -> Gender -> Animacy -> NounForms
= \af, g, anim ->
case g of {
@@ -548,6 +586,7 @@ oper
-- TODO: Provide also Nom-based as idiomatic (?)
copulaIns : VerbForms
= copula ** {
fut=BeFuture2 ;
prsg1="являюсь" ;
prsg2="являешься" ;
prsg3="является" ;
@@ -646,13 +685,13 @@ oper
tran=Intransitive
} ;
verbPastAgree : VerbForms -> Agr -> Str -> TempParts
= \vf,a,after -> <"", case a of {
verbPastAgree : VerbForms -> Agr -> Str -> Str
= \vf,a,after -> case a of {
Ag (GSg Masc) _ => vf.psgm ++ (verbReflAfterConsonant vf) ++ after ;
Ag (GSg Fem) _ => vf.psgs ++ BIND ++ "ла" ++ (verbRefl vf) ++ after ;
Ag (GSg Neut) _ => vf.psgs ++ BIND ++ "ло" ++ (verbRefl vf) ++ after ;
Ag GPl _ => vf.psgs ++ BIND ++ "ли"++ (verbRefl vf) ++ after
}> ;
} ;
verbReflAfterConsonant : VerbForms -> Str
= \vf -> case vf.refl of {Reflexive => BIND ++ "ся" ; NonReflexive => ""} ;
@@ -698,7 +737,7 @@ oper
<CanFuture,Ag GPl P1 > => "сможем" ;
<CanFuture,Ag GPl P2 > => "сможете" ;
<CanFuture,Ag GPl P3 > => "смогут" ;
<BeFuture,_> => beFuture a ;
<BeFuture | BeFuture2,_> => beFuture a ;
_ => case vf.asp of {
Perfective => verbPresAgree vf a ;
Imperfective => (beFuture a) ++ verbInf vf
@@ -715,19 +754,32 @@ oper
Ag GPl P3 => <"пусть", verbFutAgree vf (Ag GPl P3)>
} ;
verbAgr : VerbForms -> Mood -> Tense -> Agr -> Polarity -> TempParts
= \vf,m,temp,a,pol ->
case <vf.fut,m,temp> of {
<NullFuture, _, _> => <"",""> ;
<_, Ind, Past> => verbPastAgree vf a "";
<_, Ind, Pres> => <"",verbPresAgree vf a>;
<_, Ind, Fut> => <"",verbFutAgree vf a>;
<_, Ind, Cond> => verbPastAgree vf a "бы" ;
<_, Sbjv, _> => verbPastAgree vf a "бы" ;
<_, Imperative, _> => verbImperativeAgree vf a ;
<_, Infinitive, _> => <"",verbInf vf>
verbEnvAgr : Str -> Str -> VerbForms -> Mood -> Tense -> Agr -> Pol -> Str
= \subj,adv,vf,m,temp,a,pol ->
case vf.fut of {
NullFuture => subj ++ pol.s ++ adv ;
BeFuture => case <m,temp, pol.p> of {
<Ind, Past, _> => subj ++ pol.s ++ adv ++ verbPastAgree vf a "" ;
<Ind, Pres, Pos> => subj ++ pol.s ++ adv ++ verbPresAgree vf a ;
<Ind, Pres, Neg> => subj ++ "нет" ++ adv ;
<Ind, Fut, _> => subj ++ pol.s ++ adv ++ verbFutAgree vf a ;
<Ind, Cond, _> => subj ++ pol.s ++ adv ++ verbPastAgree vf a "бы" ;
<Sbjv, _, _> => subj ++ pol.s ++ adv ++ verbPastAgree vf a "бы" ;
<Imperative, _, _> => let p = verbImperativeAgree vf a in p.p1 ++ subj ++ pol.s ++ adv ++ p.p2 ;
<Infinitive, _, _> => subj ++ pol.s ++ adv ++ verbInf vf
} ;
_ => case <m,temp> of {
<Ind, Past> => subj ++ pol.s ++ adv ++ verbPastAgree vf a "" ;
<Ind, Pres> => subj ++ pol.s ++ adv ++ verbPresAgree vf a ;
<Ind, Fut> => subj ++ pol.s ++ adv ++ verbFutAgree vf a ;
<Ind, Cond> => subj ++ pol.s ++ adv ++ verbPastAgree vf a "бы" ;
<Sbjv, _> => subj ++ pol.s ++ adv ++ verbPastAgree vf a "бы" ;
<Imperative, _> => let p = verbImperativeAgree vf a in p.p1 ++ subj ++ pol.s ++ adv ++ p.p2 ;
<Infinitive, _> => subj ++ pol.s ++ adv ++ verbInf vf
}
} ;
---------------------------
-- Pronouns -- Местоимения
@@ -923,7 +975,7 @@ oper
dat = "им" ; -- TODO: n
ins = "ими" ; -- TODO: n
prep, loc = "них" ;
nPrefix = False ;
nPrefix = True ;
poss = doPossessivePronP3 "их"
}
} ;
@@ -1220,8 +1272,9 @@ oper
fsins = "той" ;
pins = "тех" ;
msprep = "том" ;
preferShort = PrefFull ;
comp = []
preferShort = PreferFull ;
comp = [] ;
p = False
} ;
this_forms = {
@@ -1238,8 +1291,9 @@ oper
fsins = "этой" ;
pins = "этими" ;
msprep = "этом" ;
preferShort = PrefFull ;
comp = []
preferShort = PreferFull ;
comp = [] ;
p = False
} ;
a_forms = { -- this pronoun is an approximate translation of indef article; preventing DetNP parsing problems
@@ -1256,8 +1310,9 @@ oper
fsins = "некой" ;
pins = "неким" ;
msprep = "некой" ;
preferShort = PrefFull ;
comp = []
preferShort = PreferFull ;
comp = [] ;
p = False
} ;
a_Det = {
@@ -1291,8 +1346,9 @@ oper
fsins = "данной" ;
pins = "данных" ;
msprep = "данном" ;
preferShort = PrefFull ;
comp = []
preferShort = PreferFull ;
comp = [] ;
p = False
} ;
the_Det = {
@@ -1320,6 +1376,27 @@ param Place = attr | indep ;
oper
mille : Noun = nounFormsNoun ((guessNounForms "тысяча") ** {sins=variants {"тысячей" ; "тысячью"}});
ith_forms : Str -> AdjForms
= \s -> {
msnom = s ++ BIND ++ "-й" ; -- after vowel
fsnom = s ++ BIND ++ "-я" ;
nsnom = s ++ BIND ++ "-е" ;
pnom = s ++ BIND ++ "-е" ;
msgen = s ++ BIND ++ "-го" ; -- after consonant
fsgen = s ++ BIND ++ "-й" ;
pgen = s ++ BIND ++ "-х" ;
msdat = s ++ BIND ++ "-му" ;
fsacc = s ++ BIND ++ "-ю" ;
msins = s ++ BIND ++ "-м" ;
fsins = s ++ BIND ++ "-й" ;
pins = s ++ BIND ++ "-ми" ;
msprep= s ++ BIND ++ "-м" ;
sm, sf, sn, sp = s ;
comp = s ++ BIND ++ "-е" ; --*
p = False ;
preferShort=PreferFull
} ;
---------------
-- Adverbs -- Наречия
@@ -1334,6 +1411,12 @@ oper
oper
DetTable = Gender => Animacy => Case => Str ;
NumeralForms : Type = {
s : DetTable ;
o : PronForms ;
size : NumSize
} ;
NumDet : Type = {
s : DetTable ;
size : NumSize

View File

@@ -4,45 +4,28 @@ lin
-- : Adv -> S -> S ; -- then I will go home
AdvS adv s = {s=\\m => adv.s ++ s.s ! m} ;
-- : Adv -> S -> S ; -- next week, I will go home
ExtAdvS adv s = {s=\\m => adv.s ++ comma ++ s.s ! m} ; -- TODO: what is the case for this? embed in commas?
ExtAdvS adv s = {s=\\m => adv.s ++ comma ++ s.s ! m} ;
-- : Temp -> Pol -> Cl -> S ; -- she had not slept - она не спала
UseCl temp pol cl = {
s = table {
Infinitive => let parts = R.verbAgr cl.verb Infinitive temp.t cl.a pol.p in
temp.s ++ parts.p1 ++ cl.subj ++ pol.s ++ cl.adv ++ parts.p2 ++ cl.dep ++ cl.compl ;
Ind => let parts = R.verbAgr cl.verb Ind temp.t cl.a pol.p in
temp.s ++ parts.p1 ++ cl.subj ++ pol.s ++ cl.adv ++ parts.p2 ++ cl.dep ++ cl.compl ;
-- temp.s ++ cl.adv ++ pol.s ++ parts.p1 ++ parts.p2 ++ cl.dep ++ cl.subj ++ cl.compl ;
Sbjv => let parts = R.verbAgr cl.verb Sbjv temp.t cl.a pol.p in
temp.s ++ parts.p1 ++ cl.subj ++ pol.s ++ cl.adv ++ parts.p2 ++ cl.dep ++ cl.compl ;
Imperative => let parts = R.verbAgr cl.verb Imperative temp.t cl.a pol.p in
temp.s ++ parts.p1 ++ cl.subj ++ pol.s ++ cl.adv ++ parts.p2 ++ cl.dep ++ cl.compl
}
s : Mood => Str = \\m => temp.s ++ (R.verbEnvAgr cl.subj cl.adv cl.verb m temp.t cl.a pol) ++ cl.dep ++ cl.compl ;
} ;
-- : Temp -> Pol -> RCl -> RS ; -- that had not slept
UseRCl temp pol rcl = {
s = \\gn,anim,cas =>
let a : Agr = fromMaybe Agr (genNumAgrP3 gn) rcl.a in
let parts = R.verbAgr rcl.verb Ind temp.t a pol.p in
temp.s ++ parts.p1 ++ rcl.subj ! gn ! anim ! Nom ++ rcl.adv ! (genNumAgrP3 gn) ++ pol.s ++ parts.p2 ++ rcl.dep ++ rcl.compl ! (genNumAgrP3 gn)
temp.s
++ (R.verbEnvAgr (rcl.subj ! gn ! anim ! Nom) (rcl.adv ! (genNumAgrP3 gn)) rcl.verb Ind temp.t a pol)
++ rcl.dep ++ rcl.compl ! (genNumAgrP3 gn)
} ;
-- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
UseSlash temp pol cls = {
s = table {
Infinitive => let parts = R.verbAgr cls.verb Infinitive temp.t cls.a pol.p in
temp.s ++ parts.p1 ++ cls.subj ++ pol.s ++ cls.adv ++ parts.p2 ++ cls.dep ++ cls.compl ;
Ind => let parts = R.verbAgr cls.verb Ind temp.t cls.a pol.p in
temp.s ++ parts.p1 ++ cls.subj ++ pol.s ++ cls.adv ++ parts.p2 ++ cls.dep ++ cls.compl ;
Sbjv => let parts = R.verbAgr cls.verb Sbjv temp.t cls.a pol.p in
temp.s ++ parts.p1 ++ cls.subj ++ pol.s ++ cls.adv ++ parts.p2 ++ cls.dep ++ cls.compl ;
Imperative => let parts = R.verbAgr cls.verb Imperative temp.t cls.a pol.p in
temp.s ++ parts.p1 ++ cls.subj ++ pol.s ++ cls.adv ++ parts.p2 ++ cls.dep ++ cls.compl
} ;
s : Mood => Str = \\m => temp.s
++ (R.verbEnvAgr cls.subj cls.adv cls.verb m temp.t cls.a pol) ++ cls.dep ++ cls.compl ;
c=cls.c
} ;
} ;
-- : NP -> VPSlash -> ClSlash ; -- (whom) he sees
SlashVP np vps = {
@@ -92,8 +75,7 @@ lin
s = \\polarity, gn =>
let pol = case polarity of {Neg => PNeg; Pos => PPos} in
let a = Ag gn P2 in
let parts = R.verbAgr vp.verb Imperative Pres a pol.p in
parts.p1 ++ pol.s ++ parts.p2 ++ vp.dep ++ vp.adv ! a ++ vp.compl ! a
(R.verbEnvAgr "" "" vp.verb Imperative Pres a pol) ++ vp.adv ! a ++ vp.compl ! a
} ;
-- : NP -> VP -> Cl ; -- John walks - Иван гуляет
@@ -121,10 +103,7 @@ lin
-- : Temp -> Pol -> QCl -> QS ; -- who had not slept
UseQCl temp pol cl = {
s = table {_ =>
let parts = R.verbAgr cl.verb Ind temp.t cl.a pol.p in
temp.s ++ parts.p1 ++ cl.subj ++ pol.s ++ cl.adv ++ parts.p2 ++ cl.dep ++ cl.compl
}
s = \\qf => temp.s ++ (R.verbEnvAgr cl.subj cl.adv cl.verb Ind temp.t cl.a pol) ++ cl.dep ++ cl.compl
} ;
-- : QS -> SC ; -- who goes

View File

@@ -18,34 +18,34 @@ lin
whoPl_IP = who_pl ;
-- : IQuant ;
which_IQuant = (adjFormsAdjective (makeAdjectiveForms "который" "" "1a" PrefFull)) ** {
preferShort=PrefFull ;
which_IQuant = (adjFormsAdjective (makeAdjectiveForms "который" "" "1a" PreferFull)) ** {
preferShort=PreferFull ;
g=Neut ;
c=Nom
} ;
-- : Quant ;
this_Quant = (adjFormsAdjective this_forms) ** {
type=NormalDet ;
preferShort=PrefFull ;
preferShort=PreferFull ;
g=Neut ;
c=Nom
} ;
-- : Quant ;
that_Quant = (adjFormsAdjective that_forms) ** {
type=NormalDet ;
preferShort=PrefFull ;
preferShort=PreferFull ;
g=Neut ;
c=Nom
} ;
-- : Quant ;
no_Quant = (adjFormsAdjective (makeAdjectiveForms "никакой" "" "3b" PrefFull)) ** {
no_Quant = (adjFormsAdjective (makeAdjectiveForms "никакой" "" "3b" PreferFull)) ** {
type=NormalDet ;
preferShort=PrefFull ;
preferShort=PreferFull ;
g=Neut ;
c=Nom
} ;
above_Prep = mkPrep "над" Ins ;
above_Prep = mkPrep above_prep_ins_mod Ins ;
after_Prep = mkPrep "после" Gen ;
before_Prep = mkPrep "перед" Ins ;
behind_Prep = mkPrep "за" Ins ;
@@ -55,15 +55,15 @@ lin
during_Prep = mkPrep "в течение" Gen ;
except_Prep = mkPrep ["за исключением"] Gen ;
for_Prep = mkPrep "для" Gen ;
from_Prep = mkPrep "от" Gen ;
from_Prep = mkPrep ot_prep_gen_mod Gen ;
in8front_Prep = mkPrep "перед" Ins ;
in_Prep = mkPrep "в" Loc ;
in_Prep = mkPrep v_prep_mod Loc ;
on_Prep = mkPrep "на" Loc ;
part_Prep = {s="" ; c=Ptv ; hasPrep=False } ;
possess_Prep = {s="у" ; c=Gen ; hasPrep=False} ;
through_Prep = mkPrep "через" Acc ;
to_Prep = mkPrep "к" Dat ;
under_Prep = mkPrep "под" Ins ;
to_Prep = mkPrep k_prep_dat_mod Dat ;
under_Prep = mkPrep pod_prep_mod Ins ;
without_Prep = mkPrep "без" Gen ;
or_Conj = mkConj "или" Sg ;
@@ -72,7 +72,7 @@ lin
either7or_DConj = mkConj "либо" (comma ++ "либо") Sg ;
if_then_Conj = mkConj "если" (comma ++ "то") Sg ;
with_Prep = mkPrep "с" Ins ;
with_Prep = mkPrep s_prep_mod Ins ;
please_Voc = ss "пожалуйста" ;
@@ -100,12 +100,12 @@ lin
can8know_VV = {v=can; modal=\\a=>[]} ;
can_VV = {v=can; modal=\\a=>[]} ;
must_VV = {v=nullVerb; modal=adjFormsToShort (makeAdjectiveForms "должный" "" "1*a" PrefFull)} ;
must_VV = {v=nullVerb; modal=adjFormsToShort (makeAdjectiveForms "должный" "" "1*a" PreferFull)} ;
want_VV = {v=want; modal=\\a=>[]} ;
-- : Det ;
every_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "каждый" "" "1*a" PrefFull)).s ! GSg g;
s = \\g => (adjFormsAdjective (makeAdjectiveForms "каждый" "" "1*a" PreferFull)).s ! GSg g;
type=NormalDet ;
g = Masc ;
c = Nom ;
@@ -113,7 +113,7 @@ lin
} ;
-- : Det ;
someSg_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "некоторый" "" "1*a" PrefFull)).s ! GSg g;
s = \\g => (adjFormsAdjective (makeAdjectiveForms "некоторый" "" "1*a" PreferFull)).s ! GSg g;
type=NormalDet ;
g = Masc ;
c = Nom ;
@@ -121,15 +121,15 @@ lin
} ;
-- : Det ;
somePl_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "некоторый" "" "1*a" PrefFull)).s ! GPl;
s = \\g => (adjFormsAdjective (makeAdjectiveForms "некоторый" "" "1*a" PreferFull)).s ! GPl;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = NumAll ;
} ;
-- : Det ;
few_Det = { -- numeral! TODO: мало ? немного ?
s = \\g => (adjFormsAdjective (makeAdjectiveForms "немногий" "" "3a" PrefFull)).s ! GPl;
few_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "немногий" "" "3a" PreferFull)).s ! GPl;
type=NormalDet ;
g = Masc ;
c = Nom ;
@@ -137,7 +137,7 @@ lin
} ;
-- : Det ;
many_Det, much_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "многий" "" "3a" PrefFull)).s ! GPl;
s = \\g => (adjFormsAdjective (makeAdjectiveForms "многий" "" "3a" PreferFull)).s ! GPl;
type=NormalDet ;
g = Neut ;
c = Gen ;
@@ -166,8 +166,8 @@ lin
almost_AdA = ss "почти" ;
almost_AdN = ss "почти" ;
always_AdV = ss "всегда" ;
at_least_AdN = ss "по меньшей мере" ; -- TODO: ?
at_most_AdN = ss "самое большее" ; -- TODO: ?
at_least_AdN = ss "по меньшей мере" ;
at_most_AdN = ss "самое большее" ;
too_AdA = ss "слишком" ;
very_AdA = ss "очень" ;

View File

@@ -36,8 +36,8 @@ lin
-- : Symb -> Card ; -- n
SymbNum symb = {s = \\_,_,_ => symb.s ; size = Num5} ;
-- : Symb -> Ord ; -- n'th
SymbOrd symb = immutableAdjForms symb.s ; -- TODO: better implementation
-- : Symb -> Ord ; -- n'th (i-й "итый")
SymbOrd symb = ith_forms symb.s ;
lincat
Symb, [Symb] = SS ;

View File

@@ -47,7 +47,7 @@ lin
dep=[] ;
adv=\\a=>[] ;
compl=case ap.preferShort of {
PrefFull => (\\a => ap.s ! agrGenNum a ! Inanimate ! Ins) ;
PreferFull => (\\a => ap.s ! agrGenNum a ! Inanimate ! Ins) ;
PrefShort => ap.short
}
} ;
@@ -64,7 +64,7 @@ lin
c=v3.c2
} ;
-- : V3 -> NP -> VPSlash ; -- give (it) to her
-- : V3 -> NP -> VPSlash ; -- give (it) to her
Slash3V3 v3 np = {
adv=\\a=>[] ;
verb=v3 ;
@@ -80,7 +80,7 @@ lin
c=v2v.c
} ;
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
-- : V2S -> S -> VPSlash ; -- answer (to him) that it is good
SlashV2S v2s s = {
adv=\\a=>[] ;
verb=v2s ;
@@ -103,7 +103,7 @@ lin
verb=v2a ;
dep=[] ;
compl=case ap.preferShort of {
PrefFull => (\\a => ap.s ! agrGenNum a ! Animate ! v2a.c.c) ; -- TODO: Acc depends on animacy!
PreferFull => (\\a => ap.s ! agrGenNum a ! Animate ! v2a.c.c) ; -- TODO: Acc depends on animacy!
PrefShort => ap.short
} ;
c=v2a.c
@@ -130,7 +130,7 @@ lin
-- : VPSlash -> VP ; -- love himself
ReflVP vps = vps ** {
compl=\\a => vps.compl ! a ++ vps.c.s ++ sebya.s ! vps.c.c -- TODO: use applyPronounPrep (search all ".c.s" also)
compl=\\a => vps.compl ! a ++ vps.c.s ++ sebya.s ! vps.c.c
} ;
-- : Comp -> VP ; -- be warm
@@ -160,7 +160,7 @@ lin
VPSlashPrep vp prep = vp ** {c=prep} ;
-- : AP -> Comp ; -- (be) small
CompAP ap = case ap.preferShort of {
PrefFull => {s=\\a=>ap.s ! agrGenNum a ! Inanimate ! Ins ; adv=[] ; cop=InsCopula} ;
PreferFull => {s=\\a=>ap.s ! agrGenNum a ! Inanimate ! Ins ; adv=[] ; cop=InsCopula} ;
PrefShort => {s=ap.short ; adv=[] ; cop=EllCopula}
};

View File

@@ -542,7 +542,8 @@ oper
immutableAdjectiveCases : Str -> AdjForms
= \s -> {
msnom=s;fsnom=s;nsnom=s;pnom=s;msgen=s;fsgen=s;pgen=s;msdat=s;fsacc=s;msins=s;fsins=s;pins=s;msprep=s;sm=s;sf=s;sn=s;sp=s;comp=[];
preferShort=PrefFull
preferShort=PreferFull ;
p=False
} ;
makeAdjective : Str -> ZAIndex -> ShortFormPreference -> AdjForms
@@ -643,7 +644,8 @@ oper
sn = sstem + aef.sn ;
sp = sstem + aef.sp ;
comp = comps + aef.comp ;
preferShort = aef.preferShort
preferShort = aef.preferShort ;
p = aef.p
} ;
doAlternationsAdj : Str -> AdjForms -> DeclType -> AdjStressSchema -> ZCirc -> AdjForms
@@ -670,7 +672,8 @@ oper
sn = sstem + aef.sn ;
sp = sstem + aef.sp ;
comp = comps + aef.comp ;
preferShort = aef.preferShort
preferShort = aef.preferShort ;
p = False
} ;
endingsSelectionAdj : DeclType -> AlterType -> AdjStressSchema -> ShortFormPreference -> AdjForms
@@ -700,7 +703,8 @@ oper
sn = stressSelectionAdj aef1.sn ss "sn" ;
sp = stressSelectionAdj aef1.sp ss "sp" ;
comp = stressSelectionAdj aef1.comp ss "comp" ;
preferShort = sfp
preferShort = sfp ;
p = False
} ;
stressSelectionAdj : EndingSpec -> AdjStressSchema -> Str -> Str
@@ -745,14 +749,21 @@ oper
-----------
-- Pronouns
-- these are needed for numerals
pronounAdj1A : Str -> PronForms
= \word -> makeAdjective word (ZA 1 No A_ NoC) PreferFull ;
pronounAdj1B : Str -> PronForms
= \word -> makeAdjective word (ZA 1 No B_ NoC) PreferFull ;
pronounAdj1AstA : Str -> PronForms
= \word -> makeAdjective word (ZA 1 Ast A_ NoC) PreferFull ;
pronoun2AstB : Str -> PronForms
= \word -> -- весь
let cmp_base : Str = case word of {s + "ь" => s ; _ => word} in
let cmp_base : Str = case word of {s + "ь" => s ; _ => word} in --
let last = Predef.dp 1 cmp_base in
let butLast = Predef.tk 1 cmp_base in
let secondLast = Predef.dp 1 butLast in
let butTwolast = Predef.tk 2 cmp_base in
let thirdLast = Predef.dp 1 butTwolast in
let butTwolast = Predef.tk 2 cmp_base in --
let stem = cmp_base in
let stem2 = butTwolast + last in
{
@@ -771,6 +782,29 @@ oper
msprep=stem2 +"ем" ; --ём
} ;
pronoun6AstA : Str -> PronForms
= \word -> -- третий
let cmp_base : Str = case word of {_ => word} in --
let butTwolast = Predef.tk 2 cmp_base in --
let stem = cmp_base in --
let stem2 = butTwolast + "ь" in --
{
msnom=stem ;
fsnom=stem2 +"я" ;
nsnom=stem2 +"е" ;
pnom=stem2 +"и" ;
msgen=stem2 +"его" ;
fsgen=stem2 +"ей" ;
pgen=stem2 +"их" ;
msdat=stem2 +"ему" ;
fsacc=stem2 +"ю" ;
msins=stem2 +"им" ;
fsins=stem2 +"ей" ;
pins=stem2 +"ими" ;
msprep=stem2 +"ем" ;
} ;
--------
-- Verbs

File diff suppressed because it is too large Load Diff

View File

@@ -113,12 +113,66 @@ gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TFut ASimul) ? (PredVP (UsePron
gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TFut ASimul) ? (PredVP (UsePron he_Pron) (AdvVP (PassV2 learn_V2) (weekdayNextAdv ?))))) NoVoc) TEmpty |l -treebank
gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TPast ASimul) ? (PredVP (UsePron he_Pron) (AdvVP (PassV2 learn_V2) (weekdayLastAdv ?))))) NoVoc) TEmpty |l -treebank
gt TFullStop (PhrUtt NoPConj (UttS (UseCl (TTAnt TFut AAnter) PPos (PredVP (UsePron ?) (AdvVP (PassV2 teach_V2) (yearAdv (intYear 2024)))))) NoVoc) TEmpty |l -treebank
gt UseCl (TTAnt TPast ASimul) PPos (PredVP (MassNP (UseN boy_N)) (AdvVP (UseV fly_V) (PrepCN on_Prep (UseN (CompoundN carpet_N airplane_N))))) |l -treebank
gt UseComp (CompAdv here_Adv) | l -treebank
gt PredSCVP (EmbedVP (UseV think_V)) thirsty_VP | l -treebank
gt RelCl (PredVP (UsePN john_PN) (ComplSlashPartLast (SlashV2a love_V2) (UsePron she_Pron))) | l -treebank
gt UseRCl ? ? ( RelCl (PredVP (UsePN john_PN) (ComplSlashPartLast (SlashV2a love_V2) (UsePron she_Pron))) ) | l -treebank
gt RelNP (MassNP (UseN woman_N)) (UseRCl (TTAnt ? ASimul) ? (RelCl (PredVP (UsePN john_PN) (ComplSlashPartLast (SlashV2a love_V2) (UsePron she_Pron))))) | l -treebank
gt UseCl (TTAnt TPast ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (Slash3V3 talk_V3 (DetCN (DetQuant DefArt NumSg) (RelCN (UseN book_N) (UseRCl (TTAnt TPast ASimul) PPos (RelSlash IdRP (SlashVP (UsePron i_Pron) (SlashV2a read_V2))))))) (DetCN (DetQuant (PossPron i_Pron) NumPl) (UseN friend_N)))) | l -treebank
gt UseQCl (TTAnt TPres ASimul) PPos (QuestVP whatSg_IP (UseComp (CompNP (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN name_N))))) | l -treebank
gt UseQCl (TTAnt TPres ASimul) PPos (QuestIAdv how_IAdv (PredVP (UsePron youSg_Pron) (UseV fly_V))) | l -treebank
gt UseQCl (TTAnt ? ASimul) ? (QuestSlash whatSg_IP (SlashVP (UsePron she_Pron) (SlashV2a do_V2))) | l -treebank
gt UseQCl (TTAnt ? ASimul) PPos (QuestIComp (CompIAdv when_IAdv) (MassNP (UseN apple_N))) | l -treebank
gt UseQCl (TTAnt ? ASimul) PNeg (QuestIAdv when_IAdv (ImpersCl (AdvVP UseCopula (PrepNP part_Prep (MassNP (UseN apple_N)))))) | l -treebank
gt ImpVP (UseCopula) | l -treebank
gt CountNP many_Det (MassNP (UseN city_N)) | l -treebank
gt CountNP many_Det (UsePron they_Pron) | l -treebank
gt CountNP many_Det (UsePron we_Pron) | l -treebank
gt CountNP few_Det (MassNP (UseN city_N)) | l -treebank
gt UttAdV always_AdV | l -treebank
gt PrepNP above_Prep (MassNP (UseN (mouth_N))) | l -treebank
gt PrepNP above_Prep (MassNP (UseN (weekdayN tuesday_Weekday))) |l -treebank
gt (AdjOrd (OrdNumeral (num (pot2as3 (pot1as2 (pot1 ?)))))) |l -treebank
gt (AdjOrd (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 ?)))))) |l -treebank
gt OrdNumeral (num (pot3 (pot1as2 (pot0as1 (pot0 ?))))) | l -treebank
gt OrdNumeral (num (pot3 (pot1as2 pot110))) | l -treebank
gt OrdNumeral (num (pot3 (pot1as2 pot111))) | l -treebank
gt OrdNumeral (num (pot3 (pot1as2 (pot1to19 n2)))) | l -treebank
gt OrdNumeral (num (pot3 (pot1as2 (pot0as1 pot01)))) | l -treebank
gt OrdNumeral (num (pot3 (pot1as2 pot110))) | l -treebank
-- from extend
gt UseCl (TTAnt ? AAnter) ? (AdvIsNP everywhere_Adv (MassNP (UseN sky_N))) | l -treebank
gt UseCl (TTAnt ? AAnter) PPos (AdvIsNPAP everywhere_Adv (MassNP (UseN sky_N)) (PositA blue_A)) | l -treebank
gt UseCl ? PPos (ExistsNP (MassNP (UseN number_N))) | l -treebank
gt UseCl ? PPos (ExistNPAdv (MassNP (UseN house_N)) now_Adv ) | l -treebank
gt TFullStop (PhrUtt NoPConj (UttNP (MassNP (AdjCN (PositA full_A) (glass_of_CN (MassNP (UseN wine_N)))))) NoVoc) TEmpty | l -treebank
gt EmbedQS (UseQCl (TTAnt ? ASimul) ? (ExistIPAdv whatSg_IP now_Adv)) | l -treebank
gt UttCN (AdjCN (PositA red_A) (UseN house_N)) | l -treebank
gt UttCard (AdNum at_least_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n8))))))) | l -treebank
gt timeunitAdv (AdNum at_least_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 ?))))))) second_Timeunit | l -treebank
gt AdvS (timeunitAdv (AdNum at_least_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 ?))))))) second_Timeunit) (ExistS (TTAnt TFut ASimul) PPos (MassNP (cup_of_CN (MassNP (UseN water_N))))) | l -treebank
gt AdvS (timeunitAdv (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n9))))))) second_Timeunit) (ExistS (TTAnt TFut ASimul) PPos (MassNP (cup_of_CN (MassNP (UseN water_N))))) | l -treebank
gt AdvS (timeunitAdv (AdNum at_most_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 pot01)))))) second_Timeunit) (ExistS (TTAnt TFut ASimul) PPos (MassNP (cup_of_CN (MassNP (UseN water_N))))) |l -treebank
gt AdvS (timeunitAdv (AdNum almost_AdN (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) second_Timeunit) (ExistS (TTAnt TFut ASimul) PPos (MassNP (cup_of_CN (MassNP (UseN water_N))))) | l -treebank
-- these below sound unnatural
gt OrdNumeral (num (pot3 (pot1as2 (pot1plus n2 (pot0 ?))))) | l -treebank
-- here some participles are not formed correctly
gt AdjCN (PastPartAP ( SlashV2a ? ) ) (UseN house_N) | l -treebank
gt QuestCl ( PredSCVP (EmbedVP (UseV play_V)) thirsty_VP ) | l -treebank
gt UseQCl ? ? ( QuestCl (PredSCVP (EmbedVP (UseV play_V)) thirsty_VP) ) | l -treebank
gt UseQCl (TTAnt TCond AAnter) ? (QuestCl (PredSCVP (EmbedVP (UseV play_V)) thirsty_VP)) | l -treebank
@@ -139,3 +193,8 @@ gt UseCl ? ? ( PredSCVP (EmbedVP (UseV play_V)) (UseComp (CompAP (PositA clean
gt UseCl (TTAnt TPres ASimul) PPos (PredSCVP (EmbedVP (UseV play_V)) (UseComp (CompCN (AdjCN (PositA clean_A) (UseN war_N))))) | l -treebank
-- not implemented
gt AdjCN (AdjOrd (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))) )) (UseN apple_N) | l -treebank

View File

@@ -7,11 +7,17 @@ With what should be correct approach, produces:
> l DetCN (DetQuant (PossPron i_Pron) NumSg) (ConjCN and_Conj (ConsCN (UseN grammar_N) (BaseCN (UseN apple_N) (UseN flower_N))))
мой грамматика , яблоко и цветок
> l ComplN2 mother_N2 ( DetCN (DetQuant (PossPron i_Pron) NumSg) (ConjCN and_Conj (ConsCN (UseN grammar_N) (BaseCN (UseN apple_N) (UseN flower_N)))) )
мать моего грамматики , яблока и цветка
Correct text requires AdvNP tricks. Resulting trees are quite artificial, one example:
> l ConjNP and_Conj (ConsNP (AdvNP (DetNP (DetQuant (PossPron i_Pron) NumPl)) (PrepNP obj_no_Prep (DetCN (DetQuant DefArt NumSg) (UseN grammar_N)))) (BaseNP (MassNP (UseN apple_N)) (MassNP (UseN flower_N))))
мои грамматика , яблоко и цветок
> l ComplN2 mother_N2 ( ConjNP and_Conj (ConsNP (AdvNP (DetNP (DetQuant (PossPron i_Pron) NumPl)) (PrepNP obj_no_Prep (DetCN (DetQuant DefArt NumSg) (UseN grammar_N)))) (BaseNP (MassNP (UseN apple_N)) (MassNP (UseN flower_N)))) )
мать моих грамматика , яблока и цветка
Proper resolution? It's hard to go through Dets and Quants (and will make them more complex). Probably, correct solution would be to make the same as if possessive pronoun is an adjective:
> l MassNP (AdjCN (PositA red_A) (ConjCN and_Conj (ConsCN (UseN grammar_N) (BaseCN (UseN apple_N) (UseN flower_N)))))
@@ -53,3 +59,43 @@ AllRus: сколько является яблок у Ивана ?
AllRusAbs: UseCl (TTAnt TPres ASimul) PNeg (ExistsNP (MassNP (UseN number_N)))
AllRus: не существует число
Should be: не существует числа
## Copula negation is not that simple
AllRusAbs: ComplVS hope_VS (UseCl (TTAnt TPres AAnter) PNeg (have_name_Cl (UsePron he_Pron) (UsePN john_PN)))
AllRus: надеяться , что нет его имя Иван
AllRusAbs: UseCl (TTAnt TPres AAnter) PNeg (have_name_Cl (UsePron he_Pron) (UsePN john_PN))
AllRus: нет его имя Иван
AllRusAbs: UseCl (TTAnt TPres AAnter) PNeg (AdvIsNP everywhere_Adv (MassNP (UseN sky_N)))
AllRus: небо нет везде
(must be: небо не везде есть)
## Some past participles are not correct
> gt AdjCN (PastPartAP ( SlashV2a ? ) ) (UseN house_N) | l -treebank
AllRusAbs: AdjCN (PastPartAP (SlashV2a break_V2)) (UseN house_N)
AllRus: прерыван дом - прерываем
AllRusAbs: AdjCN (PastPartAP (SlashV2a buy_V2)) (UseN house_N)
AllRus: покупан дом - покупаем
AllRusAbs: AdjCN (PastPartAP (SlashV2a close_V2)) (UseN house_N)
AllRus: закрыван дом - закрываем
AllRusAbs: AdjCN (PastPartAP (SlashV2a find_V2)) (UseN house_N)
AllRus: нахожен дом - находим(ый)
AllRusAbs: AdjCN (PastPartAP (SlashV2a love_V2)) (UseN house_N)
AllRus: люблен дом -- любим(ый)
AllRusAbs: AdjCN (PastPartAP (SlashV2a seek_V2)) (UseN house_N)
AllRus: искан дом -- исканный
## Ordinals
OrdNumeral (num (pot3 (pot2plus pot01 pot111)))
should be: стоодиннадцатитысячное
> l OrdNumeral (num (pot3 (pot2 pot01)))
ста &+ тысячное
should be: стотысячное