From e122aea3adf13b6ea053f436bd2e636533cad2dd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 1 Sep 2020 17:51:49 +0200 Subject: [PATCH] (May) Form Det with numerals (NumCard, NumDigits etc.) --- src/malay/CatMay.gf | 2 +- src/malay/NounMay.gf | 25 +++++++++++++++++-------- src/malay/NumeralMay.gf | 10 ++++++---- src/malay/ParamMay.gf | 12 ++++++++---- src/malay/ResMay.gf | 14 ++++++++------ 5 files changed, 40 insertions(+), 23 deletions(-) diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 972a5ac3..0b9ebadb 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -64,7 +64,7 @@ concrete CatMay of Cat = CommonX ** open ResMay, Prelude in { Det = ResMay.Determiner ; Predet = SS ; Quant = ResMay.Quant ; - Num = ResMay.CardNum ; + Num = ResMay.Num ; Ord = { s : Str ; -- AForm => Str ; -- Ord can came from AP and become AP again n : Number -- Ord can come from Num, which has inherent number diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 30c352b2..83cecf64 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -8,9 +8,13 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- : Det -> CN -> NP DetCN det cn = emptyNP ** { - s = \\poss => case det.poss of { - Bare => cn.s ! NF det.n poss ; - _ => cn.s ! NF det.n det.poss -- TODO check if this make sense + s = \\poss => + det.pr + -- TODO classifier is necessary if numeral comes after noun. See Mintz p. 298. + -- ++ if_then_Str (isNum det.n) "buah" [] -- TODO store classifier in CN + ++ case det.poss of { + Bare => cn.s ! NF (toNum det.n) poss ; + _ => cn.s ! NF (toNum det.n) det.poss -- TODO check if this make sense } ++ det.s ++ cn.heavyMod ; } ; @@ -62,7 +66,8 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- : Quant -> Num -> Det ; DetQuant quant num = quant ** { - s = quant.s ++ num.s ! Attrib ; + pr = num.s ; -- if it's not a number or digit, num.s is empty + s = quant.s ; n = num.n } ; @@ -79,16 +84,20 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { -- the inherent number. NumSg = baseNum ; - NumPl = baseNum ** {n = Pl} ; + NumPl = baseNum ** {n = NoNum Pl} ; -- : Card -> Num ; - -- NumCard card = + NumCard card = card ** { + n = IsNumber -- for the purposes of modifying a noun, this is singular + } ; -- : Digits -> Card ; - -- NumDigits dig = + NumDigits dig = { + s = dig.s ! NCard + } ; -- : Numeral -> Card ; - -- NumNumeral num + NumNumeral num = num ; {- -- : AdN -> Card -> Card ; diff --git a/src/malay/NumeralMay.gf b/src/malay/NumeralMay.gf index 5d2929a8..1367a5ed 100644 --- a/src/malay/NumeralMay.gf +++ b/src/malay/NumeralMay.gf @@ -4,11 +4,11 @@ concrete NumeralMay of Numeral = CatMay [Numeral,Digits] ** open Prelude, ResMay in { lincat - Digit = CardOrdNum ; -- 2..9 + Digit = OrdNum ; -- 2..9 Sub10, -- 1..9 Sub100, -- 1..99 Sub1000 = LinNumber ; -- 1..999 - Sub1000000 = CardOrdNum ; -- 1..999999 + Sub1000000 = OrdNum ; -- 1..999999 oper LinNumber : Type = { @@ -17,6 +17,8 @@ concrete NumeralMay of Numeral = CatMay [Numeral,Digits] ** ord : Str ; } ; + OrdNum : Type = CardOrdNum ** {n : Number} ; + lin -- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category] num x = x ; @@ -100,10 +102,10 @@ oper ord = "ke" + s ; -- Works for all but number 1 } ; - mkDigit : Str -> CardOrdNum = \s -> mkNum s ** {s=s} ; + mkDigit : Str -> OrdNum = \s -> mkNum s ** {s=s} ; -- Only for Digit -> Sub*: we won't run into 1 here. - mkNum3 : (digit : CardOrdNum) -> (ten,unit : Str) -> LinNumber = \tiga,puluh,dua -> { + mkNum3 : (digit : OrdNum) -> (ten,unit : Str) -> LinNumber = \tiga,puluh,dua -> { n = Pl ; s = \\_ => tiga.s ++ puluh ++ dua ; ord = tiga.ord ++ puluh ++ dua diff --git a/src/malay/ParamMay.gf b/src/malay/ParamMay.gf index 6d47d18c..9c3f28da 100644 --- a/src/malay/ParamMay.gf +++ b/src/malay/ParamMay.gf @@ -104,13 +104,17 @@ param CardOrd = NOrd | NCard ; - -- TODO see if this is needed - NumType = NoNum | IsDigit | IsNumber ; + NumType = NoNum Number | IsNumber ; oper isNum : NumType -> Bool = \nt -> case nt of { - NoNum => False ; - _ => True + NoNum _ => False ; + _ => True + } ; + + toNum : NumType -> Number = \nt -> case nt of { + NoNum n => n ; + _ => Sg } ; -------------------------------------------------------------------------------- -- Adjectives diff --git a/src/malay/ResMay.gf b/src/malay/ResMay.gf index 1eb911e9..87cab876 100644 --- a/src/malay/ResMay.gf +++ b/src/malay/ResMay.gf @@ -66,19 +66,21 @@ oper } ; Determiner : Type = Quant ** { - n : Number ; --- numtype : NumType ; -- number as in "5" or "Sg/Pl", often makes a difference in lots of things + pr : Str ; -- prefix for numbers + n : NumType ; -- number as in 5 (noun in singular), Sg or Pl } ; CardNum : Type = { s : Str ; - n : Number } ; - baseNum : CardNum = { + Num : Type = CardNum ** { + n : NumType + } ; + + baseNum : Num = { s = [] ; - n = Sg ; - numtype = NoNum + n = NoNum Sg } ; CardOrdNum : Type = CardNum ** {