Solved some problems from todo

This commit is contained in:
Roman Suzi
2020-07-27 18:58:09 +03:00
parent 118240d38d
commit 1f1dec615b
11 changed files with 147 additions and 83 deletions

View File

@@ -55,12 +55,14 @@ lincat
Det, DAP = {
s : DetTable ;
type : DetType ; -- main purpose is to avoid emptiness of articles, but can be reused later for something else
g : Gender ;
c : Case ;
size : NumSize
} ;
Predet = ResRus.Adjective ** {size : NumSize} ;
Quant, IQuant = ResRus.Adjective ** {g: Gender; c: Case} ;
IQuant = ResRus.Adjective ** {g: Gender; c: Case} ;
Quant = ResRus.Adjective ** {g: Gender; c: Case; type: DetType} ;
Num, Numeral, Card = NumDet ;
Digits = {s : Str ; size: NumSize} ;
@@ -72,7 +74,8 @@ lincat
a : Agr
} ;
IP, RP = ResRus.IPronounForms ;
IP = ResRus.IPronounForms ;
RP = ResRus.RPronounForms ;
IComp = {s : AgrTable ; adv : Str ; cop : CopulaType } ;
IDet = {
s : DetTable ;
@@ -116,5 +119,5 @@ linref
QCl = \s -> s.subj ++ s.adv ++ (verbInf s.verb) ++ s.dep ++ s.compl ;
RCl = \s -> s.subj ! GSg Neut ! Inanimate ! Nom ++ s.adv ! Ag (GSg Neut) P3 ++ (verbInf s.verb) ++ s.dep ++ s.compl ! Ag (GSg Neut) P3 ;
IP = \s -> s.nom ;
RP = \s -> s.nom ;
RP = \s -> s.s!GSg Neut!Inanimate!Nom ;
}

View File

