forked from GitHub/gf-rgl
extended Numerals API. moved from the WordNet grammar
This commit is contained in:
@@ -25,6 +25,8 @@ cat
|
||||
Sub100 ; -- 1..99
|
||||
Sub1000 ; -- 1..999
|
||||
Sub1000000 ; -- 1..999999
|
||||
Sub1000000000 ; -- 1..999999999
|
||||
Sub1000000000000 ; -- 1..999999999999
|
||||
|
||||
data
|
||||
num : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
|
||||
@@ -33,18 +35,36 @@ data
|
||||
|
||||
pot01 : Sub10 ; -- 1
|
||||
pot0 : Digit -> Sub10 ; -- d * 1
|
||||
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
|
||||
pot110 : Sub100 ; -- 10
|
||||
pot111 : Sub100 ; -- 11
|
||||
pot1to19 : Digit -> Sub100 ; -- 10 + d
|
||||
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
|
||||
pot1 : Digit -> Sub100 ; -- d * 10
|
||||
pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
|
||||
pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99
|
||||
|
||||
pot21 : Sub1000 ; -- a hundred instead of one hundred
|
||||
pot2 : Sub10 -> Sub1000 ; -- m * 100
|
||||
pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
|
||||
pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999
|
||||
|
||||
pot31 : Sub1000000 ; -- a thousand instead of one thousand
|
||||
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
|
||||
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||
pot3as4 : Sub1000000 -> Sub1000000000 ; -- coercion of 1..999999
|
||||
pot3float : Float -> Sub1000000 ; -- 3.5 thousand
|
||||
|
||||
pot41 : Sub1000000000 ; -- a million instead of one million
|
||||
pot4 : Sub1000 -> Sub1000000000 ; -- m * 1000000000
|
||||
pot4plus : Sub1000 -> Sub1000000 -> Sub1000000000 ; -- m * 1000000000 + n
|
||||
pot4as5 : Sub1000000000 -> Sub1000000000000 ; -- coercion of 1..999999999
|
||||
pot4float : Float -> Sub1000000000 ; -- 3.5 million
|
||||
|
||||
pot51 : Sub1000000000000 ; -- a billion instead of one billion
|
||||
pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000
|
||||
pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n
|
||||
pot5float : Float -> Sub1000000000000 ; -- 3.5 billion
|
||||
|
||||
-- Numerals as sequences of digits have a separate, simpler grammar
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ flags optimize = all_subs ;
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str ; en : Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number ; en : Str ; attr : Str} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 =
|
||||
{s : CardOrd => Str ; n : Number ; attr : Str} ;
|
||||
|
||||
lin
|
||||
@@ -50,6 +50,8 @@ lin
|
||||
pot3plus n m =
|
||||
addAttr {s = \\g => n.attr ++ "duisend" ++ m.s ! g ; n = Pl} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
lincat
|
||||
Dig = TDigit ;
|
||||
|
||||
@@ -323,8 +323,8 @@ concrete ExtraGrc of ExtraGrcAbs = CatGrc, NumeralGrc[Sub1000000,tenthousand] **
|
||||
Sub10000 = {s : CardOrd => Str ; n : Number} ; -- TODO: constructors
|
||||
|
||||
lin -- d * 10000
|
||||
pot4 d = { s = \\f => d.s ! NAdv ++ (tenthousand ! f) ; n = Pl } ;
|
||||
pot4plus d m = {
|
||||
pot3X d = { s = \\f => d.s ! NAdv ++ (tenthousand ! f) ; n = Pl } ;
|
||||
pot3Xplus d m = {
|
||||
s = \\f => d.s ! NAdv ++ tenthousand ! f ++ "kai`" ++ m.s ! f ; n = Pl} ;
|
||||
|
||||
|
||||
|
||||
@@ -153,8 +153,8 @@ abstract ExtraGrcAbs = Extra, Numeral[Sub1000000] ** {
|
||||
Sub10000 ; -- 1..9999
|
||||
|
||||
data
|
||||
pot4 : Sub10000 -> Sub1000000 ; -- m * 10000
|
||||
pot4plus : Sub10000 -> Sub10000 -> Sub1000000 ; -- m * 10000 + n
|
||||
pot3X : Sub10000 -> Sub1000000 ; -- m * 10000
|
||||
pot3Xplus : Sub10000 -> Sub10000 -> Sub1000000 ; -- m * 10000 + n
|
||||
|
||||
-- Conjunctions:
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
@@ -52,6 +54,8 @@ lin -- mkDigit d (d+10) (d*10) d-th d-times
|
||||
pot3plus d m = {
|
||||
s = \\f => d.s ! NAdv ++ thousand ! f ++ "kai`" ++ m.s ! f ; n = Pl} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => NumF => Str; n : Number; i : Bool} ;
|
||||
Sub1000 = {s : CardOrd => NumF => Str; n : Number; i : Bool} ;
|
||||
Sub1000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => NumF => Str; n : Number} ;
|
||||
|
||||
lin num x = {s = \\c => x.s ! c ! Formal; n=x.n} ;
|
||||
lin n2 = mkDigit "два" "двама" "две" "втори" "двайсет" "двеста" "двестата" ;
|
||||
@@ -52,24 +54,33 @@ lin pot01 =
|
||||
;n = Sg
|
||||
} ;
|
||||
lin pot0 d = d ** {n = Pl} ;
|
||||
lin pot0as1 n = {s = \\c,nf => n.s ! unit ! c; n = n.n; i = True} ;
|
||||
|
||||
lin pot110 = {s=\\c,nf => pot01.s ! ten nf ! c; n = Pl; i = True} ;
|
||||
lin pot111 = {s=\\c,nf => pot01.s ! teen nf ! c; n = Pl; i = True} ;
|
||||
lin pot1to19 d = {s = \\c,nf => d.s ! teen nf ! c; n = Pl; i = True} ;
|
||||
lin pot0as1 n = {s = \\c,nf => n.s ! unit ! c; n = n.n; i = True} ;
|
||||
lin pot1 d = {s = \\c,nf => d.s ! ten nf ! c; n = Pl; i = True} ;
|
||||
lin pot1plus d e = {
|
||||
s = \\c,nf => d.s ! ten nf ! NCard (CFMasc Indef NonHuman) ++ "и" ++ e.s ! unit ! c ; n = Pl; i = False} ;
|
||||
|
||||
lin pot1as2 n = n ;
|
||||
|
||||
lin pot21 = {
|
||||
s = \\o,_ => mkCardOrd100 "сто" "стоте" "стотен" ! o ;
|
||||
i = False ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot2 n = {s = \\c,nf => n.s ! hundred ! c; n = Pl; i = True} ;
|
||||
lin pot2plus d e = {
|
||||
s = \\c,nf => d.s ! hundred ! NCard (CFMasc Indef NonHuman) ++ case e.i of {False => []; True => "и"} ++ e.s ! c ! nf ;
|
||||
n = Pl ;
|
||||
i = False
|
||||
} ;
|
||||
|
||||
lin pot2as3 n = n ;
|
||||
|
||||
lin pot31 = {
|
||||
s = \\o,_ => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot3 n = {
|
||||
s = \\c,nf => case n.n of {
|
||||
Sg => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! c ;
|
||||
@@ -85,7 +96,52 @@ lin pot3plus n m = {
|
||||
++ case m.i of {False => []; True => "и"} ++ m.s ! c ! nf ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot3as4 n = n ;
|
||||
lin pot3float f = {
|
||||
s = \\c,nf => f.s ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
lin pot41 = {
|
||||
s = \\o,_ => mkCardOrd100 "милион" "милионите" "милионен" ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4 n = {
|
||||
s = \\c,nf => case n.n of {
|
||||
Sg => mkCardOrd100 "милион" "милионите" "милионен" ! c ;
|
||||
Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиони" "милионите" "милионен" ! c
|
||||
} ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4plus n1 n2 = {
|
||||
s = \\o,f => (pot4 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4as5 n = n ;
|
||||
lin pot4float f = {
|
||||
s = \\c,nf => f.s ++ mkCardOrd100 "милиона" "милиона" "милионен" ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
lin pot51 = {
|
||||
s = \\o,_ => mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! o ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5 n = {
|
||||
s = \\c,nf => case n.n of {
|
||||
Sg => mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c ;
|
||||
Pl => n.s ! NCard (CFFem Indef) ! nf ++ mkCardOrd100 "милиярд" "милиярдите" "милиярден" ! c
|
||||
} ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5plus n1 n2 = {
|
||||
s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5float f = {
|
||||
s = \\c,nf => f.s ++ mkCardOrd100 "милиярда" "милиярда" "милиярден" ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
|
||||
-- Auxiliaries
|
||||
@@ -126,6 +128,8 @@ lin
|
||||
{s= \\co => (table {Sg => []; Pl => (n.s ! co)} ! n.n) ++ "mil" ++ (m.s !co);
|
||||
n= Pl} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
param
|
||||
DForm = unit | teen | ten | tenplus | Aunit | OrdF ;
|
||||
|
||||
@@ -6,7 +6,7 @@ flags optimize = all_subs ;
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str ; en : Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number ; en : Str ; attr : Str} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 =
|
||||
{s : CardOrd => Str ; n : Number ; attr : Str} ;
|
||||
|
||||
lin
|
||||
@@ -49,6 +49,8 @@ lin
|
||||
pot3plus n m =
|
||||
addAttr {s = \\g => n.attr ++ "duizend" ++ m.s ! g ; n = Pl} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
lincat
|
||||
Dig = TDigit ;
|
||||
|
||||
@@ -6,6 +6,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Case => Str ; n : Number} ;
|
||||
Sub1000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
|
||||
Sub1000000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : Bool => CardOrd => Case => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in
|
||||
@@ -25,22 +27,71 @@ lin n9 = mkNum "nine" "nineteen" "ninety" "ninth" ;
|
||||
|
||||
lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ;
|
||||
lin pot0 d = d ** {n = Pl} ;
|
||||
lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ;
|
||||
|
||||
lin pot110 = regCardOrd "ten" ** {n = Pl} ;
|
||||
lin pot111 = regCardOrd "eleven" ** {n = Pl} ;
|
||||
lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ;
|
||||
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 = {s = \\_ => n.s; n=n.n} ;
|
||||
|
||||
lin pot21 = {
|
||||
s = \\d,o,c => case d of {True => []; False => "a"} ++
|
||||
(regCardOrd "hundred").s ! o ! c;
|
||||
n = Pl
|
||||
} ;
|
||||
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} ;
|
||||
lin pot2as3 n = n ;
|
||||
|
||||
lin pot31 = {
|
||||
s = \\d,o,c => case d of {True => []; False => "a"} ++
|
||||
(regCardOrd "thousand").s ! o ! c;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot3 n = {
|
||||
s = \\d,o,c => n.s ! d ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ;
|
||||
lin pot3plus n m = {
|
||||
s = \\d,o,c => n.s ! d ! NCard ! Nom ++ "thousand" ++ m.s ! False ! o ! c; n = Pl} ;
|
||||
lin pot3as4 n = n ;
|
||||
lin pot3float f = {
|
||||
s = \\d,o,c => f.s ++ mkCard o "thousand" ! c ; n = Pl} ;
|
||||
|
||||
lin pot41 = {
|
||||
s = \\d,o,c => case d of {True => []; False => "a"} ++
|
||||
(regCardOrd "million").s ! o ! c;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4 n = {
|
||||
s = \\d,o,c => n.s ! d ! NCard ! Nom ++ pot41.s ! True ! o ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4plus n1 n2 = {
|
||||
s = \\d,o,c => n1.s ! d ! NCard ! Nom ++ pot41.s ! True ! NCard ! Nom ++ "and" ++ n2.s ! True ! o ! c;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot4as5 n = n ;
|
||||
lin pot4float f = {
|
||||
s = \\d,o,c => f.s ++ pot41.s ! True ! o ! c ; n = Pl} ;
|
||||
|
||||
lin pot51 = {
|
||||
s = \\d,o,c => case d of {True => []; False => "a"} ++
|
||||
(regCardOrd "billion").s ! o ! c;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5 n = {
|
||||
s = \\d,o,c => n.s ! d ! NCard ! Nom ++ pot51.s ! True ! o ! c ;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5plus n1 n2 = {
|
||||
s = \\d,o,c => n1.s ! d ! NCard ! Nom ++ pot51.s ! True ! NCard ! Nom ++ "and" ++ n2.s ! True ! o ! c;
|
||||
n = Pl
|
||||
} ;
|
||||
lin pot5float f = {
|
||||
s = \\d,o,c => f.s ++ pot51.s ! True ! o ! c ; n = Pl} ;
|
||||
|
||||
-- numerals as sequences of digits
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ concrete NumeralEst of Numeral = CatEst [Numeral,Digits] ** open Prelude, Parad
|
||||
flags optimize=all_subs ; coding=utf8;
|
||||
|
||||
lincat
|
||||
Sub1000000 = {s : CardOrd => Str ; n : MorphoEst.Number} ;
|
||||
Sub1000000, Sub1000000000, Sub1000000000000 = {s : CardOrd => Str ; n : MorphoEst.Number} ;
|
||||
Digit = {s : CardOrd => Str} ;
|
||||
Sub10, Sub100, Sub1000 = {s : NumPlace => CardOrd => Str ; n : MorphoEst.Number} ;
|
||||
|
||||
@@ -65,6 +65,9 @@ lin
|
||||
s = \\c => d.s ! NumAttr ! c ++ tuhattaN.s ! d.n ! c ++ e.s ! NumIndep ! c
|
||||
} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
oper
|
||||
co : (c,o : {s : NForm => Str}) -> {s : CardOrd => Str} = \c,o -> {
|
||||
s = table {
|
||||
|
||||
@@ -7,7 +7,7 @@ flags optimize = all_subs ;
|
||||
coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Sub1000000 = {s : CardOrd => Str ; n : MorphoFin.Number} ;
|
||||
Sub1000000, Sub1000000000, Sub1000000000000 = {s : CardOrd => Str ; n : MorphoFin.Number} ;
|
||||
Digit = {s : CardOrd => Str} ;
|
||||
Sub10, Sub100, Sub1000 = {s : NumPlace => CardOrd => Str ; n : MorphoFin.Number} ;
|
||||
|
||||
@@ -44,21 +44,21 @@ lin
|
||||
n = Sg
|
||||
} ;
|
||||
pot0 d = {n = Pl ; s = \\_ => d.s} ;
|
||||
pot0as1 n = n ;
|
||||
|
||||
pot110 =
|
||||
{s = \\_ => kymmenenN.s ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
pot111 = {n = Pl ; s = \\_,c => yksiN.s ! c ++ BIND ++ "toista"} ; ---- yhdes
|
||||
pot1to19 d = {n = Pl ; s = \\_,c => d.s ! c ++ BIND ++ "toista"} ;
|
||||
pot0as1 n = n ;
|
||||
|
||||
pot1 d = {n = Pl ; s = \\_,c => d.s ! c ++ BIND ++ kymmentaN.s ! c} ;
|
||||
pot1plus d e = {
|
||||
n = Pl ;
|
||||
s = \\_,c => d.s ! c ++ BIND ++ kymmentaN.s ! c ++ BIND ++ e.s ! NumIndep ! c
|
||||
} ;
|
||||
pot1as2 n = n ;
|
||||
|
||||
pot2 d = {n = Pl ; s = \\_,c => d.s ! NumAttr ! c ++ nBIND d.n ++ sataaN.s ! d.n ! c} ; ----
|
||||
pot2plus d e = {
|
||||
n = Pl ;
|
||||
@@ -66,11 +66,19 @@ lin
|
||||
BIND ++ e.s ! NumIndep ! c
|
||||
} ;
|
||||
pot2as3 n = {n = n.n ; s = n.s ! NumIndep} ;
|
||||
|
||||
pot3 d = {n = Pl ; s = \\c => d.s ! NumAttr ! c ++ nBIND d.n ++ tuhattaN.s ! d.n ! c} ; ----
|
||||
pot3plus d e = {
|
||||
n = Pl ;
|
||||
s = \\c => d.s ! NumAttr ! c ++ nBIND d.n ++ tuhattaN.s ! d.n ! c ++ e.s ! NumIndep ! c
|
||||
} ;
|
||||
pot3as4 n = n ;
|
||||
pot3float f = {n = Pl ; s = \\c => f.s ++ BIND ++ tuhattaN.s ! Pl ! c} ;
|
||||
|
||||
pot4as5 n = n ;
|
||||
pot4float f = {n = Pl ; s = \\c => f.s ++ "miljoonaa"} ; -- KA: case inflection missing
|
||||
|
||||
pot51 = {n = Pl ; s = \\c => "miljardi"} ; -- KA: case inflection missing
|
||||
|
||||
oper
|
||||
-- co : (c,o : {s : NForm => Str}) -> {s : CardOrd => Str} = \c,o -> {
|
||||
|
||||
@@ -46,6 +46,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Placement => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Placement => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x0 = x0 ;
|
||||
|
||||
@@ -139,6 +141,9 @@ lin pot3plus n m =
|
||||
{s = \\g => (n.s ! NCard Masc ! attr) ++ "mille" ++ m.s ! g ! postpo ; n =
|
||||
Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
oper hyphen = BIND ++ "-" ++ BIND ;
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ flags optimize = all_subs ;
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 =
|
||||
{s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
@@ -29,23 +29,35 @@ lin
|
||||
n = Sg
|
||||
} ;
|
||||
pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl} ;
|
||||
pot0as1 n = {s = n.s ! DUnit; n = n.n } ;
|
||||
|
||||
pot110 = {s = cardReg "zehn"; n = Pl} ;
|
||||
pot111 = {s = cardReg "elf"; n = Pl} ;
|
||||
pot1to19 d = {s = d.s ! DTeen; n = Pl} ;
|
||||
pot0as1 n = {s = n.s ! DUnit; n = n.n } ;
|
||||
pot1 d = {s = d.s ! DTen; n = Pl} ;
|
||||
pot1plus d e = {s = \\g =>
|
||||
e.s ! DUnit ! invNum ++ BIND ++ "und" ++ BIND ++ d.s ! DTen ! g; n = Pl} ;
|
||||
pot1as2 n = n ;
|
||||
|
||||
pot2 d = {s = \\g =>
|
||||
multiple (d.s ! DUnit) d.n ++ cardOrd "hundert" "hunderte" ! g ; n = Pl} ;
|
||||
pot2plus d e = {s = \\g =>
|
||||
multiple (d.s ! DUnit) d.n ++ "hundert" ++ BIND ++ e.s ! g ; n = Pl} ;
|
||||
pot2as3 n = n ;
|
||||
|
||||
pot3 n = {s = \\g =>
|
||||
multiple n.s n.n ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ----
|
||||
pot3plus n m = {s = \\g =>
|
||||
multiple n.s n.n ++ "tausend" ++ m.s ! g ; n = Pl} ;
|
||||
pot3as4 n = n ;
|
||||
pot3float f = {s = \\g =>
|
||||
f.s ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ----
|
||||
|
||||
pot4as5 n = n ;
|
||||
pot4float f = {s = \\g =>
|
||||
f.s ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ----
|
||||
|
||||
pot51 = {s = \\g => "einer Milliarde"; n = Pl} ; -- KA: case inflection missing
|
||||
|
||||
oper
|
||||
multiple : (CardOrd => Str) -> Number -> Str = \d,n ->
|
||||
|
||||
@@ -9,6 +9,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +61,9 @@ lin pot3plus n m = {
|
||||
Pl => Xilias co n.s n.n ++ cardOrdXiliaPl "χιλιάδες" "χιλιοστός" ! co ++ m.s ! co }
|
||||
} ** {n = Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
|
||||
oper
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
@@ -72,6 +74,9 @@ lin pot3 n = spl (\\co => n.s ! NCard Masc ++ nBIND n.n ++
|
||||
|
||||
lin pot3plus n m = {s = \\g => n.s ! NCard Masc ++ nBIND n.n ++ mille ! n.n ++ "e" ++ m.s ! g ; n = Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
oper
|
||||
nBIND : Number -> Str = \n -> case n of {Sg => [] ; _ => BIND} ; -- no BIND after silent 1
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ lincat
|
||||
Sub10,
|
||||
Sub100,
|
||||
Sub1000,
|
||||
Sub1000000 = ResKor.Numeral ;
|
||||
Sub1000000,
|
||||
Sub1000000000,
|
||||
Sub1000000000000 = ResKor.Numeral ;
|
||||
|
||||
lin
|
||||
-- : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
|
||||
@@ -84,6 +86,9 @@ lin
|
||||
-- : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
|
||||
pot3plus m n = TODO ;
|
||||
|
||||
pot3as4 x = x ;
|
||||
pot4as5 x = x ;
|
||||
|
||||
oper
|
||||
LinDigit : Type = ResKor.Numeral ** {isTwo : Bool ; ten : Str} ;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ lincat
|
||||
Sub100 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub1000 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub1000000 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub1000000000 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
Sub1000000000000 = { s : CardOrd => Gender => Case => Str ; num : Number } ;
|
||||
|
||||
lin
|
||||
|
||||
@@ -80,6 +82,9 @@ lin
|
||||
num = e.num
|
||||
} ;
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
-- Numerals as sequences of digits:
|
||||
|
||||
lincat
|
||||
|
||||
@@ -63,6 +63,8 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt
|
||||
Sub100 = Form2 ;
|
||||
Sub1000 = Form2 ;
|
||||
Sub1000000 = Form2 ;
|
||||
Sub1000000000 = Form2 ;
|
||||
Sub1000000000000 = Form2 ;
|
||||
|
||||
oper
|
||||
|
||||
@@ -335,6 +337,9 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt
|
||||
f = Hund ; -- NOT IMPORTANT
|
||||
} ;
|
||||
|
||||
pot3as4 m = m ;
|
||||
pot4as5 m = m ;
|
||||
|
||||
oper
|
||||
-- Build "x thousand" table
|
||||
numTable : (CardOrd => NumCase => Str) = overload {
|
||||
|
||||
@@ -13,7 +13,7 @@ concrete NumeralPol of Numeral = CatPol [Numeral,Digits] ** open ResPol,Prelude,
|
||||
Sub10 = { unit,hundred: Case * Gender => Str;
|
||||
ounit,ohundred: AForm => Str;
|
||||
a:Accom; n:Number }; -- 1..9
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 =
|
||||
{ s:Case * Gender => Str;
|
||||
o:AForm => Str;
|
||||
a:Accom; n:Number };
|
||||
@@ -514,6 +514,9 @@ n9 = { unit = table {
|
||||
n = Pl
|
||||
};
|
||||
|
||||
pot3as4 n = n ;
|
||||
pot4as5 n = n ;
|
||||
|
||||
oper tysiac = table {
|
||||
<(Nom|Acc), Sg> => "tysiąc";
|
||||
<Gen, Sg> => "tysiąca";
|
||||
|
||||
@@ -14,6 +14,8 @@ concrete NumeralPor of Numeral = CatPor [Numeral,Digits] **
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
num x = x ;
|
||||
@@ -111,6 +113,33 @@ concrete NumeralPor of Numeral = CatPor [Numeral,Digits] **
|
||||
++ m.s ! co ;
|
||||
n = Pl} ;
|
||||
|
||||
|
||||
pot3as4 n = n ;
|
||||
|
||||
pot4 n = {s = table CardOrd {co => n.s ! NCard Masc ++ milhao ! co } ; n = Pl} ;
|
||||
|
||||
pot4plus n m = {s = \\co => n.s ! NCard Masc
|
||||
++ milhao ! co
|
||||
++ e_CardOrd co ++ m.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
pot21 = mkNum "cem" "centésimo" ;
|
||||
|
||||
pot31 = mkNum "mil" "milésimo" ;
|
||||
|
||||
-- cem, mil, but um milhão, um bilhão
|
||||
pot41 = mkNum "um milhão" "milhonésimo" ;
|
||||
|
||||
pot4as5 n = n ;
|
||||
|
||||
oper
|
||||
milhao : CardOrd => Str ;
|
||||
milhao = mkNumStr "milhão" "milhonésimo" ;
|
||||
|
||||
mkNum : Str -> Str -> {s : CardOrd => Str ; n : Number} ;
|
||||
mkNum cem centesimo = spl (mkNumStr cem centesimo) ;
|
||||
|
||||
oper
|
||||
mkTal : (_,_,_,_,_,_,_ : Str) -> {s : DForm => CardOrd => Str} =
|
||||
\dois,doze,vinte,duzentos,segundo,vigesimo,duocentesimo ->
|
||||
|
||||
@@ -11,6 +11,8 @@ lincat Sub10 = {s : CardOrd => DForm => Placement => Str ; size : Size} ;
|
||||
lincat Sub100 = {s : CardOrd => NumF => Placement => Str ; size : Size} ;
|
||||
lincat Sub1000 = {s : CardOrd => NumF => Placement => Str ; size : Size } ;
|
||||
lincat Sub1000000 = { s : CardOrd => NumF => Placement => Str; size : Size } ;
|
||||
lincat Sub1000000000 = { s : CardOrd => NumF => Placement => Str; size : Size } ;
|
||||
lincat Sub1000000000000 = { s : CardOrd => NumF => Placement => Str; size : Size } ;
|
||||
|
||||
|
||||
|
||||
@@ -196,6 +198,9 @@ lin pot3plus n m =
|
||||
size = m.size
|
||||
};
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
oper mksute : Size -> Str = \sz -> table {sg => "sută" ; _ => "sute" } ! sz ;
|
||||
oper mkSute : Size -> Gender -> Str = \sz, g ->
|
||||
table {sg => mkOrdinalForm "sută" g ;
|
||||
|
||||
@@ -21,6 +21,8 @@ lincat Sub10 = LinDigit ;
|
||||
lincat Sub100 = LinNumeral ;
|
||||
lincat Sub1000 = LinNumeral ;
|
||||
lincat Sub1000000 = LinNumeral ;
|
||||
lincat Sub1000000000 = LinNumeral ;
|
||||
lincat Sub1000000000000 = LinNumeral ;
|
||||
|
||||
oper mkNum : Determiner -> Str -> Str -> Str -> LinDigit =
|
||||
\dva, dvanast, dvadsat, dveste -> {
|
||||
@@ -85,6 +87,9 @@ lin pot3plus n m = {
|
||||
size = tfSize m.size
|
||||
} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
oper tfSize : NumSize -> NumSize = \sz ->
|
||||
table {Num1 => Num5 ; other => other} ! sz ;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ lincat
|
||||
Sub100 = {s : Gender => Case => Str; e : Str; n : NumAgr} ;
|
||||
Sub1000 = {s : Gender => Case => Str; e : Str; n : NumAgr} ;
|
||||
Sub1000000 = {s : Gender => Case => Str; n : NumAgr} ;
|
||||
Sub1000000000 = {s : Gender => Case => Str; n : NumAgr} ;
|
||||
Sub1000000000000 = {s : Gender => Case => Str; n : NumAgr} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
@@ -143,6 +145,9 @@ lin pot110 = {s=\\g => table {
|
||||
n = UseGen
|
||||
} ;
|
||||
|
||||
pot3as4 x = x ;
|
||||
pot4as5 x = x ;
|
||||
|
||||
oper mkDigit : (_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_ : Str) -> Gender => Case => Str;
|
||||
mkDigit nomMasc nomFem nomNeut accMasc accFem accNeut
|
||||
genMasc genFem genNeut datMasc datFem datNeut
|
||||
|
||||
@@ -37,7 +37,7 @@ lincat
|
||||
where laba 'two' is a feminine noun in absolutive case and
|
||||
boqol 'hundred' is a masculine noun in genitive case.
|
||||
Since laba is head, the whole nominal is feminine." -}
|
||||
Sub10, Sub100, Sub1000, Sub1000000 = {
|
||||
Sub10, Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 = {
|
||||
s : DForm => Str ;
|
||||
thousand : Str ; -- TODO figure out if this really works so
|
||||
hasThousand : Bool ;
|
||||
@@ -128,6 +128,9 @@ lin pot3plus n m = n ** {
|
||||
ord = n.ord ++ "kun iyo" ++ m.ord ;
|
||||
n = Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
@@ -66,6 +68,9 @@ lin pot2as3 n = n ;
|
||||
lin pot3 n = spl (\\g => n.s ! NCard Masc ++ mil g) ;
|
||||
lin pot3plus n m = {s = \\g => n.s ! NCard Masc ++ mil g ++ m.s ! g ; n = Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
oper
|
||||
mkTal : (x1,_,_,_,_,_,_,x8 : Str) -> {s : DForm => CardOrd => Str} =
|
||||
\due,dodici,venti,ducento,secondo,dodicesimo,ventesimo,ducentesimo ->
|
||||
|
||||
@@ -7,6 +7,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Gender => Str ; n : Number} ;
|
||||
Sub1000 = {s : CardOrd => Gender => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Gender => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Gender => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Gender => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
lin n2 = mkNumn "ili" "ishirini" "pili" ;
|
||||
@@ -45,6 +47,9 @@ lin pot3plus n m = { s = table {
|
||||
NOrd => \\g =>Ordprefix g++ "elfu" ++ n.s ! NCard !g ++ m.s ! NCard ! g} ;
|
||||
n = Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
-- numerals as sequences of digits0'
|
||||
|
||||
lincat
|
||||
|
||||
@@ -4,7 +4,7 @@ concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits] ** open ResSwe, MorphoS
|
||||
lincat
|
||||
Digit = {s : DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100, Sub1000, Sub1000000 =
|
||||
Sub100, Sub1000, Sub1000000, Sub1000000000, Sub1000000000000 =
|
||||
{s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
@@ -27,22 +27,45 @@ lin
|
||||
n = Sg
|
||||
} ;
|
||||
pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl} ;
|
||||
pot0as1 n = {s = n.s ! ental ; n = n.n} ;
|
||||
|
||||
pot110 = numPl (cardReg "tio") ;
|
||||
pot111 = numPl (cardOrd "elva" "elfte") ;
|
||||
pot1to19 d = numPl (d.s ! ton) ;
|
||||
pot0as1 n = {s = n.s ! ental ; n = n.n} ;
|
||||
pot1 d = numPl (d.s ! tiotal) ;
|
||||
pot1plus d e = {s = \\g => d.s ! tiotal ! invNum ++ BIND ++ e.s ! ental ! g ; n = Pl} ;
|
||||
pot1as2 n = n ;
|
||||
|
||||
pot21 = numPl (cardOrd "hundra" "hundrade") ;
|
||||
pot2 d =
|
||||
numPl (\\g => d.s ! ental ! invNum ++ BIND ++ cardOrd "hundra" "hundrade" ! g) ;
|
||||
pot2plus d e =
|
||||
{s = \\g => d.s ! ental ! invNum ++ BIND ++ "hundra" ++ e.s ! g ; n = Pl} ;
|
||||
pot2as3 n = n ;
|
||||
|
||||
pot31 = numPl (cardOrd "tusen" "tusende") ;
|
||||
pot3 n =
|
||||
numPl (\\g => n.s ! invNum ++ cardOrd "tusen" "tusende" ! g) ;
|
||||
pot3plus n m =
|
||||
{s = \\g => n.s ! invNum ++ BIND ++ "tusen" ++ m.s ! g ; n = Pl} ;
|
||||
pot3as4 n = n ;
|
||||
|
||||
pot41 = numPl (cardOrd "miljon" "miljonde") ;
|
||||
pot4 n =
|
||||
numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljon" "miljonde" ! g) ;
|
||||
pot4plus n m =
|
||||
{s = \\g => n.s ! NCard Utr ++ BIND ++ "miljon" ++ m.s ! g ; n = Pl} ;
|
||||
pot4as5 n = n ;
|
||||
pot4float f =
|
||||
numPl (\\g => f.s ++ cardOrd "miljoner" "miljonde" ! g) ;
|
||||
|
||||
pot51 = numPl (cardOrd "miljard" "miljarde") ;
|
||||
pot5 n =
|
||||
numPl (\\g => n.s ! NCard Utr ++ cardOrd "miljard" "miljarde" ! g) ;
|
||||
pot5plus n m =
|
||||
{s = \\g => n.s ! NCard Utr ++ BIND ++ "miljard" ++ m.s ! g ; n = Pl} ;
|
||||
pot5float f =
|
||||
numPl (\\g => f.s ++ cardOrd "miljarder" "miljarde" ! g) ;
|
||||
|
||||
lincat
|
||||
Dig = TDigit ;
|
||||
|
||||
@@ -11,6 +11,8 @@ lincat
|
||||
Sub100 = {s : CardOrd => Number => Case => Str ; n : Number ; blank : Str} ;
|
||||
Sub1000 = {s : CardOrd => Number => Case => Str ; n : Number ; blank : Str} ;
|
||||
Sub1000000 = {s : CardOrd => Number => Case => Str ; n : Number} ;
|
||||
Sub1000000000 = {s : CardOrd => Number => Case => Str ; n : Number} ;
|
||||
Sub1000000000000 = {s : CardOrd => Number => Case => Str ; n : Number} ;
|
||||
|
||||
lin num x = x ;
|
||||
|
||||
@@ -48,6 +50,11 @@ lin pot3plus n m = {s = \\t,num,c => case n.n of {
|
||||
Sg => n.blank ;
|
||||
Pl => n.s ! NCard ! Sg !Nom
|
||||
} ++ "bin" ++ m.s ! t ! num ! c; n = Pl} ;
|
||||
|
||||
lin pot3as4 n = n ;
|
||||
lin pot4as5 n = n ;
|
||||
|
||||
|
||||
lincat
|
||||
Dig = {s : CardOrd => Number => Case => Str ; n : Number} ;
|
||||
lin
|
||||
|
||||
Reference in New Issue
Block a user