(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 ** {
s = \\c => case <isNum num,isIndefArt quant> of {
<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
sp = \\c => case <isNum num,isIndefArt quant> of {
<True,True> => [] ;
_ => quant.sp ! n ! c }
_ => quant.sp ! n ! c } -- az/azok …
++ num.s ! Indep ;
n = n ;
dt = qt2dt quant.qt ;
} ;
-- : Quant -> Num -> Ord -> Det ; -- these five best
@@ -170,20 +169,20 @@ concrete NounHun of Noun = CatHun ** open
DefArt = mkQuant "a" "a" ** {
s,
sp = \\_,_ => pre {"a" ; "az" / v } ;
qt = DefQuant ;
dt = DefDet ;
} ;
-- : Quant
IndefArt = mkQuant "egy" [] ** {
s = \\n,_ => case n of {Sg => "egy" ; Pl => []} ;
sp = \\n,_ => case n of {Sg => "egy" ; Pl => "sok"} ;
qt = IndefArticle ;
dt = IndefDet ;
} ;
-- : Pron -> Quant
PossPron pron = pron ** {
s,sp = \\_ => pron.s ;
qt = QuantPoss (agr2pstem pron.agr) ;
dt = DetPoss (agr2pstem pron.agr) ;
caseagr = False ;
} ;

View File

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

View File

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