@@ -81,6 +81,7 @@ concrete ConjunctionRus of Conjunction =
-- ConjDet : Conj -> ListDAP -> Det ; -- his or her
ConjDet conj xs = {
s=\\g,anim,cas => conj.s1 ++ xs.s1 ! g ! anim ! cas ++ conj.s2 ++ xs.s2 ! g ! anim ! cas ;
type=NormalDet ; -- hopefully ok to drop empty cases
g=xs.g ;
c=xs.c ;
size=xs.size

View File

@@ -9,7 +9,20 @@ lin
-- : Det -> CN -> NP ; -- the man
DetCN det cn =
let n = numSizeNumber det.size in {
s=\\cas => det.s ! cn.g ! cn.anim ! cas ++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size;
s=case det.type of {
EmptyIndef => \\cas =>
let d=case (numSizeNum cas det.size ) of {Pl=>a_Pl_Det; _=>a_Det} in
d.s ! det.g ! Inanimate ! cas
++ det.s ! cn.g ! cn.anim ! cas
++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ;
EmptyDef => \\cas =>
let d=case (numSizeNum cas det.size ) of {Pl=>the_Pl_Det; _=>the_Det} in
d.s ! det.g ! Inanimate ! cas
++ det.s ! cn.g ! cn.anim ! cas
++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ;
_ => \\cas => det.s ! cn.g ! cn.anim ! cas
++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size
} ;
pron=False ;
a=Ag (gennum det.g n) P3
} ;
@@ -42,7 +55,11 @@ lin
-- : Det -> NP ; -- these five
DetNP det = {
s=\\cas => det.s ! det.g ! Inanimate ! cas ;
s=case det.type of {
EmptyIndef => \\cas => a_Det.s ! det.g ! Inanimate ! cas ++ det.s ! det.g ! Inanimate ! cas ;
EmptyDef => \\cas => the_Det.s ! det.g ! Inanimate ! cas ++ det.s ! det.g ! Inanimate ! cas ;
_ => \\cas => det.s ! det.g ! Inanimate ! cas
} ;
pron=False ;
a=Ag (gennum det.g (numSizeNumber det.size)) P3
} ;
@@ -78,7 +95,8 @@ lin
-- : Quant -> Num -> Det ; -- these five
DetQuant quant num = {
s=\\g,a,cas => quant.s ! (gennum g (numSizeNumber num.size)) ! a ! cas ++ num.s ! g ! a ! cas ;
s=\\g,anim,cas => quant.s ! (gennum g (numSizeNumber num.size)) ! anim ! cas ++ num.s ! g ! anim ! cas ;
type=quant.type ;
g=quant.g ;
c=quant.c ;
size=num.size
@@ -89,6 +107,7 @@ lin
s=\\g,a,cas => num.s ! g ! a ! cas
++ quant.s ! (gennum g (numSizeNumber num.size)) ! a ! cas
++ (adjFormsAdjective ord).s ! gennum quant.g (numSizeNum cas num.size) ! Inanimate ! numSizeCase cas num.size ;
type=quant.type ;
g=quant.g ;
c=quant.c ;
size=num.size
@@ -109,7 +128,14 @@ lin
OrdSuperl a = long_superlative a ;
-- : Pron -> Quant ; -- my (house)
PossPron pron = {s=mkPronTable pron.poss ; short=\\a=>[] ; g=Neut; c=Nom; preferShort=PrefFull} ;
PossPron pron = {
s=mkPronTable pron.poss ;
type=NormalDet ;
short=\\a=>[] ;
g=Neut ;
c=Nom ;
preferShort=PrefFull
} ;
-- : AdN -> Card -> Card
AdNum adn card = card ** {
@@ -165,7 +191,7 @@ lin
CountNP det np = {
s=\\cas => det.s ! Neut ! Inanimate ! cas ++ selectCase np.s from2 ;
pron=False ;
a=np.a
a=numSizeGenAgr det.size Neut P3
} ;
---------------------------------------------------
@@ -176,16 +202,31 @@ lin
s=\\g,anim,cas => ap.s ! GSg g ! anim ! cas ++ dap.s ! g ! anim ! cas
} ;
-- DetDAP : Det -> DAP ; -- this (or that)
-- : Det -> DAP ; -- this (or that)
DetDAP det = det ;
---------------------------------------------------
-- Backwards compatibility
-- : Quant ; -- the (house), the (houses)
DefArt = adjFormsAdjective the_forms ** {preferShort=PrefFull ; g=Neut ; c=Nom} ;
DefArt = {
s=\\gn,anim,cas=>[] ;
type=EmptyDef ;
short=\\a=>[] ;
c=Nom ;
g=Neut ;
size=Num1 ;
preferShort=PrefFull
} ;
-- DefArt = adjFormsAdjective the_forms ** {preferShort=PrefFull ; g=Neut ; c=Nom} ;
-- : Quant ; -- a (house), (houses)
-- IndefArt = {s = \\gn,anim,cas=>[] ; short=\\a=>[] ; c=Nom; g = Neut; size = Num1 ; preferShort=PrefFull};
IndefArt = adjFormsAdjective a_forms ** {preferShort=PrefFull ; g=Neut ; c=Nom} ;
IndefArt = {
s=\\gn,anim,cas=>[] ;
type=EmptyIndef ;
short=\\a=>[] ;
c=Nom ;
g=Neut ;
size=Num1 ;
preferShort=PrefFull
} ;
}

View File

@@ -220,9 +220,9 @@ lin pot2plus d e =
lin pot2as3 n =
{s = n.s ! indep ; size = n.size} ;
lin pot3 n =
{s = \\ g, a, c => n.s ! attr ! Fem ! a ! c ++ mille ! n.size ; size = Num5} ;
{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 ! n.size ++ m.s ! indep ! g ! a ! c ; size = Num5} ;
{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} ;
--- TODO
--- raz/odin

View File

@@ -227,6 +227,7 @@ oper
let sg1=stemPresSg1 + endPresSg1 in
let sg3 : Str = case bconj of {
First => (Z.sg1StemFromVerb sg1) + "ет" ;
Mixed => (Z.sg1StemFromVerb sg1) + "чет" ;
FirstE => (Z.sg1StemFromVerb sg1) + "ёт" ;
Second | SecondA => (Z.sg1StemFromVerb sg1) + "ит" ;
_ => (Z.sg1StemFromVerb sg1) + "ет"

View File

@@ -31,6 +31,7 @@ param
ShortFormPreference = PrefShort | PrefFull ;
CopulaType = NomCopula | InsCopula | EllCopula;
SpecialFuture = NormalFuture | BeFuture | CanFuture | WantFuture | NullFuture ;
DetType = NormalDet | EmptyDef | EmptyIndef ; -- artificial parameter to side-step DetNP parsing issues
oper
-- GenNum helpers and coercions
MSg = GSg Masc ;

View File

@@ -15,8 +15,8 @@ lin
a=cl.a
} ;
-- : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp cls = let rp_as_adj = rp.poss ** {preferShort=PrefFull; sf,sm,sn,sp,comp = []} in {
subj=(adjFormsAdjective rp_as_adj).s ; -- TODO: cls.c and applyPrep not used?
RelSlash rp cls = {
subj=rp.s ;
adv=\\a=>cls.adv ; -- TODO: this should be after subj in this case
verb=cls.verb ;
dep=cls.dep ;
@@ -24,10 +24,9 @@ lin
a=cls.a
} ;
-- RelVP : RP -> VP -> RCl ; -- who loves John
RelVP rp vp =
let rp_as_adj = rp.poss ** {preferShort=PrefFull; sf,sm,sn,sp,comp = []} in {
subj=(adjFormsAdjective rp_as_adj).s ;
-- : RP -> VP -> RCl ; -- who loves John
RelVP rp vp = {
subj=rp.s;
adv=\\a=>[] ;
verb=vp.verb ;
dep=vp.dep ;
@@ -36,9 +35,11 @@ lin
} ;
-- : RP ; -- which
IdRP = lin RP (doKotoryjPron "который" (Ag (GSg Neut) P3) Inanimate) ;
IdRP = lin RP (doKotoryjPron "который" (Ag (GSg Neut) P3)) ;
-- Prep -> NP -> RP -> RP ; -- the mother of whom
FunRP prep np rp = (prependIP (np.s ! Nom ++ prep.s) rp) ; -- TODO: This is wrong... RP should be in agreement, but with records it's a bit hard...
FunRP prep np rp = {
s=\\gn,anim,cas => np.s ! cas ++ prep.s ++ rp.s ! gn ! Inanimate ! prep.c ;
a=np.a
} ;
}

View File

@@ -686,6 +686,11 @@ oper
a : Agr
} ;
RPronounForms : Type = {
s : AdjTable ;
a : Agr
} ;
PronTable = GenNum => Animacy => Case => Str ;
mkPronTable : PronForms -> PronTable
@@ -1019,20 +1024,13 @@ oper
prep, loc = ch + "ом" ;
ins = ch + "ем" ;
poss = (doChPron subPoss a anim).poss
} ;
} ;
doKotoryjPron : Str -> Agr -> Animacy -> IPronounForms
= \w, a, anim -> -- "который", "некоторый"
let stem = (Predef.tk 2 w) in {
doKotoryjPron : Str -> Agr -> RPronounForms
= \w, a -> { -- "который"
a = a ;
anim=anim ;
nom, voc = stem + "ое" ;
gen, acc, ptv = stem + "ого" ;
dat = stem + "ому" ;
prep, loc = stem + "ом" ;
ins = stem + "ым" ;
poss = guessAdjectiveForms w
} ;
s=(adjFormsAdjective (guessAdjectiveForms w)).s
} ;
prependIP : Str -> IPronounForms -> IPronounForms
= \s,ip -> ip ** {
@@ -1056,8 +1054,8 @@ oper
fsins = s ++ ip.poss.fsins ;
pins = s ++ ip.poss.pins ;
msprep= s ++ ip.poss.msprep ;
}
} ;
}
} ;
appendToIP : IPronounForms -> Str -> IPronounForms
= \ip,s -> ip ** {
@@ -1165,17 +1163,17 @@ oper
fsacc = "эту" ;
msins = "этим" ;
fsins = "этой" ;
pins = "этих" ;
pins = "этими" ;
msprep = "этом" ;
preferShort = PrefFull ;
comp = []
} ;
a_forms = { -- these are approximate translations of indef article; preventing DetNP parsing problems
a_forms = { -- this pronoun is an approximate translation of indef article; preventing DetNP parsing problems
msnom, sm = "некий" ;
fsnom, sf = "некая" ;
nsnom, sn = "некое" ;
pnom, sp = "некии" ;
pnom, sp = "некие" ;
msgen = "некого" ;
fsgen = "некой" ;
pgen = "неких" ;
@@ -1189,7 +1187,24 @@ oper
comp = []
} ;
the_forms = { -- these are approximate translations of def article; preventing DetNP parsing problems
a_Det = {
s : DetTable = \\g => (adjFormsAdjective a_forms).s ! GSg g;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = Num1 ;
} ;
a_Pl_Det = {
s : DetTable = \\g => (adjFormsAdjective a_forms).s ! GPl;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = NumAll ;
} ;
the_forms = { -- this pronoun is an approximate translation of def article; preventing DetNP parsing problems
msnom, sm = "данный" ;
fsnom, sf = "данная" ;
nsnom, sn = "данное" ;
@@ -1207,6 +1222,22 @@ oper
comp = []
} ;
the_Det = {
s : DetTable = \\g => (adjFormsAdjective the_forms).s ! GSg g;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = Num1 ;
} ;
the_Pl_Det = {
s : DetTable = \\g => (adjFormsAdjective the_forms).s ! GPl;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = NumAll ;
} ;
---------------
-- Numerals -- Числительные
---------------
@@ -1214,11 +1245,7 @@ oper
param DForm = unit | teen | ten | hund ;
param Place = attr | indep ;
oper
mille : NumSize => Str = table {
Num1 => "тысяча" ;
Num2_4 => "тысячи" ; -- NumAll ?
_ => "тысяч"
} ;
mille : Noun = nounFormsNoun ((guessNounForms "тысяча") ** {sins=variants {"тысячей" ; "тысячью"}});
---------------
-- Adverbs -- Наречия
@@ -1258,6 +1285,8 @@ oper
<Acc,Num2_4 | Num5> => Gen ;
_ => cas
} ;
numSizeGenAgr : NumSize -> Gender -> Person -> Agr
= \ns,g,p -> Ag (case ns of {Num1 => GSg g ; NumAll | Num2_4 | Num5 => GPl}) p ;
oper -- TODO:
ComplementCase : Type = {s : Str ; c : Case ; hasPrep : Bool} ;

View File

@@ -24,9 +24,9 @@ lin
-- : Temp -> Pol -> RCl -> RS ; -- that had not slept
UseRCl temp pol rcl = {
s = \\gn,anim,cas =>
let parts = R.verbAgr rcl.verb Ind temp.t rcl.a pol.p in
let a=genNumAgrP3 gn in
temp.s ++ parts.p1 ++ rcl.subj ! gn ! anim ! cas ++ pol.s ++ rcl.adv ! a ++ parts.p2 ++ rcl.dep ++ rcl.compl ! a ;
let parts = R.verbAgr rcl.verb Ind temp.t a pol.p in
temp.s ++ parts.p1 ++ pol.s ++ rcl.subj ! gn ! anim ! cas ++ rcl.adv ! a ++ parts.p2 ++ rcl.dep ++ rcl.compl ! a ;
c = Nom
} ;

View File

@@ -17,22 +17,29 @@ lin
whoSg_IP = who_sg ;
whoPl_IP = who_pl ;
-- : IQuant ;
which_IQuant = (adjFormsAdjective (makeAdjectiveForms "который" "" "1a" PrefFull)) ** {
preferShort=PrefFull ;
g=Neut ;
c=Nom
} ;
-- : Quant ;
this_Quant = (adjFormsAdjective this_forms) ** {
type=NormalDet ;
preferShort=PrefFull ;
g=Neut ;
c=Nom
} ;
-- : Quant ;
that_Quant = (adjFormsAdjective that_forms) ** {
type=NormalDet ;
preferShort=PrefFull ;
g=Neut ;
c=Nom
} ;
-- : Quant ;
no_Quant = (adjFormsAdjective (makeAdjectiveForms "никакой" "" "3b" PrefFull)) ** {
type=NormalDet ;
preferShort=PrefFull ;
g=Neut ;
c=Nom
@@ -96,34 +103,42 @@ lin
must_VV = {v=nullVerb; modal=adjFormsToShort (makeAdjectiveForms "должный" "" "1*a" PrefFull)} ;
want_VV = {v=want; modal=\\a=>[]} ;
-- : Det ;
every_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "каждый" "" "1*a" PrefFull)).s ! GSg g;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = Num1 ;
} ;
-- : Det ;
someSg_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "некоторый" "" "1*a" PrefFull)).s ! GSg g;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = Num1 ;
} ;
-- : Det ;
somePl_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "некоторый" "" "1*a" PrefFull)).s ! GPl;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = NumAll ;
} ;
-- : Det ;
few_Det = { -- numeral! TODO: мало ? немного ?
s = \\g => (adjFormsAdjective (makeAdjectiveForms "немногий" "" "3a" PrefFull)).s ! GPl;
type=NormalDet ;
g = Masc ;
c = Nom ;
size = NumAll ;
} ;
-- : Det ;
many_Det, much_Det = {
s = \\g => (adjFormsAdjective (makeAdjectiveForms "многий" "" "3a" PrefFull)).s ! GPl;
type=NormalDet ;
g = Neut ;
c = Gen ;
size = NumAll

View File

@@ -1,32 +1,19 @@
# Some problematic places
AllRusAbs: UseCl (TTAnt TFut ASimul) PPos (PredVP (AdvNP (CountNP much_Det (DetCN (DetQuant DefArt NumSg) (UseN house_N))) (weekdayNextAdv monday_Weekday)) ready_VP)
AllRus: многие из дом в следующий понедельник будет готовым
> l UttS (AdvS (AdAdv quite_Adv (ComparAdvAdj less_CAdv narrow_A everything_NP)) (UseCl (TTAnt TPres ASimul) PNeg (ExistNP something_NP)))
довольно менее узко , чем всё не существовает что &+ -то
Lang: DetCN many_Det (RelCN (UseN bike_N) (UseRCl (TTAnt TPres AAnter) PNeg (RelVP IdRP (UseV fall_V))))
LangRus: многие велосипеды , которые не падает
Lang: DetCN (DetQuantOrd (PossPron he_Pron) (NumCard (NumDigits (IDig D_0))) (OrdSuperl bad_A)) (RelCN (ConjCN both7and_DConj (BaseCN (UseN2 mother_N2) (UseN lamp_N))) (UseRCl (TTAnt TPast ASimul) PNeg (RelCl (ImpersCl ready_VP))))
LangRus: 0 его самых плохих как матерей , так и ламп , таких не , что бы &+ ло готово
LangRus: 0 его самых плохих как матерей , так и ламп , таких не , что бы &+ ли готовым
Lang: AdvS there7from_Adv (UseCl (TTAnt TFut AAnter) PPos (CleftNP everybody_NP (UseRCl (TTAnt TPres AAnter) PPos (RelSlash (FunRP in8front_Prep (languageNP polish_Language) IdRP) (SlashPrep (PredVP somebody_NP hungry_VP) through_Prep)))))
LangRus: оттуда это все , польский перед которые голоден
LangRus: оттуда все это , польский перед которыми голоден
Lang: ComplN3 distance_N3 (DetCN (DetQuant (PossPron youPol_Pron) NumSg) (SentCN (ComplN2 brother_N2 everything_NP) (EmbedVP hungry_VP)))
LangRus: расстояние от вашего брат всего быть голодно до
> l (RelNP everybody_NP (UseRCl (TTAnt TFut ASimul) PPos (RelVP IdRP ill_VP)))
все , которые будет больны
AllRusAbs: UseCl (TTAnt TPres AAnter) PNeg (CleftNP (PredetNP not_Predet (CountNP somePl_Det everybody_NP)) (UseRCl (TTAnt TFut AAnter) PNeg (RelVP IdRP ready_VP)))
AllRus: это не не некоторые из всех , которые не будет готовы
> l (AdvS (weekdayNextAdv saturday_Weekday) (UseCl (TTAnt TPres AAnter) PNeg (GenericCl UseCopula)))
в следующий суббота не являешься
AllRus: не некоторые из всех не это , которые не будут готовыми
> l PrepNP above_Prep (UsePron i_Pron)
над мной
@@ -38,22 +25,7 @@ AllRus: это не не некоторые из всех , которые не
AllRusAbs: UttImpPol PPos (ImpVP (ComplSlash (Slash2V3 add_V3 everybody_NP) (PPartNP somebody_NP drink_V2)))
AllRus: складываем &+ те всех в кого &+ -то пит
** UseCl (TTAnt TPres ASimul) PPos (ExistNP (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot1 ∅))))))) (UseN worm_N)))
LangRus-NEW> существуют двадцать эти червей
** UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot1 ∅))))))) (UseN woman_N))))
LangRus-NEW> нравишься двадцати этим женщин
** UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a speak_V2) (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 ∅)))))))) (UseN person_N))))
LangRus-NEW> говоришь на двух этих лица
** UseCl (TTAnt TPres ASimul) PPos (ExistNP (CountNP someSg_Det (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot1 ∅))))))) (UseN worm_N))))
LangRus-NEW> существуют некоторое из двадцати этих червей
Lang: AdvVP (ExtAdvVP (ComplVV must_VV (AdVVP always_AdV scared_VP)) (weekdayNextAdv tuesday_Weekday)) here7from_Adv
LangRus: должно всегда бояться , в следующую вторник , отсюда
> l AdvVP (ComplSlash (SlashV2V beg_V2V ready_VP) (ExtAdvNP everybody_NP there7from_Adv)) already_Adv
просить быть готовыми всех , оттуда , уже
LangRus-NEW> некоторое из этих двадцати червей существует
Inherent number for nouns. eg, for geonames or pluralia tantum.