forked from GitHub/gf-rgl
(May) Form Det with numerals (NumCard, NumDigits etc.)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ** {
|
||||
|
||||
Reference in New Issue
Block a user