1
0
forked from GitHub/gf-rgl

make it possible to extend numberals beyound 1000000

This commit is contained in:
Krasimir Angelov
2018-07-27 19:17:53 +02:00
parent e7b1c47300
commit 1b4762c436
5 changed files with 36 additions and 30 deletions

View File

@@ -80,7 +80,7 @@ concrete CatEng of Cat = CommonX - [Pol,SC,CAdv] ** open ResEng, Prelude in {
-- Numeral
Numeral = {s : CardOrd => Case => Str ; n : Number} ;
Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ;
Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ;
-- Structural

View File

@@ -77,8 +77,8 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
NumDigits n = {s,sp = \\_ => n.s ! NCard ; n = n.n} ;
OrdDigits n = {s = n.s ! NOrd} ;
NumNumeral numeral = {s,sp = \\_ => numeral.s ! NCard; n = numeral.n} ;
OrdNumeral numeral = {s = numeral.s ! NOrd} ;
NumNumeral numeral = {s,sp = \\d => numeral.s ! d ! NCard; n = numeral.n} ;
OrdNumeral numeral = {s = numeral.s ! True ! NOrd} ;
AdNum adn num = {s = \\_,c => adn.s ++ num.s !False!c ;
sp = \\_,c => adn.s ++ num.sp!False!c ;
@@ -86,7 +86,7 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
OrdSuperl a = {s = \\c => a.s ! AAdj Superl c } ;
OrdNumeralSuperl n a = {s = \\c => n.s ! NOrd ! Nom ++ a.s ! AAdj Superl c } ;
OrdNumeralSuperl n a = {s = \\c => n.s ! True ! NOrd ! Nom ++ a.s ! AAdj Superl c } ;
DefArt = {
s = \\hasCard,n => artDef ;

View File

@@ -4,8 +4,8 @@ lincat
Digit = {s : DForm => CardOrd => Case => Str} ;
Sub10 = {s : DForm => CardOrd => Case => Str ; n : Number} ;
Sub100 = {s : CardOrd => Case => Str ; n : Number} ;
Sub1000 = {s : CardOrd => Case => Str ; n : Number} ;
Sub1000000 = {s : CardOrd => Case => Str ; n : Number} ;
Sub1000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
Sub1000000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
lin num x = x ;
lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in
@@ -32,15 +32,15 @@ lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ;
lin pot1 d = {s = d.s ! ten} ** {n = Pl} ;
lin pot1plus d e = {
s = \\o,c => d.s ! ten ! NCard ! Nom ++ BIND ++ "-" ++ BIND ++ e.s ! unit ! o ! c ; n = Pl} ;
lin pot1as2 n = n ;
lin pot2 d = {s = \\o,c => d.s ! unit ! NCard ! Nom ++ mkCard o "hundred" ! c} ** {n = Pl} ;
lin pot1as2 n = {s = \\_ => n.s; n=n.n} ;
lin pot2 d = {s = \\_,o,c => d.s ! unit ! NCard ! Nom ++ mkCard o "hundred" ! c} ** {n = Pl} ;
lin pot2plus d e = {
s = \\o,c => d.s ! unit ! NCard ! Nom ++ "hundred" ++ "and" ++ e.s ! o ! c ; n = Pl} ;
s = \\_,o,c => d.s ! unit ! NCard ! Nom ++ "hundred" ++ "and" ++ e.s ! o ! c ; n = Pl} ;
lin pot2as3 n = n ;
lin pot3 n = {
s = \\o,c => n.s ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ;
s = \\d,o,c => n.s ! d ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ;
lin pot3plus n m = {
s = \\o,c => n.s ! NCard ! Nom ++ "thousand" ++ m.s ! o ! c; n = Pl} ;
s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ;
-- numerals as sequences of digits