mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-28 01:18:57 -06:00
(Hun) optimise Quant
This commit is contained in:
@@ -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 ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|||||||
@@ -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,10 +29,10 @@ 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
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
dt2objdef : DetType -> ObjDef = \dt -> case dt of {
|
dt2objdef : DetType -> ObjDef = \dt -> case dt of {
|
||||||
@@ -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 ;
|
||||||
|
|||||||
@@ -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 [] ;
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user