forked from GitHub/gf-rgl
(Hun) Merge the param Number into NumType: NoNum {Sg|Pl} | IsNum
This commit is contained in:
@@ -78,7 +78,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in {
|
||||
|
||||
Card = ResHun.Numeral ;
|
||||
Numeral = ResHun.Numeral ;
|
||||
Digits = {s : CardOrd => Str ; n : Number} ;
|
||||
Digits = {s : CardOrd => Str} ;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -88,23 +88,27 @@ concrete NounHun of Noun = CatHun ** open
|
||||
-- quantifier and an optional numeral can be discerned.
|
||||
|
||||
-- : Quant -> Num -> Det ;
|
||||
DetQuant quant num = quant ** num ** {
|
||||
s = \\c => case <isNum num,isIndefArt quant> of {
|
||||
<True,True> => [] ; -- don't output "a 2 cars"
|
||||
_ => quant.s ! num.n ! c }
|
||||
++ num.s ! Attrib ; -- TODO: add inflection table in numbers
|
||||
sp = \\c => case <isNum num,isIndefArt quant> of {
|
||||
<True,True> => [] ;
|
||||
_ => quant.sp ! num.n ! c }
|
||||
++ num.s ! Indep ;
|
||||
dt = qt2dt quant.qt ;
|
||||
} ;
|
||||
DetQuant quant num = let n = num2number num.n in
|
||||
quant ** num ** {
|
||||
s = \\c => case <isNum num,isIndefArt quant> of {
|
||||
<True,True> => [] ; -- don't output "a 2 cars"
|
||||
_ => quant.s ! n ! c }
|
||||
++ num.s ! Attrib ; -- TODO: add inflection table in numbers
|
||||
sp = \\c => case <isNum num,isIndefArt quant> of {
|
||||
<True,True> => [] ;
|
||||
_ => quant.sp ! n ! c }
|
||||
++ num.s ! Indep ;
|
||||
n = n ;
|
||||
dt = qt2dt quant.qt ;
|
||||
} ;
|
||||
|
||||
-- : Quant -> Num -> Ord -> Det ; -- these five best
|
||||
DetQuantOrd quant num ord =
|
||||
let theseFive = DetQuant quant num in theseFive ** {
|
||||
s = \\c => theseFive.s ! c ++ ord.s ! num.n ! Nom ;
|
||||
sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ! Nom ;
|
||||
let theseFive = DetQuant quant num ;
|
||||
n = num2number num.n ;
|
||||
in theseFive ** {
|
||||
s = \\c => theseFive.s ! c ++ ord.s ! n ! Nom ;
|
||||
sp = \\c => theseFive.sp ! c ++ ord.s ! n ! Nom ;
|
||||
} ;
|
||||
|
||||
-- Whether the resulting determiner is singular or plural depends on the
|
||||
@@ -115,17 +119,16 @@ concrete NounHun of Noun = CatHun ** open
|
||||
-- the inherent number.
|
||||
|
||||
NumSg = baseNum ;
|
||||
NumPl = baseNum ** {n = Pl} ;
|
||||
NumPl = baseNum ** {n = NoNum Pl} ;
|
||||
|
||||
-- : Card -> Num ;
|
||||
NumCard card = card ** {
|
||||
n = Sg -- Numerals take noun in Sg: e.g. öt város, literally 'five city'
|
||||
n = IsNum -- Numerals take noun in Sg: e.g. öt város, literally 'five city'
|
||||
} ;
|
||||
|
||||
-- : Digits -> Card ;
|
||||
NumDigits dig = dig ** {
|
||||
s = \\place => dig.s ! NCard ;
|
||||
numtype = IsNum ;
|
||||
} ;
|
||||
|
||||
-- : Numeral -> Card ;
|
||||
|
||||
@@ -179,13 +179,16 @@ param
|
||||
|
||||
CardOrd = NOrd | NCard ; -- Not used yet
|
||||
|
||||
NumType = NoNum | IsNum ;
|
||||
NumType = NoNum Number | IsNum ;
|
||||
|
||||
oper
|
||||
isNum : {numtype : NumType} -> Bool = \nt -> case nt.numtype of {
|
||||
NoNum => False ;
|
||||
_ => True
|
||||
isNum : {n : NumType} -> Bool = \n -> case n.n of {
|
||||
IsNum => True ;
|
||||
_ => False
|
||||
} ;
|
||||
|
||||
num2number : NumType -> Number = \n ->
|
||||
case n of {NoNum x => x ; IsNum => Sg} ;
|
||||
--------------------------------------------------------------------------------
|
||||
-- Adjectives
|
||||
|
||||
|
||||
@@ -230,9 +230,12 @@ oper
|
||||
s,sp = mkCaseNoun2 no ac ! n ;
|
||||
} ;
|
||||
|
||||
-- No need for number:
|
||||
-- https://en.wikisource.org/wiki/Simplified_Grammar_of_the_Hungarian_Language/Nouns
|
||||
-- "Nouns are used in the singular only, if preceded by a numeral or any other
|
||||
-- word expressing quantity; as két ember, two men; sok fa, many trees."
|
||||
Numeral : Type = {
|
||||
s : Place => Str ; -- Independent or attribute
|
||||
numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages
|
||||
-- TODO add ordinal
|
||||
} ;
|
||||
|
||||
@@ -241,13 +244,12 @@ oper
|
||||
Noun.gf: NumCard : Card -> Num ;
|
||||
-}
|
||||
Num : Type = Numeral ** {
|
||||
n : Number ; -- Singular or plural
|
||||
n : NumType ; -- Singular, plural or numeral
|
||||
} ;
|
||||
|
||||
baseNum : Num = {
|
||||
s = \\_ => [] ;
|
||||
n = Sg ;
|
||||
numtype = NoNum
|
||||
n = NoNum Sg ;
|
||||
} ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user