1
0
forked from GitHub/gf-rgl

After checkign with tests, identified problems, fixed some - eg more fine-grained animNumSizeNum

This commit is contained in:
Roman Suzi
2020-08-10 00:03:05 +03:00
parent 84361d473d
commit bcadbaaf32
9 changed files with 58 additions and 23 deletions

View File

@@ -130,7 +130,7 @@ lin
let ap=adjFormsAdjective a in let ap=adjFormsAdjective a in
let as_n_units=(how_IAdv.s let as_n_units=(how_IAdv.s
++ card.s ! Neut ! Inanimate ! Nom ++ card.s ! Neut ! Inanimate ! Nom
++ cn.s ! numSizeNum Nom card.size ! (numSizeCase Nom card.size)) in { --? Nom? ++ cn.s ! animNumSizeNum cn.anim Nom card.size ! (numSizeCase Nom card.size)) in { --? Nom?
s=\\gn,anim,cas=> ap.s!gn!anim!cas ++ as_n_units ; s=\\gn,anim,cas=> ap.s!gn!anim!cas ++ as_n_units ;
short=\\a=> ap.short ! a ++ as_n_units ; short=\\a=> ap.short ! a ++ as_n_units ;
preferShort=PreferFull ; preferShort=PreferFull ;
@@ -140,7 +140,7 @@ lin
-- : Card -> CN -> NP -> NP ; -- x ounces of this flour -- : Card -> CN -> NP -> NP ; -- x ounces of this flour
n_units_of_NP card cn np = { n_units_of_NP card cn np = {
s = \\cas => card.s ! Neut ! Inanimate ! cas s = \\cas => card.s ! Neut ! Inanimate ! cas
++ cn.s ! numSizeNum cas card.size ! (numSizeCase cas card.size) ++ cn.s ! animNumSizeNum cn.anim cas card.size ! (numSizeCase cas card.size)
++ np.s ! Gen ; ++ np.s ! Gen ;
pron=False ; pron=False ;
a = Ag (gennum cn.g (numSizeNumber card.size)) P3 a = Ag (gennum cn.g (numSizeNumber card.size)) P3
@@ -150,7 +150,7 @@ lin
s=\\n,cas=> cn.s ! n ! cas s=\\n,cas=> cn.s ! n ! cas
++ "на" ++ "на"
++ card.s ! Neut ! Inanimate ! Nom ++ card.s ! Neut ! Inanimate ! Nom
++ cn_unit.s ! numSizeNum Nom card.size ! numSizeCase Nom card.size ++ cn_unit.s ! animNumSizeNum cn_unit.anim Nom card.size ! numSizeCase Nom card.size
} ; } ;
---------------------------------------------- ----------------------------------------------

View File

@@ -25,7 +25,7 @@ lin
beer_N = mkN "пиво" neuter inanimate ; beer_N = mkN "пиво" neuter inanimate ;
beg_V2V = dirV2 (mkV imperfective transitive "просить" "прошу" "просит" "4c"); beg_V2V = dirV2 (mkV imperfective transitive "просить" "прошу" "просит" "4c");
belly_N = mkN "живот" ; belly_N = mkN "живот" ;
big_A = (mkAltShort (mkA "большой" "больше") (mkA "великий")) ; big_A = (mkAltShort (mkA "большой" "больше" "4b") (mkA "великий")) ;
bike_N = mkN "велосипед" ; bike_N = mkN "велосипед" ;
bird_N = mkN "птица" feminine animate ; bird_N = mkN "птица" feminine animate ;
bite_V2 = mkV2 (mkV imperfective "кусать" "кусаю") ; bite_V2 = mkV2 (mkV imperfective "кусать" "кусаю") ;
@@ -59,7 +59,7 @@ lin
cheese_N = mkN "сыр" ; cheese_N = mkN "сыр" ;
child_N = (mkNAltPl (mkN "ребёнок" masculine animate "3*a") (mkN "деть")) ** {pins="детьми"}; child_N = (mkNAltPl (mkN "ребёнок" masculine animate "3*a") (mkN "деть")) ** {pins="детьми"};
church_N = mkN "церковь" feminine animate "8*e" ; church_N = mkN "церковь" feminine animate "8*e" ;
city_N = mkN "город" ; city_N = mkN "город" masculine inanimate "1c(1)" ;
clean_A = mkA "чистый" "чище"; clean_A = mkA "чистый" "чище";
clever_A = mkA "умный" "" "1*a/b"; clever_A = mkA "умный" "" "1*a/b";
close_V2 = mkV2 (mkV imperfective "закрывать" "закрываю"); close_V2 = mkV2 (mkV imperfective "закрывать" "закрываю");
@@ -196,7 +196,7 @@ lin
music_N = mkN "музыка" ; music_N = mkN "музыка" ;
name_N = mkN "имя" neuter inanimate "8°c"; name_N = mkN "имя" neuter inanimate "8°c";
narrow_A = mkA "узкий" "уже" "3*a/c'"; narrow_A = mkA "узкий" "уже" "3*a/c'";
near_A = mkA "близкий" "ближе"; near_A = mkA "близкий" "ближе" "3*a/c'";
neck_N = mkN "шея" feminine inanimate "6a"; neck_N = mkN "шея" feminine inanimate "6a";
new_A = mkA "новый" ; new_A = mkA "новый" ;
newspaper_N = mkN "газета" ; newspaper_N = mkN "газета" ;
@@ -246,7 +246,7 @@ lin
rub_V2 = mkV2 (mkV imperfective "тереть" "тру" "трёт"); rub_V2 = mkV2 (mkV imperfective "тереть" "тру" "трёт");
rubber_N = mkN "резина" ; rubber_N = mkN "резина" ;
rule_N = mkN "правило" ; rule_N = mkN "правило" ;
run_V = mkV imperfective intransitive "бегать" "бегу" "бежит" ; run_V = mkV imperfective intransitive "бегать" "бегаю" "бегает" ;
salt_N = mkN "соль" ; salt_N = mkN "соль" ;
sand_N = (mkNplus (mkN "песок" masculine inanimate "3*b")) ** {sptv="песку"} ; sand_N = (mkNplus (mkN "песок" masculine inanimate "3*b")) ** {sptv="песку"} ;
say_VS = mkVS (mkV imperfective "говорить" "говорю" "говорит") ; say_VS = mkVS (mkV imperfective "говорить" "говорю" "говорит") ;

View File

@@ -11,7 +11,7 @@ lin
let n = numSizeNumber det.size in { let n = numSizeNumber det.size in {
s=case det.type of { s=case det.type of {
_ => \\cas => det.s ! cn.g ! cn.anim ! cas _ => \\cas => det.s ! cn.g ! cn.anim ! cas
++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ++ cn.s ! animNumSizeNum cn.anim cas det.size ! numSizeCase cas det.size
} ; } ;
pron=False ; pron=False ;
a=Ag (gennum cn.g (forceMaybeNum cn.mayben n)) P3 a=Ag (gennum cn.g (forceMaybeNum cn.mayben n)) P3
@@ -99,7 +99,7 @@ lin
DetQuantOrd quant num ord = { DetQuantOrd quant num ord = {
s=\\g,a,cas => num.s ! g ! a ! cas s=\\g,a,cas => num.s ! g ! a ! cas
++ quant.s ! (gennum g (numSizeNumber num.size)) ! 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 ; ++ (adjFormsAdjective ord).s ! gennum quant.g (animNumSizeNum Inanimate cas num.size) ! Inanimate ! numSizeCase cas num.size ;
type=quant.type ; type=quant.type ;
g=quant.g ; g=quant.g ;
c=quant.c ; c=quant.c ;

View File

@@ -254,8 +254,7 @@ lin pot01 = {
attr => table { attr => table {
hund => \\ g, a, c => case <g, a, c> of { hund => \\ g, a, c => case <g, a, c> of {
<_, _, (Nom|VocRus|Acc)> => "сто"; <_, _, (Nom|VocRus|Acc)> => "сто";
<_, _, (Gen|Ptv|Dat|Pre|Loc)> => "ста"; <_, _, (Gen|Ptv|Dat|Ins|Pre|Loc)> => "ста"
<_, _, Ins> => "сотней"
} ; } ;
_ => \\ g, a, c => [] _ => \\ g, a, c => []
} ; } ;
@@ -383,7 +382,7 @@ lin pot2as3 n = {
-- : Sub1000 -> Sub1000000 ; -- m * 1000 -- : Sub1000 -> Sub1000000 ; -- m * 1000
lin pot3 n = { -- TODO: fix cases like: 111000, 100000 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 ; s = \\g, a, c => n.s ! attr ! Fem ! a ! c ++ mille.s ! animNumSizeNum Animate c n.size ! numSizeCase c n.size ;
o = prependPF (case n.just1 of { o = prependPF (case n.just1 of {
False => n.s ! attr ! Neut ! Inanimate ! Gen ++ BIND ; False => n.s ! attr ! Neut ! Inanimate ! Gen ++ BIND ;
True => "" True => ""
@@ -397,9 +396,9 @@ lin pot3 n = { -- TODO: fix cases like: 111000, 100000
-- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n -- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
lin pot3plus n m = { lin pot3plus n m = {
s = \\g, a, c => n.s ! attr ! Fem ! a ! c s = \\g, a, c => n.s ! attr ! Fem ! a ! c
++ mille.s ! numSizeNum c n.size ! numSizeCase c n.size ++ mille.s ! animNumSizeNum Animate c n.size ! numSizeCase c n.size
++ m.s ! indep ! g ! a ! c ; ++ m.s ! indep ! g ! a ! c ;
o = prependPF (n.s ! attr ! Neut ! Inanimate ! Nom ++ mille.s ! numSizeNum Nom n.size ! numSizeCase Nom n.size) o = prependPF (n.s ! attr ! Neut ! Inanimate ! Nom ++ mille.s ! animNumSizeNum Animate Nom n.size ! numSizeCase Nom n.size)
(m.o ! indep) ; -- TODO: chk (m.o ! indep) ; -- TODO: chk
just1 = False ; just1 = False ;
size = Num5 size = Num5

View File

@@ -66,7 +66,7 @@ lin
-- : IDet -> CN -> IP ; -- which five songs -- : IDet -> CN -> IP ; -- which five songs
IdetCN idet cn = caseTableToRecord (\\cas => idet.s ! cn.g ! cn.anim ! cas IdetCN idet cn = caseTableToRecord (\\cas => idet.s ! cn.g ! cn.anim ! cas
++ cn.s ! numSizeNum cas idet.size ! numSizeCase cas idet.size) ++ cn.s ! animNumSizeNum cn.anim cas idet.size ! numSizeCase cas idet.size)
(Ag (gennum cn.g (forceMaybeNum cn.mayben (numSizeNumber idet.size))) P3) cn.anim ; (Ag (gennum cn.g (forceMaybeNum cn.mayben (numSizeNumber idet.size))) P3) cn.anim ;
-- : IDet -> IP ; -- which five -- : IDet -> IP ; -- which five

View File

@@ -1433,18 +1433,20 @@ oper
= \ns -> case ns of {Num1 => Sg ; NumAll | Num2_4 | Num5 => Pl} ; = \ns -> case ns of {Num1 => Sg ; NumAll | Num2_4 | Num5 => Pl} ;
-- The following two used in tandem to form the word, controlled by numeral -- The following two used in tandem to form the word, controlled by numeral
numSizeNum : Case -> NumSize -> Number animNumSizeNum : Animacy -> Case -> NumSize -> Number
= \cas,ns -> case <cas,ns> of { = \anim,cas,ns -> case <anim,cas,ns> of {
<Nom|Acc,Num2_4> => Sg ; <Animate,Acc,Num2_4> => Pl ;
<_,Num1> => Sg ; <Inanimate,Acc,Num2_4> => Sg ;
<_,Nom,Num2_4> => Sg ;
<_,_,Num1> => Sg ;
_ => Pl _ => Pl
} ; } ;
numSizeCase : Case -> NumSize -> Case numSizeCase : Case -> NumSize -> Case
= \cas,ns -> case <cas,ns> of { = \cas,ns -> case <cas,ns> of {
<Nom,Num1 | NumAll> => Nom ; <Nom,Num1 | NumAll> => Nom ;
<Nom,Num2_4 | Num5> => Gen ; <Nom,Num2_4 | Num5> => Gen ;
<Acc,Num1 | NumAll> => Nom ; <Acc,Num2_4> => Gen ;
<Acc,Num2_4 | Num5> => Gen ; <Acc,Num5> => Gen ;
_ => cas _ => cas
} ; } ;
numSizeGenAgr : NumSize -> Gender -> Person -> Agr numSizeGenAgr : NumSize -> Gender -> Person -> Agr
@@ -1458,7 +1460,7 @@ oper
applyPrep : ComplementCase -> NounPhrase -> Str applyPrep : ComplementCase -> NounPhrase -> Str
= \prep,np -> case <np.pron, prep.hasPrep, prep.c> of { = \prep,np -> case <np.pron, prep.hasPrep, prep.c> of {
<True, True, Gen|Dat|Acc|Ins|Ptv> => prep.s ++ "н" ++ BIND ++ (np.s ! prep.c) ; <True, True, Gen|Dat|Acc|Ins|Ptv|Loc> => prep.s ++ "н" ++ BIND ++ (np.s ! prep.c) ;
_ => prep.s ++ np.s ! prep.c _ => prep.s ++ np.s ! prep.c
} ; } ;

View File

@@ -24,7 +24,7 @@ lin
-- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and
CNSymbNP det cn xs = { CNSymbNP det cn xs = {
s=\\cas => det.s ! cn.g ! cn.anim ! cas s=\\cas => det.s ! cn.g ! cn.anim ! cas
++ cn.s ! numSizeNum cas det.size ! numSizeCase cas det.size ++ cn.s ! animNumSizeNum cn.anim cas det.size ! numSizeCase cas det.size
++ xs.s ; ++ xs.s ;
pron=False ; pron=False ;
a=Ag (gennum cn.g (forceMaybeNum cn.mayben ((numSizeNumber det.size)))) P3 a=Ag (gennum cn.g (forceMaybeNum cn.mayben ((numSizeNumber det.size)))) P3

View File

@@ -130,6 +130,14 @@ gt UseQCl (TTAnt ? ASimul) ? (QuestSlash whatSg_IP (SlashVP (UsePron she_Pron) (
gt UseQCl (TTAnt ? ASimul) PPos (QuestIComp (CompIAdv when_IAdv) (MassNP (UseN apple_N))) | 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 UseQCl (TTAnt ? ASimul) PNeg (QuestIAdv when_IAdv (ImpersCl (AdvVP UseCopula (PrepNP part_Prep (MassNP (UseN apple_N)))))) | l -treebank
gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a write_V2) (DetCN (DetQuant DefArt (NumCard (NumDigits (IDig D_1)))) (UseN woman_N)) )) | l -treebank
gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a write_V2) (DetCN (DetQuant DefArt (NumCard (NumDigits (IDig D_2)))) (UseN woman_N)) )) | l -treebank
gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a write_V2) (DetCN (DetQuant DefArt (NumCard (NumDigits (IDig D_5)))) (UseN woman_N)) )) | l -treebank
gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a write_V2) (DetCN (DetQuant (PossPron youSg_Pron) NumSg) (UseN woman_N)))) | l -treebank
gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (UseComp (CompNP (DetNP (DetQuant this_Quant (NumCard (NumNumeral (num (pot3 (pot2plus pot01 (pot0as1 (pot0 n2)))))))))))) | l -treebank
gt UseCl (TTAnt TPres ASimul) PPos (GenericCl (UseComp (CompNP (DetNP (DetQuant this_Quant (NumCard (NumNumeral (num (pot3 (pot2 ?)))))))))) | l -treebank
gt ImpVP (UseCopula) | l -treebank gt ImpVP (UseCopula) | l -treebank
gt CountNP many_Det (MassNP (UseN city_N)) | 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 they_Pron) | l -treebank

View File

@@ -27,6 +27,27 @@ This would require some Russian-specific (though quite straightforwward) Pron ->
## Not clear ## Not clear
> gt UseCl (TTAnt TPres ASimul) PPos (ExistNP (MassNP (bottle_of_CN (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 ?)))))))) (UseN ashes_N))))) | l
linking ... OK
Languages: AllRus
бутылка этих двух пепла существует
** UseCl (TTAnt TPres ASimul) PPos (have_name_Cl (DetNP (DetQuant (PossPron i_Pron) NumSg)) somebody_NP)
LangRus-NEW> моего имя кто-то
** UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a like_V2) (DetNP (DetQuant (PossPron he_Pron) NumSg))))
LangRus-NEW> нравишься его
** UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a speak_V2) (DetNP (DetQuant (PossPron ∅) NumSg))))
LangRus-NEW> говоришь на его
** UseCl (TTAnt TPres ASimul) PPos (ExistNPAdv somebody_NP (timeHourMinute twoHour (NumNumeral (num (pot2as3 (pot1as2 (pot1 ∅)))))))
LangRus-NEW> кто-то в 2:двадцать существует
LangRus-OLD> [ExistNPAdv]
** UseCl (TTAnt TPres ASimul) PPos (GenericCl (ComplSlash (SlashV2a write_V2) (DetCN (DetQuant this_Quant (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (UseN worm_N))))
LangRus-NEW> пишешь этих двух червя
> l UttS (AdvS (AdAdv quite_Adv (ComparAdvAdj less_CAdv narrow_A everything_NP)) (UseCl (TTAnt TPres ASimul) PNeg (ExistNP something_NP))) > l UttS (AdvS (AdAdv quite_Adv (ComparAdvAdj less_CAdv narrow_A everything_NP)) (UseCl (TTAnt TPres ASimul) PNeg (ExistNP something_NP)))
довольно менее узко , чем всё что &+ -то не существует довольно менее узко , чем всё что &+ -то не существует
@@ -95,3 +116,8 @@ should be: стоодиннадцатитысячное
ста &+ тысячное ста &+ тысячное
should be: стотысячное should be: стотысячное
## Optimization
+ Slash2V3 1492992 (107136,31)
+ Slash3V3 1492992 (107136,31)
+ SlashV2VNP 71663616 (214272,62)