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 ;
|
Card = ResHun.Numeral ;
|
||||||
Numeral = 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.
|
-- quantifier and an optional numeral can be discerned.
|
||||||
|
|
||||||
-- : Quant -> Num -> Det ;
|
-- : Quant -> Num -> Det ;
|
||||||
DetQuant quant num = quant ** num ** {
|
DetQuant quant num = let n = num2number num.n in
|
||||||
|
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 ! num.n ! c }
|
_ => quant.s ! n ! c }
|
||||||
++ 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 ! num.n ! c }
|
_ => quant.sp ! n ! c }
|
||||||
++ num.s ! Indep ;
|
++ num.s ! Indep ;
|
||||||
|
n = n ;
|
||||||
dt = qt2dt quant.qt ;
|
dt = qt2dt quant.qt ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Quant -> Num -> Ord -> Det ; -- these five best
|
-- : Quant -> Num -> Ord -> Det ; -- these five best
|
||||||
DetQuantOrd quant num ord =
|
DetQuantOrd quant num ord =
|
||||||
let theseFive = DetQuant quant num in theseFive ** {
|
let theseFive = DetQuant quant num ;
|
||||||
s = \\c => theseFive.s ! c ++ ord.s ! num.n ! Nom ;
|
n = num2number num.n ;
|
||||||
sp = \\c => theseFive.sp ! c ++ ord.s ! num.n ! Nom ;
|
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
|
-- Whether the resulting determiner is singular or plural depends on the
|
||||||
@@ -115,17 +119,16 @@ concrete NounHun of Noun = CatHun ** open
|
|||||||
-- the inherent number.
|
-- the inherent number.
|
||||||
|
|
||||||
NumSg = baseNum ;
|
NumSg = baseNum ;
|
||||||
NumPl = baseNum ** {n = Pl} ;
|
NumPl = baseNum ** {n = NoNum Pl} ;
|
||||||
|
|
||||||
-- : Card -> Num ;
|
-- : Card -> Num ;
|
||||||
NumCard card = card ** {
|
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 ;
|
-- : Digits -> Card ;
|
||||||
NumDigits dig = dig ** {
|
NumDigits dig = dig ** {
|
||||||
s = \\place => dig.s ! NCard ;
|
s = \\place => dig.s ! NCard ;
|
||||||
numtype = IsNum ;
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
-- : Numeral -> Card ;
|
-- : Numeral -> Card ;
|
||||||
|
|||||||
@@ -179,13 +179,16 @@ param
|
|||||||
|
|
||||||
CardOrd = NOrd | NCard ; -- Not used yet
|
CardOrd = NOrd | NCard ; -- Not used yet
|
||||||
|
|
||||||
NumType = NoNum | IsNum ;
|
NumType = NoNum Number | IsNum ;
|
||||||
|
|
||||||
oper
|
oper
|
||||||
isNum : {numtype : NumType} -> Bool = \nt -> case nt.numtype of {
|
isNum : {n : NumType} -> Bool = \n -> case n.n of {
|
||||||
NoNum => False ;
|
IsNum => True ;
|
||||||
_ => True
|
_ => False
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
num2number : NumType -> Number = \n ->
|
||||||
|
case n of {NoNum x => x ; IsNum => Sg} ;
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Adjectives
|
-- Adjectives
|
||||||
|
|
||||||
|
|||||||
@@ -230,9 +230,12 @@ oper
|
|||||||
s,sp = mkCaseNoun2 no ac ! n ;
|
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 = {
|
Numeral : Type = {
|
||||||
s : Place => Str ; -- Independent or attribute
|
s : Place => Str ; -- Independent or attribute
|
||||||
numtype : NumType ; -- Digit, numeral or Sg/Pl : makes a difference in many languages
|
|
||||||
-- TODO add ordinal
|
-- TODO add ordinal
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -241,13 +244,12 @@ oper
|
|||||||
Noun.gf: NumCard : Card -> Num ;
|
Noun.gf: NumCard : Card -> Num ;
|
||||||
-}
|
-}
|
||||||
Num : Type = Numeral ** {
|
Num : Type = Numeral ** {
|
||||||
n : Number ; -- Singular or plural
|
n : NumType ; -- Singular, plural or numeral
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
baseNum : Num = {
|
baseNum : Num = {
|
||||||
s = \\_ => [] ;
|
s = \\_ => [] ;
|
||||||
n = Sg ;
|
n = NoNum Sg ;
|
||||||
numtype = NoNum
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user