1
0
forked from GitHub/gf-rgl

(Hun) Merge the param Number into NumType: NoNum {Sg|Pl} | IsNum

This commit is contained in:
Inari Listenmaa
2020-04-28 12:57:24 +02:00
parent 1d50cc8bca
commit 84985b91c0
4 changed files with 34 additions and 26 deletions

View File

@@ -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} ;

View File

@@ -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 ;

View File

@@ -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

View File

@@ -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 ;
} ;
--------------------------------------------------------------------------------