From 84985b91c0791ca963286baea7603402386d2bfd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 28 Apr 2020 12:57:24 +0200 Subject: [PATCH] (Hun) Merge the param Number into NumType: NoNum {Sg|Pl} | IsNum --- src/hungarian/CatHun.gf | 2 +- src/hungarian/NounHun.gf | 37 ++++++++++++++++++++----------------- src/hungarian/ParamHun.gf | 11 +++++++---- src/hungarian/ResHun.gf | 10 ++++++---- 4 files changed, 34 insertions(+), 26 deletions(-) diff --git a/src/hungarian/CatHun.gf b/src/hungarian/CatHun.gf index 82583e2d1..e60c34b8e 100644 --- a/src/hungarian/CatHun.gf +++ b/src/hungarian/CatHun.gf @@ -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} ; diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index c4a972773..e3d3e2e4e 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -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 of { - => [] ; -- don't output "a 2 cars" - _ => quant.s ! num.n ! c } - ++ num.s ! Attrib ; -- TODO: add inflection table in numbers - sp = \\c => case of { - => [] ; - _ => 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 of { + => [] ; -- don't output "a 2 cars" + _ => quant.s ! n ! c } + ++ num.s ! Attrib ; -- TODO: add inflection table in numbers + sp = \\c => case of { + => [] ; + _ => 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 ; diff --git a/src/hungarian/ParamHun.gf b/src/hungarian/ParamHun.gf index 59c6593ed..707207e16 100644 --- a/src/hungarian/ParamHun.gf +++ b/src/hungarian/ParamHun.gf @@ -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 diff --git a/src/hungarian/ResHun.gf b/src/hungarian/ResHun.gf index 11da50ba2..b18c6fddd 100644 --- a/src/hungarian/ResHun.gf +++ b/src/hungarian/ResHun.gf @@ -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 ; } ; --------------------------------------------------------------------------------