1
0
forked from GitHub/gf-rgl

minimal extension to the Numeral API

This commit is contained in:
Krasimir Angelov
2023-01-20 18:53:41 +01:00
parent 14cabc847a
commit 8c3375b67b
3 changed files with 11 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ lincat Digit = {s,p : Str} ; -- s/p: without/with classifier (er/liang)
lincat Sub10 = {s,p,t : Str} ; -- t: with "shi wan"
lincat Sub100 = {end0,beg0 : Zero ; s,p : Bform => Str} ; -- end0: ends with zeros, e.g. 20 ; beg0: begins with zeros, e.g. 02
lincat Sub1000 = {end0,beg0 : Zero ; s,p : Qform => Str} ; -- end0: ends with zeros, e.g. 210 ; beg0: begins with zeros, e.g. 021
lincat Sub1000000 = {s,p : Str} ;
lincat Sub1000000, Sub1000000000, Sub1000000000000 = {s,p : Str} ;
lin num x0 = x0 ;
-- 一二三四五六七八九十一百千
@@ -137,7 +137,9 @@ lin pot3 n =
{s,p = n.s ! shiwan} ;
lin pot3plus n m =
{s,p = (n.s ! shiwan0) ++ (ling ! <n.end0,m.beg0>) ++ m.s ! bai0} ;
lin pot3as4 n = n ;
lin pot4as5 n = n ;
-- numerals as sequences of digits

View File

@@ -11,7 +11,7 @@ lincat Digit = {s : DForm => DetTable ; size : NumSize ; o : DForm => PronForms}
lincat Sub10 = {s : Place => DForm => DetTable ; size : NumSize ; o : Place => DForm => PronForms ; just1 : Bool} ;
lincat Sub100 = {s : Place => DetTable ; size : NumSize ; o : Place => PronForms; just1 : Bool} ;
lincat Sub1000 = {s : Place => DetTable ; size : NumSize ; o : Place => PronForms; just1 : Bool} ;
lincat Sub1000000 = {s : DetTable ; size : NumSize ; o : PronForms; just1 : Bool} ;
lincat Sub1000000, Sub1000000000, Sub1000000000000 = {s : DetTable ; size : NumSize ; o : PronForms; just1 : Bool} ;
-- just1 to correctly generate exactly 1000
-- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
@@ -403,6 +403,9 @@ lin pot3plus n m = {
just1 = False ;
size = Num5
} ;
lin pot3as4 n = n ;
lin pot4as5 n = n ;
-- numerals as sequences of digits

View File

@@ -8,7 +8,7 @@ lincat
Sub10 = {s : DForm => Str} ;
Sub100 = {s : NForm => Str} ;
Sub1000 = {s : NForm => Str} ;
Sub1000000 = {s : Str} ;
Sub1000000, Sub1000000000, Sub1000000000000 = {s : Str} ;
lin
num x = x ;
@@ -49,6 +49,9 @@ lin
pot2as3 n = {s = n.s ! Unit} ;
pot3 n = {s = n.s ! Thousand} ;
pot3plus n m = {s = thbind (n.s ! Thousand) (m.s ! Unit)} ;
pot3as4 n = n ;
pot4as5 n = n ;
param
DForm = Indep | ModTen | After ;