1
0
forked from GitHub/gf-rgl

(Hun) optimise Quant

This commit is contained in:
Inari Listenmaa
2020-11-28 19:35:00 +01:00
parent 8dc5daf664
commit df4ba9eb96
3 changed files with 14 additions and 27 deletions

View File

@@ -99,14 +99,13 @@ concrete NounHun of Noun = CatHun ** open
quant ** num ** { quant ** num ** {
s = \\c => case <isNum num,isIndefArt quant> of { s = \\c => case <isNum num,isIndefArt quant> of {
<True,True> => [] ; -- don't output "a 2 cars" <True,True> => [] ; -- don't output "a 2 cars"
_ => quant.s ! n ! c } _ => quant.s ! n ! c } -- az/azok a …
++ num.s ! Attrib ; -- TODO: add inflection table in numbers ++ num.s ! Attrib ; -- TODO: add inflection table in numbers
sp = \\c => case <isNum num,isIndefArt quant> of { sp = \\c => case <isNum num,isIndefArt quant> of {
<True,True> => [] ; <True,True> => [] ;
_ => quant.sp ! n ! c } _ => quant.sp ! n ! c } -- az/azok …
++ num.s ! Indep ; ++ num.s ! Indep ;
n = n ; n = n ;
dt = qt2dt quant.qt ;
} ; } ;
-- : Quant -> Num -> Ord -> Det ; -- these five best -- : Quant -> Num -> Ord -> Det ; -- these five best
@@ -170,20 +169,20 @@ concrete NounHun of Noun = CatHun ** open
DefArt = mkQuant "a" "a" ** { DefArt = mkQuant "a" "a" ** {
s, s,
sp = \\_,_ => pre {"a" ; "az" / v } ; sp = \\_,_ => pre {"a" ; "az" / v } ;
qt = DefQuant ; dt = DefDet ;
} ; } ;
-- : Quant -- : Quant
IndefArt = mkQuant "egy" [] ** { IndefArt = mkQuant "egy" [] ** {
s = \\n,_ => case n of {Sg => "egy" ; Pl => []} ; s = \\n,_ => case n of {Sg => "egy" ; Pl => []} ;
sp = \\n,_ => case n of {Sg => "egy" ; Pl => "sok"} ; sp = \\n,_ => case n of {Sg => "egy" ; Pl => "sok"} ;
qt = IndefArticle ; dt = IndefDet ;
} ; } ;
-- : Pron -> Quant -- : Pron -> Quant
PossPron pron = pron ** { PossPron pron = pron ** {
s,sp = \\_ => pron.s ; s,sp = \\_ => pron.s ;
qt = QuantPoss (agr2pstem pron.agr) ; dt = DetPoss (agr2pstem pron.agr) ;
caseagr = False ; caseagr = False ;
} ; } ;

View File

@@ -17,17 +17,11 @@ oper
-- Quant -- Quant
param param
QuantType =
IndefArticle -- Needed to prevent "a 2 cars"
| IndefQuant -- Not IndefArt, not poss, not def
| DefQuant
| QuantPoss PossStem -- Which possessive stem it takes
;
DetType = DetType =
DefDet -- distinction between Article and Other no longer needed DefDet
| IndefDet -- still need def or indef | IndefDet -- Def or Indef relevant for verb agreement
| DetPoss PossStem -- Sill need to know which stem it takes if Poss | DetPoss PossStem -- Which possessive stem it takes
; ;
-- Singular stems. Plural is always same, no need to add here. -- Singular stems. Plural is always same, no need to add here.
@@ -35,9 +29,9 @@ param
oper oper
-- standard trick to prevent "a one car" -- standard trick to prevent "a one car"
isIndefArt : {qt : QuantType} -> Bool = \quant -> isIndefArt : {dt : DetType} -> Bool = \quant ->
case quant.qt of { case quant.dt of {
IndefArticle => True ; IndefDet => True ;
_ => False _ => False
} ; } ;
@@ -51,12 +45,6 @@ oper
Indef => IndefDet Indef => IndefDet
} ; } ;
qt2dt : QuantType -> DetType = \qt -> case qt of {
QuantPoss x => DetPoss x ;
DefQuant => DefDet ;
_ => IndefDet
} ;
agr2pstem : Person*Number -> PossStem = \pn -> agr2pstem : Person*Number -> PossStem = \pn ->
case <pn.p1,pn.p2> of { case <pn.p1,pn.p2> of {
<P1,Pl> => dSg_rPl1 ; <P1,Pl> => dSg_rPl1 ;

View File

@@ -203,13 +203,13 @@ oper
Quant : Type = BaseQuant ** { Quant : Type = BaseQuant ** {
s, -- form that comes before noun: "{this} car" s, -- form that comes before noun: "{this} car"
sp : Number => Case => Str ; -- independent form, "I like {this}" (DetNP) sp : Number => Case => Str ; -- independent form, "I like {this}" (DetNP)
qt : QuantType ; dt : DetType ;
} ; } ;
mkQuant : (s,sp : Str) -> Quant = \s,sp -> { mkQuant : (s,sp : Str) -> Quant = \s,sp -> {
s = mkCaseNoun s ; s = mkCaseNoun s ;
sp = mkCaseNoun sp ; sp = mkCaseNoun sp ;
qt = DefQuant ; dt = DefDet ;
caseagr = True ; caseagr = True ;
poss = harm1 [] ; poss = harm1 [] ;
} ; } ;