diff --git a/src/abstract/Cat.gf b/src/abstract/Cat.gf index 93b7fa75..72bd5f58 100644 --- a/src/abstract/Cat.gf +++ b/src/abstract/Cat.gf @@ -93,6 +93,7 @@ abstract Cat = Common ** { Numeral ; -- cardinal or ordinal in words e.g. "five/fifth" Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th" + Decimal ; -- decimal number e.g. "1/2/3.14/-1" --2 Structural words diff --git a/src/abstract/Noun.gf b/src/abstract/Noun.gf index ee4fc0cb..413eb3af 100644 --- a/src/abstract/Noun.gf +++ b/src/abstract/Noun.gf @@ -58,7 +58,7 @@ abstract Noun = Cat ** { data NumDigits : Digits -> Card ; -- 51 - NumFloat : Digits -> Digits -> Card ; -- 3.14 + NumDecimal : Decimal -> Card ; -- 3.14, -1, etc NumNumeral : Numeral -> Card ; -- fifty-one -- The construction of numerals is defined in [Numeral Numeral.html]. @@ -158,7 +158,6 @@ abstract Noun = Cat ** { --2 Quantities - QuantityNP : Digits -> MU -> NP ; - QuantityFloatNP : Digits -> Digits -> MU -> NP ; + QuantityNP : Decimal -> MU -> NP ; } diff --git a/src/abstract/Numeral.gf b/src/abstract/Numeral.gf index 01702b5c..be0d904e 100644 --- a/src/abstract/Numeral.gf +++ b/src/abstract/Numeral.gf @@ -17,7 +17,7 @@ -- parts of a numeral, which is often incorrect - more work on -- (un)lexing is needed to solve this problem. -abstract Numeral = Cat [Numeral,Digits] ** { +abstract Numeral = Cat [Numeral,Digits,Decimal] ** { cat Digit ; -- 2..9 @@ -53,18 +53,18 @@ data 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 + pot3decimal : Decimal -> 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 + pot4decimal : Decimal -> 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 + pot5decimal : Decimal -> Sub1000000000000 ; -- 3.5 billion -- Numerals as sequences of digits have a separate, simpler grammar @@ -77,4 +77,8 @@ data D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ; + PosDecimal : Digits -> Decimal ; -- 8 + NegDecimal : Digits -> Decimal ; -- -8 + IFrac : Decimal -> Dig -> Decimal ; -- 3.14 -> 3.141 + } diff --git a/src/afrikaans/CatAfr.gf b/src/afrikaans/CatAfr.gf index f26f6c55..27b5882a 100644 --- a/src/afrikaans/CatAfr.gf +++ b/src/afrikaans/CatAfr.gf @@ -62,6 +62,7 @@ concrete CatAfr of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/afrikaans/NounAfr.gf b/src/afrikaans/NounAfr.gf index a1667f70..b265c919 100644 --- a/src/afrikaans/NounAfr.gf +++ b/src/afrikaans/NounAfr.gf @@ -77,7 +77,7 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard g c; n = Pl } ; + NumDecimal dec = {s = \\g,c => dec.s ! NCard g c; n = dec.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -185,10 +185,4 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in { isPron = False } ; - QuantityFloatNP n1 n2 m = { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Neutr Nom ++ BIND ++ "." ++ BIND ++ n1.s ! NCard Neutr Nom) ; - a = agrP3 Pl ; - isPron = False - } ; - } diff --git a/src/afrikaans/NumeralAfr.gf b/src/afrikaans/NumeralAfr.gf index 22202418..7fee53c7 100644 --- a/src/afrikaans/NumeralAfr.gf +++ b/src/afrikaans/NumeralAfr.gf @@ -1,5 +1,5 @@ -concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits] ** open ResAfr, Prelude in { +concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits,Decimal] ** open ResAfr, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -75,6 +75,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/amharic/CatAmh.gf b/src/amharic/CatAmh.gf index 398a6261..ab1cd918 100644 --- a/src/amharic/CatAmh.gf +++ b/src/amharic/CatAmh.gf @@ -22,6 +22,7 @@ lincat Prep = ResAmh.Prep; Numeral = ResAmh.Numeral; --{s : CardOrd => Case => Str ; n : Number} ; Digits = ResAmh.Digits;--{s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Decimal = ResAmh.Decimal; Ord = ResAmh.Ord ; --{ s : Case => Str } ; Num = ResAmh.Num;--{s : Case => Str ; n : Number ; hasCard : Bool} ; Card = ResAmh.Card;--{s : Case => Str ; n : Number} ; diff --git a/src/amharic/NounAmh.gf b/src/amharic/NounAmh.gf index c2816561..7ff5fb29 100644 --- a/src/amharic/NounAmh.gf +++ b/src/amharic/NounAmh.gf @@ -94,6 +94,7 @@ lin NumCard n = {s = \\s,c => n.s!Masc!Sg!s!c ; n = Pl; hasCard = True} ; NumDigits n = {s = n.s ! NCard } ; + NumDecimal n = {s = n.s ! NCard } ; NumNumeral numeral = {s = numeral.s ! NCard} ; diff --git a/src/amharic/NumeralAmh.gf b/src/amharic/NumeralAmh.gf index 79cad2e3..421227a2 100644 --- a/src/amharic/NumeralAmh.gf +++ b/src/amharic/NumeralAmh.gf @@ -1,5 +1,5 @@ -concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits] ** open ResAmh,ParamX,Prelude in { +concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits,Decimal] ** open ResAmh,ParamX,Prelude in { flags coding = utf8; lincat @@ -91,6 +91,18 @@ lin pot3plus n m = { D_8 = mkDig "8" ; D_9 = mk2Dig "9" "9ኛ"; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g,n,s,c => "-" ++ BIND ++ d.s !o!g!n!s!c ; + hasDot=False + } ; + IFrac d i = { + s = \\o,g,n,s,c => d.s!NCard!Masc!Sg!Indef!c ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ! n ! s ! c; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/amharic/ResAmh.gf b/src/amharic/ResAmh.gf index bea4c5bd..b21ec291 100644 --- a/src/amharic/ResAmh.gf +++ b/src/amharic/ResAmh.gf @@ -161,6 +161,10 @@ resource ResAmh = PatternsAmh** open Prelude,MorphoAmh,ParamX in { s : CardOrd=>Gender=>Number=>Species=>Case => Str ; tail : DTail } ; + Decimal = { + s : CardOrd=>Gender=>Number=>Species=>Case => Str ; + hasDot : Bool + } ; Ord = {s : Gender=>Number=>Species=>Case => Str} ; diff --git a/src/ancient_greek/CatGrc.gf b/src/ancient_greek/CatGrc.gf index 65cb892b..06dbfdec 100644 --- a/src/ancient_greek/CatGrc.gf +++ b/src/ancient_greek/CatGrc.gf @@ -90,6 +90,7 @@ concrete CatGrc of Cat = CommonX - [Temp,Tense] ** open ResGrc, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : Str ; unit : Unit} ; + Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ; -- Structural diff --git a/src/ancient_greek/NounGrc.gf b/src/ancient_greek/NounGrc.gf index fa7b5d11..376e4e24 100644 --- a/src/ancient_greek/NounGrc.gf +++ b/src/ancient_greek/NounGrc.gf @@ -83,6 +83,8 @@ concrete NounGrc of Noun = CatGrc ** open Prelude, ResGrc, (M = MorphoGrc) in { -- TODO: check the following two: NumDigits digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl} in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ; + NumDecimal digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl} + in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; AdNum adn num = {s = \\g,c => adn.s ++ num.s ! g ! c ; n = num.n} ; diff --git a/src/ancient_greek/NumeralGrc.gf b/src/ancient_greek/NumeralGrc.gf index a1042a30..42dfcb8d 100644 --- a/src/ancient_greek/NumeralGrc.gf +++ b/src/ancient_greek/NumeralGrc.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude: -concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc in { +concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc, Prelude in { lincat Digit = {s : DForm => CardOrd => Str} ; @@ -81,6 +81,8 @@ lin -- mkDigit d (d+10) (d*10) d-th d-times D_8 = mkDig "h" "p" "w" ; D_9 = mkDig "v" "K" "P" ; -- TODO: replace K by koppa, P by sampi (not in ut -ancientgreek) + PosDecimal d = d ** {hasDot=False} ; + oper TDigit = { s : Unit => Str diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 10fcfb70..222c798b 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -67,6 +67,8 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { n : Size } ; Digits = {s : Str; n : Size}; + Decimal = {s : Str; + n : Size; hasDot : Bool}; -- Structural diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index e22f7c99..8af8ce0b 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -130,6 +130,10 @@ lin s = \\_,_,_ => digits.s ; isNum = True }; + NumDecimal dec = dec ** { + s = \\_,_,_ => dec.s ; + isNum = True + }; NumNumeral numeral = numeral ** { s = numeral.s ! NCard ; diff --git a/src/arabic/NumeralAra.gf b/src/arabic/NumeralAra.gf index fd510469..1fe70634 100644 --- a/src/arabic/NumeralAra.gf +++ b/src/arabic/NumeralAra.gf @@ -1,4 +1,4 @@ -concrete NumeralAra of Numeral = CatAra [Numeral,Digits] ** +concrete NumeralAra of Numeral = CatAra [Numeral,Digits,Decimal] ** open Predef, Prelude, ResAra, MorphoAra in { flags coding=utf8 ; @@ -136,6 +136,20 @@ lincat D_8 = mk1Dig "8" ; D_9 = mk1Dig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + n = ThreeTen ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = ThreeTen ; + hasDot=True + } ; + oper diff --git a/src/bantu/CatBantu.gf b/src/bantu/CatBantu.gf index 0f810524..9f014c39 100644 --- a/src/bantu/CatBantu.gf +++ b/src/bantu/CatBantu.gf @@ -61,7 +61,8 @@ incomplete concrete CatBantu of Cat = Numeral = {s : CardOrd => Gender => Str ; n : Number} ; - Digits = {s : CardOrd => Gender => Str ; n : Number} ; + Digits = {s : CardOrd => Gender => Str ; n : Number} ; + Decimal = {s : CardOrd => Gender => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/bantu/NounBantu.gf b/src/bantu/NounBantu.gf index 847d3598..8da208d6 100644 --- a/src/bantu/NounBantu.gf +++ b/src/bantu/NounBantu.gf @@ -77,6 +77,7 @@ lin NumCard n = n ;--** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = { s = n.s ! NOrd} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/basque/CatEus.gf b/src/basque/CatEus.gf index 7ef71011..28687c0c 100644 --- a/src/basque/CatEus.gf +++ b/src/basque/CatEus.gf @@ -85,6 +85,7 @@ concrete CatEus of Cat = CommonX ** open ResEus, Prelude in { Numeral = { s : Str ; n : Number } ; Digits = { s : CardOrd => Str ; n : Number } ; + Decimal = { s : CardOrd => Str ; n : Number ; hasDot : Bool} ; diff --git a/src/basque/NounEus.gf b/src/basque/NounEus.gf index ceef7e74..5efb55ce 100644 --- a/src/basque/NounEus.gf +++ b/src/basque/NounEus.gf @@ -125,6 +125,7 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { -- : Digits -> Card ; NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ; + NumDecimal dec = { s = dec.s ! NCard ; n = dec.n } ; -- : Numeral -> Card ; NumNumeral num = num ; @@ -260,4 +261,4 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in { oper elative : NP -> Str = \np -> glue (np.s ! LocStem) "rik" ; -} \ No newline at end of file +} diff --git a/src/basque/NumeralEus.gf b/src/basque/NumeralEus.gf index 91392fe4..69d6cb73 100644 --- a/src/basque/NumeralEus.gf +++ b/src/basque/NumeralEus.gf @@ -1,4 +1,4 @@ -concrete NumeralEus of Numeral = CatEus [Numeral,Digits] ** open Prelude, ResEus, ParamX in { +concrete NumeralEus of Numeral = CatEus [Numeral,Digits,Decimal] ** open Prelude, ResEus, ParamX in { oper LinDigit : Type = { s : DForm => Str ; n : Number ; @@ -112,5 +112,18 @@ lin D_9 = mkDig "9" ; lin IDig dig = dig ; -- : Dig -> Digits -> Digits ; lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\co => glue "-" (d.s ! co) ; + n = Pl ; + hasDot=False + } ; +lin IFrac d i = { + s = \\co => d.s ! co ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co ; + n = Pl ; + hasDot=False + } ; } diff --git a/src/bulgarian/CatBul.gf b/src/bulgarian/CatBul.gf index 4eec21ca..08d922b9 100644 --- a/src/bulgarian/CatBul.gf +++ b/src/bulgarian/CatBul.gf @@ -64,6 +64,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, ( Numeral = {s : CardOrd => Str; n : Number} ; Digits = {s : CardOrd => Str; n : Number; tail : DTail} ; + Decimal = {s : CardOrd => Str; n : Number; hasDot : Bool} ; -- Structural diff --git a/src/bulgarian/NounBul.gf b/src/bulgarian/NounBul.gf index bab08547..0dd9715f 100644 --- a/src/bulgarian/NounBul.gf +++ b/src/bulgarian/NounBul.gf @@ -116,10 +116,9 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { NumCard n = {s=n.s; nn=n.nn; nonEmpty = True} ; NumDigits n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; + NumDecimal n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdDigits n = {s = \\aform => n.s ! NOrd aform} ; - NumFloat n1 n2 = {s = \\gspec => n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard gspec ; nn = NCountable} ; - NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; nn = case numeral.n of {Sg => NNum Sg; Pl => NCountable}} ; OrdNumeral numeral = {s = \\aform => numeral.s ! NOrd aform} ; @@ -247,10 +246,4 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in { p = NounP3 Pos } ; - QuantityFloatNP n1 n2 m = { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (CFMasc Indef NonHuman) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (CFMasc Indef NonHuman)) ; - gn = gennum (AMasc NonHuman) Pl ; - p = NounP3 Pos - } ; - } diff --git a/src/bulgarian/NumeralBul.gf b/src/bulgarian/NumeralBul.gf index 170351fd..149e2362 100644 --- a/src/bulgarian/NumeralBul.gf +++ b/src/bulgarian/NumeralBul.gf @@ -1,5 +1,5 @@ --# -coding=utf8 -concrete NumeralBul of Numeral = CatBul [Numeral,Digits] ** open Prelude, ResBul in { +concrete NumeralBul of Numeral = CatBul [Numeral,Digits,Decimal] ** open Prelude, ResBul in { flags coding=utf8 ; @@ -97,8 +97,11 @@ lin pot3plus n m = { n = Pl } ; lin pot3as4 n = n ; -lin pot3float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c ; +lin pot3decimal d = { + s = \\c,nf => case d.n of { + Sg => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! NCard (CFMasc Indef NonHuman) ; + Pl => d.s ! NCard (CFFem Indef) ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c + } ; n = Pl } ; @@ -118,8 +121,17 @@ lin pot4plus n1 n2 = { n = Pl } ; lin pot4as5 n = n ; -lin pot4float f = { - s = \\c,nf => f.s ++ mkCardOrd100 "милиона" "милиона" "милионен" ! c ; +lin pot4decimal d = { + s = \\c,nf => case c of { + NCard (CFMasc s a) => d.s ! NCard (CFMasc s NonHuman) ; + NCard (CFMascDefNom a) => d.s ! NCard (CFMascDefNom NonHuman) ; + NCard cf => d.s ! NCard cf ; + NOrd _ => d.s ! NCard (CFMasc Indef NonHuman) + } ++ + case d.n of { + Sg => "милион" ; + Pl => "милиона" + } ; n = Pl } ; @@ -138,8 +150,12 @@ 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 ; +lin pot5decimal d = { + s = \\c,nf => d.s ! NCard (CFFem Indef) ++ + case d.n of { + Sg => mkCardOrd100 "милиярд" "милиярда" "милиярден" ! c ; + Pl => mkCardOrd100 "милиярди" "милиярдите" "милиярден" ! c + } ; n = Pl } ; @@ -168,6 +184,16 @@ lin pot5float f = { D_8 = mk3Dig "8" "8на" "8ми" Pl ; D_9 = mk3Dig "9" "9има" "9ти" Pl ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ; + IFrac d i = { + s = \\o => d.s ! NCard (CFMasc Indef NonHuman) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper spaceIf : DTail -> Str = \t -> case t of { T3 => SOFT_BIND ; diff --git a/src/catalan/NumeralCat.gf b/src/catalan/NumeralCat.gf index 1d5f6938..374ba782 100644 --- a/src/catalan/NumeralCat.gf +++ b/src/catalan/NumeralCat.gf @@ -1,4 +1,4 @@ -concrete NumeralCat of Numeral = CatCat [Numeral,Digits] ** +concrete NumeralCat of Numeral = CatCat [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoCat, Prelude in { flags coding=utf8 ; @@ -158,6 +158,20 @@ param D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ; diff --git a/src/chinese/CatChi.gf b/src/chinese/CatChi.gf index 74c0d2c4..7caa895e 100644 --- a/src/chinese/CatChi.gf +++ b/src/chinese/CatChi.gf @@ -57,6 +57,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu Numeral = {s,p : Str} ; Card, Digits = {s : Str} ; + Decimal = {s : Str ; hasDot : Bool} ; -- Structural diff --git a/src/chinese/NounChi.gf b/src/chinese/NounChi.gf index 9912791e..30cd7dde 100644 --- a/src/chinese/NounChi.gf +++ b/src/chinese/NounChi.gf @@ -62,6 +62,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { NumCard n = n ** {numType = NTFull} ; NumDigits d = d ** {numType = NTFull} ; + NumDecimal d = d ** {numType = NTFull} ; OrdDigits d = {s = ordinal_s ++ d.s} ; NumNumeral numeral = {s = numeral.p} ; -- liang instead of yi diff --git a/src/chinese/NumeralChi.gf b/src/chinese/NumeralChi.gf index 52bb9076..71df8d7f 100644 --- a/src/chinese/NumeralChi.gf +++ b/src/chinese/NumeralChi.gf @@ -1,4 +1,4 @@ -concrete NumeralChi of Numeral = CatChi [Numeral,Digits] ** open ResChi, Prelude in { +concrete NumeralChi of Numeral = CatChi [Numeral,Digits,Decimal] ** open ResChi, Prelude in { flags coding = utf8 ; @@ -162,4 +162,16 @@ lin pot4as5 n = n ; D_8 = ss "8" ; D_9 = ss "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + hasDot=True + } ; + } diff --git a/src/chinese/pinyin/NumeralChi.gf b/src/chinese/pinyin/NumeralChi.gf index bcaf6892..7769d362 100644 --- a/src/chinese/pinyin/NumeralChi.gf +++ b/src/chinese/pinyin/NumeralChi.gf @@ -160,4 +160,16 @@ lin pot3plus n m = D_8 = ss "8" ; D_9 = ss "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + hasDot=True + } ; + } diff --git a/src/croatian/CatHrv.gf b/src/croatian/CatHrv.gf index 065e479b..16745d89 100644 --- a/src/croatian/CatHrv.gf +++ b/src/croatian/CatHrv.gf @@ -68,5 +68,6 @@ concrete CatHrv of Cat = lincat Numeral = {s : AdjForms ; size : NumSize} ; lincat Digits = {s : Str ; size : NumSize} ; + lincat Decimal = {s : Str ; size : NumSize ; hasDot : Bool} ; } diff --git a/src/croatian/NounHrv.gf b/src/croatian/NounHrv.gf index ee4faf67..7a83d73a 100644 --- a/src/croatian/NounHrv.gf +++ b/src/croatian/NounHrv.gf @@ -89,6 +89,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal dec = dec ** {s = \\_,_ => dec.s} ; NumNumeral nu = { s = \\g,c => (adjFormsAdjective nu.s).s ! g ! Sg ! c ; ---- TODO Sg? size = nu.size diff --git a/src/croatian/NumeralHrv.gf b/src/croatian/NumeralHrv.gf index 40756b3e..64ac816e 100644 --- a/src/croatian/NumeralHrv.gf +++ b/src/croatian/NumeralHrv.gf @@ -1,6 +1,6 @@ concrete NumeralHrv of Numeral = - CatHrv [Numeral, Digits] ** + CatHrv [Numeral, Digits, Decimal] ** open ResHrv, @@ -125,6 +125,20 @@ oper mkThousand : Str -> NumSize -> Str = \attr,size -> IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = dd.size} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + size = d.size ; + hasDot=True + } ; + D_0 = { s = "0" ; size = NS_1} ; ---- ?? D_1 = { s = "1" ; size = NS_1} ; D_2 = { s = "2" ; size = NS_2_4} ; diff --git a/src/czech/CatCze.gf b/src/czech/CatCze.gf index 31f01a73..04166930 100644 --- a/src/czech/CatCze.gf +++ b/src/czech/CatCze.gf @@ -66,6 +66,7 @@ concrete CatCze of Cat = lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; + lincat Decimal = {s:Str ; size : NumSize ; hasDot : Bool} ; } diff --git a/src/czech/NounCze.gf b/src/czech/NounCze.gf index 4bc4d231..6b31f8f7 100644 --- a/src/czech/NounCze.gf +++ b/src/czech/NounCze.gf @@ -96,6 +96,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal ds = ds ** {s = \\_,_ => ds.s} ; NumNumeral nu = nu ; diff --git a/src/czech/NumeralCze.gf b/src/czech/NumeralCze.gf index c9a7a333..ece5fd5a 100644 --- a/src/czech/NumeralCze.gf +++ b/src/czech/NumeralCze.gf @@ -1,6 +1,6 @@ concrete NumeralCze of Numeral = - CatCze [Numeral,Digits] ** + CatCze [Numeral,Digits,Decimal] ** open ResCze, @@ -117,4 +117,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; D_8 = { s = "8" ; size = Num5} ; D_9 = { s = "9" ; size = Num5} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = Num5 ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + size = Num5 ; + hasDot=True + } ; + } diff --git a/src/danish/NumeralDan.gf b/src/danish/NumeralDan.gf index 3e8a84f2..c817b0ce 100644 --- a/src/danish/NumeralDan.gf +++ b/src/danish/NumeralDan.gf @@ -1,4 +1,4 @@ -concrete NumeralDan of Numeral = CatDan [Numeral,Digits] ** open MorphoDan,Prelude in { +concrete NumeralDan of Numeral = CatDan [Numeral,Digits,Decimal] ** open MorphoDan,Prelude in { flags coding=utf8 ; @@ -67,6 +67,20 @@ lin n9 = mkTal "ni" "nitten" "halvfems" "niende" "halvfemsindstyvende" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + hasDot=True; + n = Pl + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/dutch/CatDut.gf b/src/dutch/CatDut.gf index 85bdb995..b72a8bfb 100644 --- a/src/dutch/CatDut.gf +++ b/src/dutch/CatDut.gf @@ -59,6 +59,7 @@ concrete CatDut of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/dutch/NounDut.gf b/src/dutch/NounDut.gf index c8242b4c..84972558 100644 --- a/src/dutch/NounDut.gf +++ b/src/dutch/NounDut.gf @@ -85,7 +85,7 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumFloat n1 n2 = {s = \\g,c => n1.s ! NCard Utr Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g c; n = Pl } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = let tiende : AForm => Str = \\af => numeral.s ! NOrd af @@ -207,10 +207,4 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in { isPron = False } ; - QuantityFloatNP n1 n2 m = noMerge ** { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard Utr Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard Utr Nom) ; - a = agrP3 Pl ; - isPron = False - } ; - } diff --git a/src/dutch/NumeralDut.gf b/src/dutch/NumeralDut.gf index 00697295..f13fdfb8 100644 --- a/src/dutch/NumeralDut.gf +++ b/src/dutch/NumeralDut.gf @@ -1,4 +1,4 @@ -concrete NumeralDut of Numeral = CatDut [Numeral,Digits] ** open ResDut, Prelude in { +concrete NumeralDut of Numeral = CatDut [Numeral,Digits,Decimal] ** open ResDut, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -74,6 +74,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/egekusii/NumeralGus.gf b/src/egekusii/NumeralGus.gf index b149a100..0fec9444 100644 --- a/src/egekusii/NumeralGus.gf +++ b/src/egekusii/NumeralGus.gf @@ -71,6 +71,20 @@ lin pot3plus n m = { s = table { D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; + n = Pl + hasDot=False + } ; + IFrac d i = { + s = \\o,g => d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/english/CatEng.gf b/src/english/CatEng.gf index 18c30b0c..35bfc2d2 100644 --- a/src/english/CatEng.gf +++ b/src/english/CatEng.gf @@ -81,6 +81,7 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in { Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ; Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ; + Decimal = {s : CardOrd => Case => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/english/DocumentationEng.gf b/src/english/DocumentationEng.gf index c4c66eee..7df89b43 100644 --- a/src/english/DocumentationEng.gf +++ b/src/english/DocumentationEng.gf @@ -1,6 +1,7 @@ --# -path=.:../abstract:../common concrete DocumentationEng of Documentation = CatEng ** open - ResEng, Prelude, + ResEng, + Prelude, HTML in { lincat diff --git a/src/english/NounEng.gf b/src/english/NounEng.gf index c95f9a85..760460e9 100644 --- a/src/english/NounEng.gf +++ b/src/english/NounEng.gf @@ -77,7 +77,7 @@ 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} ; - NumFloat n1 n2 = {s,sp = \\_,c => n1.s ! NCard ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! c ; n = Pl} ; + NumDecimal d = {s,sp = \\_ => d.s ! NCard ; n = d.n} ; NumNumeral numeral = {s,sp = \\d => numeral.s ! d ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! True ! NOrd} ; @@ -181,9 +181,4 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in { a = agrgP3 n.n Neutr } ; - QuantityFloatNP n1 n2 m = { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! Nom) ; - a = agrgP3 Pl Neutr - } ; - } diff --git a/src/english/NumeralEng.gf b/src/english/NumeralEng.gf index 999da63d..e71e80bd 100644 --- a/src/english/NumeralEng.gf +++ b/src/english/NumeralEng.gf @@ -1,4 +1,4 @@ -concrete NumeralEng of Numeral = CatEng [Numeral,Digits] ** open Prelude, ResEng in { +concrete NumeralEng of Numeral = CatEng [Numeral,Digits,Decimal] ** open Prelude, ResEng in { lincat Digit = {s : DForm => CardOrd => Case => Str} ; @@ -57,8 +57,8 @@ lin pot3 n = { 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 pot3decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ mkCard o "thousand" ! c ; n = Pl} ; lin pot41 = { s = \\d,o,c => case d of {True => []; False => "a"} ++ @@ -74,8 +74,8 @@ lin pot4plus n1 n2 = { n = Pl } ; lin pot4as5 n = n ; -lin pot4float f = { - s = \\d,o,c => f.s ++ pot41.s ! True ! o ! c ; n = Pl} ; +lin pot4decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ pot41.s ! True ! o ! c ; n = Pl} ; lin pot51 = { s = \\d,o,c => case d of {True => []; False => "a"} ++ @@ -90,8 +90,8 @@ 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} ; +lin pot5decimal f = { + s = \\d,o,c => f.s ! NCard ! Nom ++ pot51.s ! True ! o ! c ; n = Pl} ; -- numerals as sequences of digits @@ -118,6 +118,16 @@ lin pot5float f = { D_8 = mkDig "8" ; D_9 = mkDig "9" ; +lin PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,c=>"-" ++ BIND ++ d.s ! o ! c; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,c=>d.s ! NCard ! Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! c ; + hasDot=True; + n = Pl + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND ++ "," ++ BIND ; diff --git a/src/estonian/CatEst.gf b/src/estonian/CatEst.gf index c019747e..a1338df1 100644 --- a/src/estonian/CatEst.gf +++ b/src/estonian/CatEst.gf @@ -63,6 +63,7 @@ concrete CatEst of Cat = CommonX ** open HjkEst, ResEst, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/estonian/NounEst.gf b/src/estonian/NounEst.gf index 68bff0c8..96e4489d 100644 --- a/src/estonian/NounEst.gf +++ b/src/estonian/NounEst.gf @@ -120,9 +120,9 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in } ; OrdDigits numeral = {s = \\nc => numeral.s ! NOrd nc} ; - NumFloat n1 n2 = { - s = \\n,c => n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase n c) ; - n = Pl + NumDecimal numeral = { + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n } ; NumNumeral numeral = { @@ -225,12 +225,6 @@ concrete NounEst of Noun = CatEst ** open ResEst, HjkEst, MorphoEst, Prelude in isPron = False } ; - QuantityFloatNP n1 n2 m = emptyNP ** { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase Sg Nom)) ; - a = agrP3 Pl ; - isPron = False - } ; - oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n diff --git a/src/estonian/NumeralEst.gf b/src/estonian/NumeralEst.gf index db30ad22..712f5f12 100644 --- a/src/estonian/NumeralEst.gf +++ b/src/estonian/NumeralEst.gf @@ -1,4 +1,4 @@ -concrete NumeralEst of Numeral = CatEst [Numeral,Digits] ** open Prelude, ParadigmsEst, MorphoEst in { +concrete NumeralEst of Numeral = CatEst [Numeral,Digits,Decimal] ** open Prelude, ParadigmsEst, MorphoEst in { -- Notice: possessive forms are not used. They get wrong, since every -- part is made to agree in them. @@ -146,6 +146,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard (NCase Sg Nom) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoEst.Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/finnish/CatFin.gf b/src/finnish/CatFin.gf index 49f5ca19..7e93e5b4 100644 --- a/src/finnish/CatFin.gf +++ b/src/finnish/CatFin.gf @@ -72,6 +72,7 @@ concrete CatFin of Cat = CommonX ** open ResFin, StemFin, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/finnish/NounFin.gf b/src/finnish/NounFin.gf index 3aeb46d1..8743cb41 100644 --- a/src/finnish/NounFin.gf +++ b/src/finnish/NounFin.gf @@ -143,9 +143,9 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in } ; OrdDigits numeral = {s = \\f => numeral.s ! NOrd f} ; - NumFloat n1 n2 = { - s = \\n,c => n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase n c) ; - n = Pl + NumDecimal numeral = { + s = \\n,c => numeral.s ! NCard (NCase n c) ; + n = numeral.n } ; NumNumeral numeral = { @@ -303,13 +303,6 @@ concrete NounFin of Noun = CatFin ** open ResFin, MorphoFin, StemFin, Prelude in isNeg = False } ; - QuantityFloatNP n1 n2 m = { - s = \\role => preOrPost m.isPre m.s (n1.s ! NCard (NCase Sg Nom) ++ BIND ++ "." ++ BIND ++ n2.s ! NCard (NCase Sg Nom)) ; - a = agrP3 Pl ; - isPron = False ; - isNeg = False - } ; - oper numN : NForm -> Number = \nf -> case nf of { NCase n _ => n ; diff --git a/src/finnish/NumeralFin.gf b/src/finnish/NumeralFin.gf index b182c1b8..2e136b3e 100644 --- a/src/finnish/NumeralFin.gf +++ b/src/finnish/NumeralFin.gf @@ -1,4 +1,4 @@ -concrete NumeralFin of Numeral = CatFin [Numeral,Digits] ** open Prelude, ParadigmsFin, MorphoFin, StemFin in { +concrete NumeralFin of Numeral = CatFin [Numeral,Digits,Decimal] ** open Prelude, ParadigmsFin, MorphoFin, StemFin in { -- Notice: possessive forms are not used. They get wrong, since every -- part is made to agree in them. @@ -73,10 +73,10 @@ lin 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} ; + pot3decimal d = {n = Pl ; s = \\c => d.s ! NCard (NCase Sg Nom) ++ BIND ++ tuhattaN.s ! Pl ! c} ; pot4as5 n = n ; - pot4float f = {n = Pl ; s = \\c => f.s ++ "miljoonaa"} ; -- KA: case inflection missing + pot4decimal d = {n = Pl ; s = \\c => d.s ! NCard (NCase Sg Nom) ++ "miljoonaa"} ; -- KA: case inflection missing pot51 = {n = Pl ; s = \\c => "miljardi"} ; -- KA: case inflection missing @@ -180,6 +180,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard (NCase Sg Nom) ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o MorphoFin.Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/french/NumeralFre.gf b/src/french/NumeralFre.gf index 5e667d8b..56e505cf 100644 --- a/src/french/NumeralFre.gf +++ b/src/french/NumeralFre.gf @@ -1,4 +1,4 @@ -concrete NumeralFre of Numeral = CatFre [Numeral,Digits] ** +concrete NumeralFre of Numeral = CatFre [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoFre, Prelude in { flags coding=utf8 ; @@ -171,6 +171,20 @@ oper hyphen = BIND ++ "-" ++ BIND ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "ème") ; diff --git a/src/german/CatGer.gf b/src/german/CatGer.gf index 1577cc13..5082cf56 100644 --- a/src/german/CatGer.gf +++ b/src/german/CatGer.gf @@ -88,6 +88,7 @@ concrete CatGer of Cat = Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/german/NounGer.gf b/src/german/NounGer.gf index 89ce277f..9de307d2 100644 --- a/src/german/NounGer.gf +++ b/src/german/NounGer.gf @@ -117,7 +117,7 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ; - NumFloat dig1 dig2 = {s = \\g,c => dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard g c ; n = Pl } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ; @@ -262,12 +262,4 @@ concrete NounGer of Noun = CatGer ** open ResGer, MorphoGer, Prelude in { ext = "" ; } ; - QuantityFloatNP dig1 dig2 m = { - s = \\_,c => preOrPost m.isPre m.s (dig1.s ! invNum ++ BIND ++ "." ++ BIND ++ dig2.s ! invNum) ; - a = agrP3 Pl ; - w = WLight ; - rc = "" ; - ext = "" ; - } ; - } diff --git a/src/german/NumeralGer.gf b/src/german/NumeralGer.gf index befad3c5..a9b3e267 100644 --- a/src/german/NumeralGer.gf +++ b/src/german/NumeralGer.gf @@ -1,4 +1,4 @@ -concrete NumeralGer of Numeral = CatGer [Numeral,Digits] ** open MorphoGer, Prelude in { +concrete NumeralGer of Numeral = CatGer [Numeral,Digits,Decimal] ** open MorphoGer, Prelude in { flags optimize = all_subs ; coding=utf8 ; @@ -50,12 +50,12 @@ lin 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} ; ---- + pot3decimal d = {s = \\g => + d.s ! invNum ++ cardOrd "tausend" "tausendte" ! g ; n = Pl} ; ---- pot4as5 n = n ; - pot4float f = {s = \\g => - f.s ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ---- + pot4decimal d = {s = \\g => + d.s ! invNum ++ cardOrd "Millionen" "Millionte" ! g ; n = Pl} ; ---- pot51 = {s = \\g => "einer Milliarde"; n = Pl} ; -- KA: case inflection missing @@ -88,6 +88,20 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! invNum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ; diff --git a/src/greek/CatGre.gf b/src/greek/CatGre.gf index 69772dc3..7b49c7b1 100644 --- a/src/greek/CatGre.gf +++ b/src/greek/CatGre.gf @@ -68,6 +68,8 @@ concrete CatGre of Cat = CommonGre ** open ResGre, Prelude in { Numeral = {s : CardOrd => Str ; n : Number } ; Digits = {s : CardOrd => Str ; n : Number} ; + + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/greek/NounGre.gf b/src/greek/NounGre.gf index 689faff5..58bee560 100644 --- a/src/greek/NounGre.gf +++ b/src/greek/NounGre.gf @@ -111,6 +111,7 @@ concrete NounGre of Noun = CatGre ** open ResGre, ParadigmsGre, Prelude in { NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; + NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ; AdNum adn num = {s = \\g,c => adn.s ++ num.s!g!c; n = num.n } ; @@ -244,4 +245,4 @@ concrete NounGre of Noun = CatGre ** open ResGre, ParadigmsGre, Prelude in { -} \ No newline at end of file +} diff --git a/src/greek/NumeralGre.gf b/src/greek/NumeralGre.gf index b898da1c..1c3eddd1 100644 --- a/src/greek/NumeralGre.gf +++ b/src/greek/NumeralGre.gf @@ -1,4 +1,4 @@ -concrete NumeralGre of Numeral = CatGre [Numeral,Digits] ** open ResGre,Prelude in { +concrete NumeralGre of Numeral = CatGre [Numeral,Digits,Decimal] ** open ResGre,Prelude in { flags coding= utf8 ; @@ -291,6 +291,20 @@ Xilias : CardOrd -> (CardOrd => Str) -> Number -> Str = \co,d,n -> D_8 = mk2Dig "8" Pl; D_9 = mk2Dig "9" Pl ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Neut Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk3Dig : Str -> Number -> TDigit = \c,n -> { diff --git a/src/greenlandic/NumeralKal.gf b/src/greenlandic/NumeralKal.gf index b5a96844..88bf6bb4 100644 --- a/src/greenlandic/NumeralKal.gf +++ b/src/greenlandic/NumeralKal.gf @@ -89,6 +89,20 @@ lin pot1 d = {s = \\nf => d.s ! NInstr ++ "qulillit"} ; ---- inflection of quli D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/hebrew/CatHeb.gf b/src/hebrew/CatHeb.gf index 83a1b9bf..256505d0 100644 --- a/src/hebrew/CatHeb.gf +++ b/src/hebrew/CatHeb.gf @@ -34,6 +34,7 @@ concrete CatHeb of Cat = CommonX - [Utt,Tense,Temp] ** open ResHeb, Prelude, Pa A2 = {s : Str} ; Conj = {s : Str} ; Digits = {s : Str} ; +Decimal = {s : Str; hasDot : Bool} ; IComp = {s : Str} ; IDet = {s : Str} ; IP = {s : Str} ; diff --git a/src/hindi/NumeralHin.gf b/src/hindi/NumeralHin.gf index 4818d26a..8775ebcf 100644 --- a/src/hindi/NumeralHin.gf +++ b/src/hindi/NumeralHin.gf @@ -2,7 +2,7 @@ -- Modification for Urdu Shafqat Virk -concrete NumeralHin of Numeral = CatHin [Numeral,Digits] ** open ResHin,CommonHindustani,ParamX, Prelude in { +concrete NumeralHin of Numeral = CatHin [Numeral,Digits,Decimal] ** open ResHin,CommonHindustani,ParamX, Prelude in { flags coding=utf8 ; param DForm = unit | ten ; @@ -110,6 +110,7 @@ lin D_8 = { s = "८" ; n = Pl}; lin D_9 = { s = "९" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; oper ekhazar : Str = variants {"हज़ार" ; "एक" ++ "हज़ार"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हज़ार"} ! sz ; diff --git a/src/hindustani/CatHindustani.gf b/src/hindustani/CatHindustani.gf index b50e5ffb..22ada04b 100644 --- a/src/hindustani/CatHindustani.gf +++ b/src/hindustani/CatHindustani.gf @@ -70,6 +70,7 @@ incomplete concrete CatHindustani of Cat = Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; ---- Structural diff --git a/src/hindustani/NounHindustani.gf b/src/hindustani/NounHindustani.gf index d9f951d3..fb677814 100644 --- a/src/hindustani/NounHindustani.gf +++ b/src/hindustani/NounHindustani.gf @@ -64,6 +64,7 @@ incomplete concrete NounHindustani of Noun = NumCard n = n ** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/hungarian/CatHun.gf b/src/hungarian/CatHun.gf index b4705e3f..2247e484 100644 --- a/src/hungarian/CatHun.gf +++ b/src/hungarian/CatHun.gf @@ -79,6 +79,7 @@ concrete CatHun of Cat = CommonX - [Adv] ** open ResHun, Prelude in { Card = ResHun.Numeral ; Numeral = ResHun.Numeral ; Digits = {s : CardOrd => Str} ; + Decimal = {s : CardOrd => Str; hasDot : Bool} ; diff --git a/src/hungarian/NounHun.gf b/src/hungarian/NounHun.gf index 7021a900..c132d348 100644 --- a/src/hungarian/NounHun.gf +++ b/src/hungarian/NounHun.gf @@ -137,6 +137,10 @@ concrete NounHun of Noun = CatHun ** open s = \\place => dig.s ! NCard ; } ; + NumDecimal dec = dec ** { + s = \\place => dec.s ! NCard ; + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/hungarian/NumeralHun.gf b/src/hungarian/NumeralHun.gf index f9c66af1..58405457 100644 --- a/src/hungarian/NumeralHun.gf +++ b/src/hungarian/NumeralHun.gf @@ -1,4 +1,4 @@ -concrete NumeralHun of Numeral = CatHun [Numeral,Digits] ** +concrete NumeralHun of Numeral = CatHun [Numeral,Digits,Decimal] ** open Prelude, ResHun in { lincat @@ -115,6 +115,13 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecinal d = { + s = \\x => "-" ++ BIND ++ d.s ! x ; + n = numNumber ; + hasDot=False + } ; + oper mkDig : Str -> TDigit = \s -> { s = s ; diff --git a/src/icelandic/CatIce.gf b/src/icelandic/CatIce.gf index 986911b6..063d6b16 100644 --- a/src/icelandic/CatIce.gf +++ b/src/icelandic/CatIce.gf @@ -126,6 +126,7 @@ concrete CatIce of Cat = CommonX ** open ResIce, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; --2 Structural words diff --git a/src/icelandic/NounIce.gf b/src/icelandic/NounIce.gf index d4720a68..a938c16c 100644 --- a/src/icelandic/NounIce.gf +++ b/src/icelandic/NounIce.gf @@ -86,6 +86,10 @@ concrete NounIce of Noun = CatIce ** open MorphoIce, ResIce, Prelude in { s = \\g,c => d.s ! NCard d.n g c; n = d.n } ; + NumDecimal d = { + s = \\g,c => d.s ! NCard d.n g c; + n = d.n + } ; NumNumeral d = { s = \\g,c => d.s ! NCard Sg g c; diff --git a/src/icelandic/NumeralIce.gf b/src/icelandic/NumeralIce.gf index 43b93c5b..640e8081 100644 --- a/src/icelandic/NumeralIce.gf +++ b/src/icelandic/NumeralIce.gf @@ -1,4 +1,4 @@ -concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce in { +concrete NumeralIce of Numeral = CatIce [Numeral,Digits,Decimal] ** open Prelude, ResIce in { param DForm = unit | teen | ten ; @@ -203,6 +203,20 @@ concrete NumeralIce of Numeral = CatIce [Numeral,Digits] ** open Prelude, ResIce D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Sg Masc Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mkDig : Str -> TDigit = \c -> mk2Dig c (c + ".") ; diff --git a/src/interlingua/CatIna.gf b/src/interlingua/CatIna.gf index 2a463890..b5bbdecf 100644 --- a/src/interlingua/CatIna.gf +++ b/src/interlingua/CatIna.gf @@ -55,6 +55,7 @@ concrete CatIna of Cat = CommonX ** open ResIna, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number ; tail : DTail} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/interlingua/NounIna.gf b/src/interlingua/NounIna.gf index a61bca01..c3c8e5cd 100644 --- a/src/interlingua/NounIna.gf +++ b/src/interlingua/NounIna.gf @@ -61,6 +61,7 @@ concrete NounIna of Noun = CatIna ** open ResIna, Prelude in { NumCard c = c ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd} ; diff --git a/src/interlingua/NumeralIna.gf b/src/interlingua/NumeralIna.gf index dbec5cf3..c486598e 100644 --- a/src/interlingua/NumeralIna.gf +++ b/src/interlingua/NumeralIna.gf @@ -1,4 +1,4 @@ -concrete NumeralIna of Numeral = CatIna [Numeral,Digits] ** open ResIna,Prelude in { +concrete NumeralIna of Numeral = CatIna [Numeral,Digits,Decimal] ** open ResIna,Prelude in { lincat Digit = {s : DForm => CardOrd => Str} ; @@ -66,6 +66,20 @@ concrete NumeralIna of Numeral = CatIna [Numeral,Digits] ** open ResIna,Prelude D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/italian/NumeralIta.gf b/src/italian/NumeralIta.gf index d5e9e8e1..93a55a2f 100644 --- a/src/italian/NumeralIta.gf +++ b/src/italian/NumeralIta.gf @@ -1,4 +1,4 @@ -concrete NumeralIta of Numeral = CatIta [Numeral,Digits] ** +concrete NumeralIta of Numeral = CatIta [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoIta, PhonoIta, Prelude in { lincat @@ -137,6 +137,20 @@ param Pred = pred | indip ; D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; oper mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; diff --git a/src/japanese/CatJpn.gf b/src/japanese/CatJpn.gf index 0cf0cc74..fa667d1f 100644 --- a/src/japanese/CatJpn.gf +++ b/src/japanese/CatJpn.gf @@ -54,6 +54,7 @@ flags coding = utf8 ; DAP = Det ; Numeral = {s : Str ; n : Number ; tenPlus : Bool} ; Digits = {s : Str ; n : Number ; tenPlus : Bool ; tail : DTail} ; + Decimal = {s : Str ; n : Number ; tenPlus : Bool ; hasDot : Bool} ; Conj = Conjunction ; -- {s : Str ; null : Str ; type : ConjType} ; Subj = Subjunction ; -- {s : Str ; type : SubjType} ; Prep = Preposition ; -- {s : Str ; null : Str} ; diff --git a/src/japanese/NounJpn.gf b/src/japanese/NounJpn.gf index 182181ec..be22c711 100644 --- a/src/japanese/NounJpn.gf +++ b/src/japanese/NounJpn.gf @@ -134,6 +134,7 @@ flags coding = utf8 ; NumCard card = card ** {inclCard = True} ; NumDigits num = num ** {postpositive = []} ; + NumDecimal num = num ** {postpositive = []} ; NumNumeral num = num ** {postpositive = []} ; diff --git a/src/japanese/NumeralJpn.gf b/src/japanese/NumeralJpn.gf index 90ce9a46..32c873a6 100644 --- a/src/japanese/NumeralJpn.gf +++ b/src/japanese/NumeralJpn.gf @@ -1,4 +1,4 @@ -concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits] ** open ResJpn, ParadigmsJpn, Prelude in { +concrete NumeralJpn of Numeral = CatJpn [Numeral,Digits,Decimal] ** open ResJpn, ParadigmsJpn, Prelude in { flags coding = utf8 ; @@ -202,7 +202,23 @@ flags coding = utf8 ; D_7 = {s = "7" ; n = Pl ; is0 = False} ; D_8 = {s = "8" ; n = Pl ; is0 = False} ; D_9 = {s = "9" ; n = Pl ; is0 = False} ; - + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = Pl ; + tenPlus = d.tenPlus ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + tenPlus = d.tenPlus ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => "," ; diff --git a/src/kikamba/NumeralKam.gf b/src/kikamba/NumeralKam.gf index d66ae919..030cb1a3 100644 --- a/src/kikamba/NumeralKam.gf +++ b/src/kikamba/NumeralKam.gf @@ -69,6 +69,20 @@ lin pot3plus n m = { s = table { D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o,g => d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf index 042778e2..5248a598 100644 --- a/src/korean/CatKor.gf +++ b/src/korean/CatKor.gf @@ -78,8 +78,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { Card = ResKor.Num ; Numeral = ResKor.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; - - + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; --2 Structural words diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf index 4fdb8787..e446fb6c 100644 --- a/src/korean/NounKor.gf +++ b/src/korean/NounKor.gf @@ -107,9 +107,9 @@ concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { numtype = IsDig } ; - NumFloat dig1 dig2 = baseNum ** { - s = \\_,_ => dig1.s ! NCard ++ BIND ++ "." ++ BIND ++ dig2.s ! NCard ; - n = Pl ; + NumDecimal dec = baseNum ** { + s = \\_,_ => dec.s ! NCard ; + n = dec.n ; numtype = IsDig } ; diff --git a/src/korean/NumeralKor.gf b/src/korean/NumeralKor.gf index e8b41c2c..7b7d979d 100644 --- a/src/korean/NumeralKor.gf +++ b/src/korean/NumeralKor.gf @@ -1,4 +1,4 @@ -concrete NumeralKor of Numeral = CatKor [Numeral,Digits] ** +concrete NumeralKor of Numeral = CatKor [Numeral,Digits,Decimal] ** open Prelude, ResKor in { lincat @@ -154,6 +154,16 @@ lin D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + hasDot=True; + n = Pl + } ; oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o numNumber ; diff --git a/src/latin/CatLat.gf b/src/latin/CatLat.gf index b283d865..8394fe0d 100644 --- a/src/latin/CatLat.gf +++ b/src/latin/CatLat.gf @@ -63,6 +63,7 @@ concrete CatLat of Cat = CommonX-[Adv] ** open ResLat, ParamX, Prelude in { -- Numeral = ResLat.TNumeral ; Digits = {s : Str ; unit : Unit} ; + Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ; -- ---- Structural -- diff --git a/src/latin/NumeralLat.gf b/src/latin/NumeralLat.gf index 0ed4fe40..cb25237a 100644 --- a/src/latin/NumeralLat.gf +++ b/src/latin/NumeralLat.gf @@ -209,6 +209,8 @@ concrete NumeralLat of Numeral = CatLat, ParamX[Number] ** open ParadigmsLat, Pr D_8 = mkDig "VIII" "XVIII" "LXXX" "DCCC" "(VIII)" "(LXXX)" "(DCCC)" ; D_9 = mkDig "IX" "XIX" "XC" "CM" "(IX)" "(XC)" "(CM)" ; + PosDecimal d = d ** {hasDot=False} ; + oper TDig = { s : Unit => Str diff --git a/src/latvian/CatLav.gf b/src/latvian/CatLav.gf index fda3d86e..be990f60 100644 --- a/src/latvian/CatLav.gf +++ b/src/latvian/CatLav.gf @@ -78,6 +78,7 @@ lincat Numeral = {s : CardOrd => Gender => Case => Str ; num : Number} ; Digits = {s : CardOrd => Str ; num : Number} ; + Decimal = {s : CardOrd => Str ; num : Number ; hasDot : Bool} ; -- Structural words diff --git a/src/latvian/NounLav.gf b/src/latvian/NounLav.gf index 4e37d722..2d82dd2b 100644 --- a/src/latvian/NounLav.gf +++ b/src/latvian/NounLav.gf @@ -138,6 +138,7 @@ lin -- Digits -> Card -- e.g. '51' NumDigits digits = { s = \\_,_ => digits.s ! NCard ; num = digits.num } ; + NumDecimal dec = { s = \\_,_ => dec.s ! NCard ; num = dec.num } ; -- Numeral -> Card -- e.g. 'fifty-one' diff --git a/src/latvian/NumeralLav.gf b/src/latvian/NumeralLav.gf index c53a5a49..2bcdfa9a 100644 --- a/src/latvian/NumeralLav.gf +++ b/src/latvian/NumeralLav.gf @@ -1,6 +1,6 @@ --# -path=.:abstract:common:prelude -concrete NumeralLav of Numeral = CatLav [Numeral,Digits] ** open ResLav, ParadigmsLav, Prelude in { +concrete NumeralLav of Numeral = CatLav [Numeral,Digits,Decimal] ** open ResLav, ParadigmsLav, Prelude in { flags coding = utf8 ; @@ -109,6 +109,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + num = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + num = Pl ; + hasDot=True + } ; + oper mkDig : Str -> Dig = \c -> mk2Dig c Pl ; diff --git a/src/lithuanian/CatLit.gf b/src/lithuanian/CatLit.gf index 1951adda..200568cc 100644 --- a/src/lithuanian/CatLit.gf +++ b/src/lithuanian/CatLit.gf @@ -75,6 +75,7 @@ concrete CatLit of Cat = CommonX - [CAdv, Adv] ** open ResLit, Prelude, (R = Par numAgr:NumComb; nb:Number }; Ord = { s:AForm => Str }; Digits = { s:Str; o:Str; numAgr:NumComb; nb:Number }; + Decimal = { s:Str; o:Str; numAgr:NumComb; nb:Number; hasDot : Bool }; ---- Structural diff --git a/src/lithuanian/NounLit.gf b/src/lithuanian/NounLit.gf index d37f7beb..4a090181 100644 --- a/src/lithuanian/NounLit.gf +++ b/src/lithuanian/NounLit.gf @@ -249,6 +249,7 @@ concrete NounLit of Noun = CatLit ** open ResLit, Prelude, MorphoLit, Predef in -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; numAgr=n.numAgr; nb=n.nb }; + NumDecimal n = { s=\\_,_ => n.s; numAgr=n.numAgr; nb=n.nb }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; diff --git a/src/lithuanian/NumeralLit.gf b/src/lithuanian/NumeralLit.gf index 6693535b..5d1909d0 100644 --- a/src/lithuanian/NumeralLit.gf +++ b/src/lithuanian/NumeralLit.gf @@ -345,4 +345,21 @@ oper simtas : Case * Number => Str D_8 = { s = "8"; o="8."; nb=Pl; numAgr=AgrComb }; D_9 = { s = "9"; o="9."; nb=Pl; numAgr=AgrComb }; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + o = "-" ++ BIND ++ d.o; + nb=Pl; + numAgr=d.numAgr; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + nb = Pl ; + numAgr=d.numAgr; + hasDot=True + } ; + } diff --git a/src/malay/CatMay.gf b/src/malay/CatMay.gf index 74b5192c..089d1a44 100644 --- a/src/malay/CatMay.gf +++ b/src/malay/CatMay.gf @@ -80,6 +80,7 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { Card = ResMay.CardNum ; Numeral = ResMay.CardOrdNum ; Digits = ResMay.DigNum ; + Decimal = ResMay.DigNum**{hasDot : Bool} ; @@ -132,4 +133,4 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in { -- Determiner : Type = Quant ** { -- pr : Str ; -- prefix for numbers -- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl --- } ; \ No newline at end of file +-- } ; diff --git a/src/malay/NounMay.gf b/src/malay/NounMay.gf index 48c8854f..72d85a76 100644 --- a/src/malay/NounMay.gf +++ b/src/malay/NounMay.gf @@ -101,6 +101,10 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in { s = dig.s ! NCard } ; + NumDecimal dec = { + s = dec.s ! NCard + } ; + -- : Numeral -> Card ; NumNumeral num = num ; diff --git a/src/malay/NumeralMay.gf b/src/malay/NumeralMay.gf index a0d39193..c835cedd 100644 --- a/src/malay/NumeralMay.gf +++ b/src/malay/NumeralMay.gf @@ -1,6 +1,6 @@ -- David Wahlstedt 2002 (cardinal numbers) -- Inari Listenmaa 2020 (ordinals + cosmetic changes) -concrete NumeralMay of Numeral = CatMay [Numeral,Digits] ** +concrete NumeralMay of Numeral = CatMay [Numeral,Digits,Decimal] ** open Prelude, ResMay in { lincat @@ -151,6 +151,16 @@ oper D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False} ; + IFrac d i = { + s=\\o=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + hasDot=True; + n = Pl + } ; + oper mkDig : Str -> DigNum = \s -> { s = table { diff --git a/src/maltese/CatMlt.gf b/src/maltese/CatMlt.gf index a091c831..bf77bc9f 100644 --- a/src/maltese/CatMlt.gf +++ b/src/maltese/CatMlt.gf @@ -98,6 +98,11 @@ concrete CatMlt of Cat = CommonX - [Adv] ** open ResMlt, Prelude in { n : NumForm ; tail : DTail ; } ; + Decimal = { + s : NumCase => Str ; -- No need for CardOrd, i.e. no 1st, 2nd etc in Maltese + n : NumForm ; + hasDot : Bool ; + } ; -- Structural diff --git a/src/maltese/NounMlt.gf b/src/maltese/NounMlt.gf index 5ca05370..408e7aa8 100644 --- a/src/maltese/NounMlt.gf +++ b/src/maltese/NounMlt.gf @@ -189,9 +189,7 @@ concrete NounMlt of Noun = CatMlt ** open ResMlt, Prelude, Maybe in { -- 51 NumDigits d = {s = d.s ; n = d.n} ; - -- Digits -> Digits -> Card - -- 3.14 - NumFloat d1 d2 = {s = \\c => d1.s ! NumNom ++ BIND ++ "." ++ BIND ++ d2.s ! c ; n = d1.n} ; + NumDecimal d = {s = d.s ; n = d.n} ; -- Digits -> Ord -- 51st diff --git a/src/maltese/NumeralMlt.gf b/src/maltese/NumeralMlt.gf index 1d19d1e0..313f3a4d 100644 --- a/src/maltese/NumeralMlt.gf +++ b/src/maltese/NumeralMlt.gf @@ -4,7 +4,7 @@ -- John J. Camilleri 2011 -- 2013 -- Licensed under LGPL -concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt in { +concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits,Decimal] ** open Prelude,ResMlt in { flags coding=utf8 ; @@ -437,4 +437,18 @@ concrete NumeralMlt of Numeral = CatMlt [Numeral,Digits] ** open Prelude,ResMlt tail = inc i.tail } ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = d.n ; + hasDot=False + } ; + IFrac d i = { + s=\\o=>d.s ! NumNom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = d.n; + hasDot=True + } ; + } diff --git a/src/mongolian/CatMon.gf b/src/mongolian/CatMon.gf index 172798e6..e9cb5082 100644 --- a/src/mongolian/CatMon.gf +++ b/src/mongolian/CatMon.gf @@ -84,7 +84,8 @@ lincat Num = {s : Str ; sp : RCase => Str ; n : Number ; isNum : Bool} ; Card = {s : Str ; sp : RCase => Str ; n : Number} ; Numeral = {s : CardOrd => Str; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number} ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; -- Structural diff --git a/src/mongolian/NounMon.gf b/src/mongolian/NounMon.gf index 672e84af..6bedac07 100644 --- a/src/mongolian/NounMon.gf +++ b/src/mongolian/NounMon.gf @@ -109,7 +109,7 @@ lin NumCard n = n ** {isNum = True} ; - NumDigits,NumNumeral = \numeral -> { + NumDigits,NumNumeral,NumDecimal = \numeral -> { s = numeral.s ! NCard ; sp = \\_ => numeral.s ! NCard ; n = numeral.n diff --git a/src/mongolian/NumeralMon.gf b/src/mongolian/NumeralMon.gf index 2c2d941b..060ad731 100644 --- a/src/mongolian/NumeralMon.gf +++ b/src/mongolian/NumeralMon.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../prelude -concrete NumeralMon of Numeral = CatMon [Numeral,Digits] ** open ResMon, MorphoMon, Prelude in { +concrete NumeralMon of Numeral = CatMon [Numeral,Digits,Decimal] ** open ResMon, MorphoMon, Prelude in { flags coding=utf8 ; @@ -158,6 +158,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\co => "-" ++ BIND ++ d.s ! co ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\co => d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + "-р") ; diff --git a/src/nepali/CatNep.gf b/src/nepali/CatNep.gf index 9414f783..53a066f0 100644 --- a/src/nepali/CatNep.gf +++ b/src/nepali/CatNep.gf @@ -68,6 +68,7 @@ concrete CatNep of Cat = CommonX - [Adv] ** open ResNep, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/nepali/NounNep.gf b/src/nepali/NounNep.gf index ccfd710f..5a278765 100644 --- a/src/nepali/NounNep.gf +++ b/src/nepali/NounNep.gf @@ -72,6 +72,7 @@ concrete NounNep of Noun = CatNep ** open ResNep, Prelude in { PossPron p = {s = \\_,_ => p.ps } ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd ; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/nepali/NumeralNep.gf b/src/nepali/NumeralNep.gf index b9778f70..e16dba72 100644 --- a/src/nepali/NumeralNep.gf +++ b/src/nepali/NumeralNep.gf @@ -1,4 +1,4 @@ -concrete NumeralNep of Numeral = CatNep [Numeral,Digits] ** open ResNep, Prelude in { +concrete NumeralNep of Numeral = CatNep [Numeral,Digits,Decimal] ** open ResNep, Prelude in { -- By Harald Hammarstroem -- Modification for Nepali by Dinesh Simkhada and Shafqat Virk - 2011 flags coding=utf8 ; @@ -114,6 +114,16 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { s = \\df => Prelude.glue "-" (d.s ! df) ; n = Pl ; hasDot=False } ; + IFrac d i = { + s=\\df=>d.s ! df ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + hasDot=True; + n = Pl + } ; + oper ekhazar : Str = variants {"एक" ++ "हजार" ; "हजार"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "हजार"} ! sz ; oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "एक" ++ "सय" ; _ => s ++ "सय"} ! sz ; diff --git a/src/nepali/src/NumeralNep.gf b/src/nepali/src/NumeralNep.gf index d3a2ba71..5a9a53d6 100644 --- a/src/nepali/src/NumeralNep.gf +++ b/src/nepali/src/NumeralNep.gf @@ -114,6 +114,8 @@ lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue d.s (dg.s ! df) ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; + oper ekhazar : Str = variants {"e:k" ++ "hjar" ; "hjar"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "hjar"} ! sz ; oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "e:k" ++ "sy" ; _ => s ++ "sy"} ! sz ; diff --git a/src/norwegian/NumeralNor.gf b/src/norwegian/NumeralNor.gf index 19074963..08c315bb 100644 --- a/src/norwegian/NumeralNor.gf +++ b/src/norwegian/NumeralNor.gf @@ -1,4 +1,4 @@ -concrete NumeralNor of Numeral = CatNor [Numeral,Digits] ** open MorphoNor, Prelude in { +concrete NumeralNor of Numeral = CatNor [Numeral,Digits,Decimal] ** open MorphoNor, Prelude in { flags coding=utf8 ; lincat @@ -68,6 +68,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/nynorsk/NumeralNno.gf b/src/nynorsk/NumeralNno.gf index 35282eff..8334230f 100644 --- a/src/nynorsk/NumeralNno.gf +++ b/src/nynorsk/NumeralNno.gf @@ -1,4 +1,4 @@ -concrete NumeralNno of Numeral = CatNno [Numeral,Digits] ** open MorphoNno, Prelude in { +concrete NumeralNno of Numeral = CatNno [Numeral,Digits,Decimal] ** open MorphoNno, Prelude in { flags coding=utf8 ; lincat @@ -68,6 +68,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/persian/CatPes.gf b/src/persian/CatPes.gf index 2cc00b12..86b1def4 100644 --- a/src/persian/CatPes.gf +++ b/src/persian/CatPes.gf @@ -64,7 +64,8 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in { ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/persian/NounPes.gf b/src/persian/NounPes.gf index c76776b8..d4db1324 100644 --- a/src/persian/NounPes.gf +++ b/src/persian/NounPes.gf @@ -97,6 +97,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in { NumCard n = n ** {isNum = True} ; NumDigits n = n ** {s = n.s ! NCard; isNum = True} ; + NumDecimal n = n ** {s = n.s ! NCard; isNum = True} ; OrdDigits n = n ** {s = n.s ! NOrd ; isNum = True ; isPre=False} ; NumNumeral n = n ** {s = n.s ! NCard; isNum = True} ; diff --git a/src/persian/NumeralPes.gf b/src/persian/NumeralPes.gf index 3e1f767b..1305364f 100644 --- a/src/persian/NumeralPes.gf +++ b/src/persian/NumeralPes.gf @@ -1,5 +1,5 @@ --# -path=.:../abstract:../common: -concrete NumeralPes of Numeral = CatPes [Numeral,Digits] ** open ResPes,Prelude in { +concrete NumeralPes of Numeral = CatPes [Numeral,Digits,Decimal] ** open ResPes,Prelude in { flags coding = utf8; @@ -83,7 +83,21 @@ lin pot3plus n m = { D_9 = mkDig "9" ; -- lin IDig d = { s = \\_ => d.s ; n = Sg} ; - lin IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + IIDig d dg = { s = \\df => d.s ! NCard ++ dg.s ! df ; n = Pl}; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\df => "-" ++ d.s ! df ; + n = Pl ; + hasDot=False + }; + IFrac d i = { + s=\\df=>d.s ! NCard ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! df; + n = Pl; + hasDot=True + } ; oper commaIf : DTail -> Str = \t -> case t of { diff --git a/src/polish/CatPol.gf b/src/polish/CatPol.gf index 877432ca..cf29fa91 100644 --- a/src/polish/CatPol.gf +++ b/src/polish/CatPol.gf @@ -75,6 +75,7 @@ concrete CatPol of Cat = CommonX - [CAdv] ** open ResPol, Prelude, (R = ParamX) a:Accom; n:Number }; Ord = { s: AForm => Str }; Digits = { s:Str; o:Str; a:Accom; n:Number }; + Decimal = { s:Str; o:Str; a:Accom; n:Number; hasDot : Bool }; ---- Structural diff --git a/src/polish/NounPol.gf b/src/polish/NounPol.gf index f0138063..36c82e92 100644 --- a/src/polish/NounPol.gf +++ b/src/polish/NounPol.gf @@ -164,7 +164,7 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor -- NumDigits : Digits -> Card ; -- 51 NumDigits n = { s=\\_,_ => n.s; a=n.a; n=n.n }; - NumFloat n1 n2 = { s=\\_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s; a=n1.a; n=Pl }; + NumDecimal n = { s=\\_,_ => n.s; a=n.a; n=n.n }; -- NumCard : Card -> Num ; NumCard c = c ** { hasCard = True }; @@ -217,11 +217,4 @@ concrete NounPol of Noun = CatPol ** open ResPol, Prelude, PronounMorphoPol, Mor p = P3 } ; - QuantityFloatNP n1 n2 m = { - nom,voc = preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; - dep = \\cc => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; - gn = OthersPl; - p = P3 - } ; - } diff --git a/src/polish/NumeralPol.gf b/src/polish/NumeralPol.gf index 92a8e1c3..60ec8784 100644 --- a/src/polish/NumeralPol.gf +++ b/src/polish/NumeralPol.gf @@ -2,7 +2,7 @@ -- Adam Slaski, 2009, 2010 -concrete NumeralPol of Numeral = CatPol [Numeral,Digits] ** open ResPol,Prelude, AdjectiveMorphoPol in { +concrete NumeralPol of Numeral = CatPol [Numeral,Digits,Decimal] ** open ResPol,Prelude, AdjectiveMorphoPol in { flags coding=utf8 ; @@ -553,4 +553,24 @@ oper tysiac = table { D_8 = { s = "8"; o="8."; n=Pl; a=PiecA }; D_9 = { s = "9"; o="9."; n=Pl; a=PiecA }; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s; + o = "-" ++ BIND ++ d.o; + n=Pl; + a=d.a; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + o = d.o ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.o; + n=Pl; + a=d.a; + hasDot=True + } ; + } diff --git a/src/portuguese/NumeralPor.gf b/src/portuguese/NumeralPor.gf index 5006a5ec..b1ddce78 100644 --- a/src/portuguese/NumeralPor.gf +++ b/src/portuguese/NumeralPor.gf @@ -1,4 +1,4 @@ -concrete NumeralPor of Numeral = CatPor [Numeral,Digits] ** +concrete NumeralPor of Numeral = CatPor [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoPor, Prelude, Predef in { flags coding=utf8 ; @@ -207,6 +207,20 @@ concrete NumeralPor of Numeral = CatPor [Numeral,Digits] ** D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk4Dig : Str -> Str -> Str -> Number -> TDigit = \c,o,a,n -> { s = table { diff --git a/src/punjabi/CatPnb.gf b/src/punjabi/CatPnb.gf index fdccd81c..5410a10f 100644 --- a/src/punjabi/CatPnb.gf +++ b/src/punjabi/CatPnb.gf @@ -61,7 +61,8 @@ concrete CatPnb of Cat = CommonX - [Adv] ** open ResPnb, Prelude in { ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; - Digits = {s : CardOrd => Str ; n : Number } ; + Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/punjabi/NounPnb.gf b/src/punjabi/NounPnb.gf index 1231e9aa..959e8772 100644 --- a/src/punjabi/NounPnb.gf +++ b/src/punjabi/NounPnb.gf @@ -64,6 +64,8 @@ concrete NounPnb of Noun = CatPnb ** open ResPnb, Prelude in { NumDigits n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; + NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ; diff --git a/src/punjabi/NumeralPnb.gf b/src/punjabi/NumeralPnb.gf index 8dcdb71f..ceba5005 100644 --- a/src/punjabi/NumeralPnb.gf +++ b/src/punjabi/NumeralPnb.gf @@ -1,4 +1,4 @@ -concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits] ** open ResPnb, Prelude in { +concrete NumeralPnb of Numeral = CatPnb [Numeral,Digits,Decimal] ** open ResPnb, Prelude in { -- By Harald Hammarstroem -- Modification for Punjabi by Shafqat Virk flags coding=utf8 ; @@ -119,6 +119,19 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; +lin IFrac d i = { + s = \\o => d.s ! o ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + hasDot=True + } ; oper ekhazar : Str = variants {"ہزار" ; "اك" ++ "ہزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ; diff --git a/src/romance/CatRomance.gf b/src/romance/CatRomance.gf index e6932e44..034c5f73 100644 --- a/src/romance/CatRomance.gf +++ b/src/romance/CatRomance.gf @@ -88,6 +88,7 @@ incomplete concrete CatRomance of Cat = CommonX - [SC,Pol] Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/romance/NounRomance.gf b/src/romance/NounRomance.gf index 56bc6776..6d6615de 100644 --- a/src/romance/NounRomance.gf +++ b/src/romance/NounRomance.gf @@ -96,7 +96,7 @@ incomplete concrete NounRomance of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = \\a => nu.s ! NOrd a.g a.n} ; - NumFloat n1 n2 = {s = \\g => n1.s ! NCard Masc ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; n = Pl} ; + NumDecimal nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = \\a => nu.s ! NOrd a.g a.n} ; @@ -213,10 +213,4 @@ incomplete concrete NounRomance of Noun = hasClit = False } ; - QuantityFloatNP n1 n2 m = heavyNPpol False { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard Masc ++ BIND ++ "." ++ BIND ++ n2.s ! NCard Masc) ; - a = agrP3 Masc Pl ; - hasClit = False - } ; - } diff --git a/src/romanian/CatRon.gf b/src/romanian/CatRon.gf index 9cb5bb4f..f55a135e 100644 --- a/src/romanian/CatRon.gf +++ b/src/romanian/CatRon.gf @@ -80,6 +80,7 @@ concrete CatRon of Cat = sp : ACase => CardOrd => NumF => Str ; size : Size } ; Digits = {s : CardOrd => Str ; n : Size ; isDig : Bool} ; + Decimal = {s : CardOrd => Str ; n : Size ; isDig : Bool; hasDot : Bool} ; Num = {s : Gender => Str ; sp : Gender => Str ; isNum : Bool ; n : Number; size : Str } ; diff --git a/src/romanian/NounRon.gf b/src/romanian/NounRon.gf index 13af4df6..f879288b 100644 --- a/src/romanian/NounRon.gf +++ b/src/romanian/NounRon.gf @@ -172,8 +172,8 @@ in { isPre = True }; - NumFloat n1 n2 = {s,sp = \\g => n1.s ! NCard g ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; - size = n1.n; n = Pl }; + NumDecimal nu = {s,sp = \\g => nu.s ! NCard g ; + size = nu.n; n = getNumber nu.n }; NumNumeral nu = {s = \\g => nu.s ! ANomAcc ! (NCard g) ! Formal ; sp = \\g => nu.sp ! ANomAcc ! (NCard g) ! Formal ; diff --git a/src/romanian/NumeralRon.gf b/src/romanian/NumeralRon.gf index 2370af48..a7680923 100644 --- a/src/romanian/NumeralRon.gf +++ b/src/romanian/NumeralRon.gf @@ -1,4 +1,4 @@ -concrete NumeralRon of Numeral = CatRon [Numeral,Digits] ** +concrete NumeralRon of Numeral = CatRon [Numeral,Digits,Decimal] ** open MorphoRon, CatRon, Prelude in { flags coding = utf8 ; @@ -247,6 +247,21 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = pl; + isDig = False ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = pl ; + isDig = False ; + hasDot=True + } ; oper mkDig : Str -> Dig = \c -> mk3Dig c (c + "lea") (c + "a") less20 ; diff --git a/src/rukiga/CatCgg.gf b/src/rukiga/CatCgg.gf index 419b3dd7..286c754d 100644 --- a/src/rukiga/CatCgg.gf +++ b/src/rukiga/CatCgg.gf @@ -90,6 +90,7 @@ lincat } ; Numeral = {s : Res.CardOrd=>Res.Agreement=> Str ; g : Res.Gender; n: Res.Number} ; Digits = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number ; tail : Px.DTail} ; + Decimal = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number; hasDot : Bool} ; Ord = {s :Res.Agreement=>Str; position:Res.Position} ; Card = {s :Res.Agreement=>Str; n : Res.Number} ; A2 = Res.Adjective ** { c2 : Str ; isPre : Bool} ; diff --git a/src/rukiga/NounCgg.gf b/src/rukiga/NounCgg.gf index 41aa22b8..09af39a4 100644 --- a/src/rukiga/NounCgg.gf +++ b/src/rukiga/NounCgg.gf @@ -116,6 +116,7 @@ lin --NumDigits : Digits -> Card ; -- 51 NumDigits dig = {s = dig.s!NCard ; n=dig.n}; + NumDecimal dec = {s = dec.s!NCard ; n=dec.n}; --NumNumeral : Numeral -> Card ; -- fifty-one NumNumeral numeral = {s=numeral.s!NCard; n=numeral.n}; --OrdDigits : Digits -> Ord ; -- 51st diff --git a/src/rukiga/NumeralCgg.gf b/src/rukiga/NumeralCgg.gf index 1af17162..be0e1961 100644 --- a/src/rukiga/NumeralCgg.gf +++ b/src/rukiga/NumeralCgg.gf @@ -1,6 +1,6 @@ --# -path=.:../prelude:../abstract:../common -concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits] ** +concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits,Decimal] ** open ResCgg, Prelude in { lincat @@ -100,6 +100,16 @@ lin pot3plus n m = let D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,a=>"-" ++ BIND ++ d.s ! o ! a; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,a=>d.s ! NCard ! a ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! a ; + hasDot=True; + n = Pl + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND ++ "," ++ BIND ; diff --git a/src/russian/CatRus.gf b/src/russian/CatRus.gf index dd028baa..2c770052 100644 --- a/src/russian/CatRus.gf +++ b/src/russian/CatRus.gf @@ -82,6 +82,7 @@ lincat Num = NumDet ; Card = NumDet ; Digits = {s : Str ; size: NumSize} ; + Decimal = {s : Str ; size: NumSize; hasDot : Bool} ; QS = {s : QForm => Str} ; QCl = { diff --git a/src/russian/NounRus.gf b/src/russian/NounRus.gf index 6ea0cd48..83cbc3ff 100644 --- a/src/russian/NounRus.gf +++ b/src/russian/NounRus.gf @@ -87,7 +87,7 @@ lin -- : Digits -> Card ; -- 51 NumDigits n = {s = \\_,_,_ => n.s ; size = n.size } ; - NumFloat n1 n2 = {s = \\_,_,_ => n1.s ++ BIND ++ "." ++ BIND ++ n2.s ; size = n1.size } ; + NumDecimal n = {s = \\_,_,_ => n.s ; size = n.size } ; -- : Quant -> Num -> Det ; -- these five DetQuant quant num = { @@ -247,10 +247,4 @@ lin a=Ag (gennum Masc (numSizeNumber n.size)) P3 } ; - QuantityFloatNP n1 n2 m = { - s = \\cas => preOrPost m.isPre m.s (n1.s ++ BIND ++ "." ++ BIND ++ n2.s) ; - pron=False ; - a=Ag GPl P3 - } ; - } diff --git a/src/russian/NumeralRus.gf b/src/russian/NumeralRus.gf index 889212e3..cc483602 100644 --- a/src/russian/NumeralRus.gf +++ b/src/russian/NumeralRus.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../../prelude -concrete NumeralRus of Numeral = CatRus [Numeral,Digits] ** open ResRus, InflectionRus, Prelude in { +concrete NumeralRus of Numeral = CatRus [Numeral,Digits,Decimal] ** open ResRus, InflectionRus, Prelude in { flags coding=utf8 ; @@ -431,6 +431,22 @@ lin D_7 = mk2Dig "7" Num5 ; D_8 = mk2Dig "8" Num5 ; D_9 = mk2Dig "9" Num5 ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = Pl ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s=d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + n = Pl ; + size = d.size ; + hasDot=True + } ; oper mk3Dig : Str -> Str -> NumSize -> TDigit = \c,o,size -> mk4Dig c o Pl size ; diff --git a/src/russian/v1/NumeralRus.gf b/src/russian/v1/NumeralRus.gf index 298098c4..ffa54c6a 100644 --- a/src/russian/v1/NumeralRus.gf +++ b/src/russian/v1/NumeralRus.gf @@ -252,6 +252,8 @@ lin pot3plus n m = D_8 = mk2Dig "8" plg ; D_9 = mk2Dig "9" plg ; + PosDecimal d = d ** {hasDot=False} ; + oper mk3Dig : Str -> Str -> Size -> TDigit = \c,o,size -> mk4Dig c o Pl size ; mk2Dig : Str -> Size -> TDigit = \c,size -> mk3Dig c (c + "o") size ; diff --git a/src/scandinavian/CatScand.gf b/src/scandinavian/CatScand.gf index cdf4be02..56572e92 100644 --- a/src/scandinavian/CatScand.gf +++ b/src/scandinavian/CatScand.gf @@ -87,6 +87,7 @@ incomplete concrete CatScand of Cat = Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ; -- Structural diff --git a/src/scandinavian/NounScand.gf b/src/scandinavian/NounScand.gf index b6cfa775..2f034c05 100644 --- a/src/scandinavian/NounScand.gf +++ b/src/scandinavian/NounScand.gf @@ -110,7 +110,7 @@ incomplete concrete NounScand of Noun = NumDigits nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdDigits nu = {s = nu.s ! NOrd SupWeak} ; - NumFloat n1 n2 = {s = \\g => n1.s ! NCard neutrum ++ BIND ++ "." ++ BIND ++ n2.s ! NCard g ; n = Pl} ; + NumDecimal dec = {s = \\g => dec.s ! NCard g ; n = dec.n} ; NumNumeral nu = {s = \\g => nu.s ! NCard g ; n = nu.n} ; OrdNumeral nu = {s = nu.s ! NOrd SupWeak} ; @@ -269,10 +269,4 @@ incomplete concrete NounScand of Noun = isPron = False } ; - QuantityFloatNP n1 n2 m = { - s = \\c => preOrPost m.isPre m.s (n1.s ! NCard neutrum ++ BIND ++ "." ++ BIND ++ n2.s ! NCard neutrum) ; - a = agrP3 Utr Pl ; - isPron = False - } ; - } diff --git a/src/sindhi/CatSnd.gf b/src/sindhi/CatSnd.gf index 9431d5c3..d0c37a96 100644 --- a/src/sindhi/CatSnd.gf +++ b/src/sindhi/CatSnd.gf @@ -71,6 +71,7 @@ concrete CatSnd of Cat = CommonX - [Adv] ** open ResSnd, Prelude in { Numeral = {s : CardOrd => Str ; n : Number} ; Digits = {s : CardOrd => Str ; n : Number } ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; ---- Structural diff --git a/src/sindhi/NounSnd.gf b/src/sindhi/NounSnd.gf index 1cfffd48..2679e3ee 100644 --- a/src/sindhi/NounSnd.gf +++ b/src/sindhi/NounSnd.gf @@ -62,6 +62,7 @@ concrete NounSnd of Noun = CatSnd ** open ResSnd, Prelude in { NumCard n = n ** {hasCard = True} ; NumDigits n = {s = n.s ! NCard ; n = n.n} ; + NumDecimal n = {s = n.s ! NCard ; n = n.n} ; OrdDigits n = {s = n.s ! NOrd; n = n.n} ; NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; diff --git a/src/sindhi/NumeralSnd.gf b/src/sindhi/NumeralSnd.gf index 0a1201a5..81fa1902 100644 --- a/src/sindhi/NumeralSnd.gf +++ b/src/sindhi/NumeralSnd.gf @@ -1,4 +1,4 @@ -concrete NumeralSnd of Numeral = CatSnd [Numeral,Digits] ** open ResSnd, Prelude in { +concrete NumeralSnd of Numeral = CatSnd [Numeral,Digits,Decimal] ** open ResSnd, Prelude in { -- By Harald Hammarstroem -- Modification for Punjabi by Shafqat Virk flags coding=utf8 ; @@ -119,6 +119,7 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; oper ekhazar : Str = variants {"ھزار" ; "ھڪ" ++ "ھزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ھزار"} ! sz ; diff --git a/src/slovak/CatSlo.gf b/src/slovak/CatSlo.gf index bc5b6be9..afcc325a 100644 --- a/src/slovak/CatSlo.gf +++ b/src/slovak/CatSlo.gf @@ -66,6 +66,7 @@ concrete CatSlo of Cat = lincat Numeral = Determiner ; ---- TODO: should contain Ord as well lincat Digits = {s:Str ; size : NumSize} ; + lincat Decimal = {s:Str ; size : NumSize; hasDot : Bool} ; } diff --git a/src/slovak/NounSlo.gf b/src/slovak/NounSlo.gf index a1af7b10..fef689f1 100644 --- a/src/slovak/NounSlo.gf +++ b/src/slovak/NounSlo.gf @@ -95,6 +95,7 @@ lin NumCard c = c ; NumDigits ds = ds ** {s = \\_,_ => ds.s} ; + NumDecimal ds = ds ** {s = \\_,_ => ds.s} ; NumNumeral nu = nu ; diff --git a/src/slovak/NumeralSlo.gf b/src/slovak/NumeralSlo.gf index ece83a78..b44e11b7 100644 --- a/src/slovak/NumeralSlo.gf +++ b/src/slovak/NumeralSlo.gf @@ -1,6 +1,6 @@ concrete NumeralSlo of Numeral = - CatSlo [Numeral,Digits] ** + CatSlo [Numeral,Digits,Decimal] ** open ResSlo, @@ -122,4 +122,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ; D_8 = { s = "8" ; size = Num5} ; D_9 = { s = "9" ; size = Num5} ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ Predef.BIND ++ d.s ; + size = d.size ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s; + size = d.size ; + hasDot=True + } ; + } diff --git a/src/slovenian/CatSlv.gf b/src/slovenian/CatSlv.gf index 8fcf21e5..41285bb5 100644 --- a/src/slovenian/CatSlv.gf +++ b/src/slovenian/CatSlv.gf @@ -31,6 +31,8 @@ lincat -- Numeral Numeral = {s : Gender => Case => Str ; n : NumAgr} ; + Digits = {s : Str ; n : NumAgr} ; + Decimal = {s : Str ; n : NumAgr ; hasDot : Bool} ; -- Structural Conj = {s : Str; n : Number} ; diff --git a/src/slovenian/NounSlv.gf b/src/slovenian/NounSlv.gf index 02aef980..c9e992aa 100644 --- a/src/slovenian/NounSlv.gf +++ b/src/slovenian/NounSlv.gf @@ -58,7 +58,15 @@ concrete NounSlv of Noun = CatSlv ** open ResSlv,Prelude in { NumCard n = n ; - NumNumeral numeral = {s = numeral.s; n = numeral.n} ; + NumNumeral numeral = numeral ; + NumDigits digits = { + s = \\g,c => digits.s; + n = digits.n + } ; + NumDecimal decimal = { + s = \\g,c => decimal.s; + n = decimal.n + } ; DefArt = { s = \\_,_,_ => "" ; diff --git a/src/slovenian/NumeralSlv.gf b/src/slovenian/NumeralSlv.gf index 6dc79d5f..c805aeae 100644 --- a/src/slovenian/NumeralSlv.gf +++ b/src/slovenian/NumeralSlv.gf @@ -1,4 +1,4 @@ -concrete NumeralSlv of Numeral = CatSlv [Numeral,Digits] ** open Prelude, ResSlv in { +concrete NumeralSlv of Numeral = CatSlv [Numeral,Digits,Decimal] ** open Prelude, ResSlv in { lincat Digit = {s : DForm => Case => Str; n : NumAgr} ; @@ -200,12 +200,12 @@ oper mkDigit2 : (_,_,_,_,_,_ : Str) -> Gender => Case => Str; Dig = TDigit ; lin - IDig d = d ; + IDig d = d ** {n=UseNum d.n}; IIDig d i = { s = d.s ++ BIND ++ i.s ; ---- s = \\o => d.s ! NCard Masc ++ BIND ++ i.s ! o ; - n = Pl + n = UseNum Pl } ; D_0 = mkDig "0" ; @@ -219,6 +219,20 @@ oper mkDigit2 : (_,_,_,_,_,_ : Str) -> Gender => Case => Str; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = "-" ++ BIND ++ d.s ; + n = UseNum Pl ; + hasDot=False + } ; + IFrac d i = { + s = d.s ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = UseNum Pl ; + hasDot=True + } ; + oper mkDig : Str -> TDigit = \c -> mk2Dig c Pl ; diff --git a/src/somali/CatSom.gf b/src/somali/CatSom.gf index d66f323b..3f97933d 100644 --- a/src/somali/CatSom.gf +++ b/src/somali/CatSom.gf @@ -80,6 +80,7 @@ concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in { Card = BaseNum ; Numeral = ResSom.Numeral ; Digits = {s : CardOrd => Str ; n : Number} ; + Decimal = {s : CardOrd => Str ; n : Number; hasDot : Bool} ; diff --git a/src/somali/NumeralSom.gf b/src/somali/NumeralSom.gf index 51660dee..32a32dc0 100644 --- a/src/somali/NumeralSom.gf +++ b/src/somali/NumeralSom.gf @@ -1,4 +1,4 @@ -concrete NumeralSom of Numeral = CatSom [Numeral,Digits] ** +concrete NumeralSom of Numeral = CatSom [Numeral,Digits,Decimal] ** open Prelude, ResSom, ParamSom in { oper @@ -161,5 +161,18 @@ lin D_9 = mkDig "9" ; lin IDig dig = dig ; -- : Dig -> Digits -> Digits ; lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\co => glue "-" (d.s ! co) ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\co => d.s ! co ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! co; + n = Pl ; + hasDot=True + } ; } diff --git a/src/spanish/NumeralSpa.gf b/src/spanish/NumeralSpa.gf index 7cf6ecf6..139dee15 100644 --- a/src/spanish/NumeralSpa.gf +++ b/src/spanish/NumeralSpa.gf @@ -1,4 +1,4 @@ -concrete NumeralSpa of Numeral = CatSpa [Numeral,Digits] ** +concrete NumeralSpa of Numeral = CatSpa [Numeral,Digits,Decimal] ** open CommonRomance, ResRomance, MorphoSpa, Prelude in { flags coding=utf8 ; @@ -132,6 +132,20 @@ param D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard Masc ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ; + n = Pl ; + hasDot=False + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ; diff --git a/src/swahili/NumeralSwa.gf b/src/swahili/NumeralSwa.gf index 7b645114..3b3ce8ff 100644 --- a/src/swahili/NumeralSwa.gf +++ b/src/swahili/NumeralSwa.gf @@ -1,4 +1,4 @@ -concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits] ** +concrete NumeralSwa of Numeral = CatSwa [Numeral,Digits,Decimal] ** open Prelude,DiffSwa,MorphoSwa in { lincat @@ -76,6 +76,16 @@ lin pot4as5 n = n ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = {s=\\o,g=>"-" ++ BIND ++ d.s ! o ! g; hasDot=False; n = Pl} ; + IFrac d i = { + s=\\o,g=>d.s ! NCard ! g ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o ! g ; + hasDot=True; + n = Pl + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ; diff --git a/src/swedish/NumeralSwe.gf b/src/swedish/NumeralSwe.gf index 6e4c60ef..23e0d57e 100644 --- a/src/swedish/NumeralSwe.gf +++ b/src/swedish/NumeralSwe.gf @@ -1,4 +1,4 @@ -concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits] ** open ResSwe, MorphoSwe, Prelude in { +concrete NumeralSwe of Numeral = CatSwe [Numeral,Digits,Decimal] ** open ResSwe, MorphoSwe, Prelude in { flags coding=utf8 ; lincat @@ -56,16 +56,16 @@ lin 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) ; + pot4decimal d = + numPl (\\g => d.s ! NCard Utr ++ 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) ; + pot5decimal d = + numPl (\\g => d.s ! NCard Utr ++ cardOrd "miljarder" "miljarde" ! g) ; lincat Dig = TDigit ; @@ -89,6 +89,20 @@ lin D_8 = mkDig "8" ; D_9 = mkDig "9" ; + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\o => "-" ++ BIND ++ d.s ! o ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\o => d.s ! NCard neutrum ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! o; + n = Pl ; + hasDot=True + } ; + oper mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ; diff --git a/src/thai/CatTha.gf b/src/thai/CatTha.gf index 398c19f1..b35c4e22 100644 --- a/src/thai/CatTha.gf +++ b/src/thai/CatTha.gf @@ -51,6 +51,7 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in { -- Numeral Numeral, Card, Digits = {s : Str} ; + Decimal = {s : Str; hasDot : Bool} ; -- Structural diff --git a/src/thai/NounTha.gf b/src/thai/NounTha.gf index 6cc9c232..914ca2d8 100644 --- a/src/thai/NounTha.gf +++ b/src/thai/NounTha.gf @@ -38,6 +38,7 @@ concrete NounTha of Noun = CatTha ** open StringsTha, ResTha, Prelude in { NumCard n = n ** {hasC = True} ; NumDigits d = d ; + NumDecimal d = d ; OrdDigits d = {s = thbind thii_s d.s} ; NumNumeral numeral = numeral ** {hasC = True} ; diff --git a/src/thai/NumeralTha.gf b/src/thai/NumeralTha.gf index 347006a1..23fa6c64 100644 --- a/src/thai/NumeralTha.gf +++ b/src/thai/NumeralTha.gf @@ -89,4 +89,6 @@ oper D_8 = ss "๘" ; D_9 = ss "๙" ; + PosDecimal d = d ** {hasDot=False} ; + } diff --git a/src/turkish/CatTur.gf b/src/turkish/CatTur.gf index ec30fa20..c81ce41c 100644 --- a/src/turkish/CatTur.gf +++ b/src/turkish/CatTur.gf @@ -30,6 +30,7 @@ concrete CatTur of Cat = CommonX - [CAdv,AdN] ** open ResTur, HarmonyTur, Prelud Numeral = {s : CardOrd => Number => Case => Str ; n : Number} ; Digits = {s : CardOrd => Number => Case => Str ; n : Number; tail : DTail} ; + Decimal = {s : CardOrd => Number => Case => Str ; n : Number; hasDot : Bool} ; -- Adjective AP = {s : Number => Case => Str; h : Harmony} ; diff --git a/src/turkish/NounTur.gf b/src/turkish/NounTur.gf index 7aba93fe..1f23ac08 100644 --- a/src/turkish/NounTur.gf +++ b/src/turkish/NounTur.gf @@ -176,8 +176,8 @@ concrete NounTur of Noun = CatTur ** open ResTur, SuffixTur, HarmonyTur, Prelude s = n.s ! NCard ; n = n.n } ; - NumFloat n1 n2 = { - s = \\n,c => n1.s ! NCard ! Sg ! Nom ++ BIND ++ "." ++ BIND ++ n2.s ! NCard ! n ! c ; n = Pl + NumDecimal n = { + s = n.s ! NCard ; n = n.n } ; OrdNumeralSuperl n a = { diff --git a/src/turkish/NumeralTur.gf b/src/turkish/NumeralTur.gf index 710ea0c5..5f833aae 100644 --- a/src/turkish/NumeralTur.gf +++ b/src/turkish/NumeralTur.gf @@ -1,6 +1,6 @@ --# -path=.:../abstract:../common:../../prelude -concrete NumeralTur of Numeral = CatTur [Numeral,Digits] ** open Prelude, ResTur, ParadigmsTur in { +concrete NumeralTur of Numeral = CatTur [Numeral,Digits,Decimal] ** open Prelude, ResTur, ParadigmsTur in { flags coding = utf8 ; @@ -72,6 +72,21 @@ lin D_7 = mkDig "7" ; D_8 = mkDig "8" ; D_9 = mkDig "9" ; + + PosDecimal d = d ** {hasDot=False} ; + NegDecimal d = { + s = \\t,num,c => "-" ++ BIND ++ d.s ! t ! num ! c; + n = Pl; + hasDot=False + } ; + IFrac d i = { + s=\\t,num,c => d.s ! NCard ! Sg ! Nom ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ! t ! num ! c; + n = Pl ; + hasDot=True + } ; + oper commaIf : DTail -> Str = \t -> case t of { T3 => BIND++","++BIND ; diff --git a/src/urdu/NumeralUrd.gf b/src/urdu/NumeralUrd.gf index a4e6cfc0..d5126405 100644 --- a/src/urdu/NumeralUrd.gf +++ b/src/urdu/NumeralUrd.gf @@ -2,7 +2,7 @@ -- Modification for Urdu Shafqat Virk -concrete NumeralUrd of Numeral = CatUrd [Numeral,Digits] ** open ResUrd,CommonHindustani,ParamX, Prelude in { +concrete NumeralUrd of Numeral = CatUrd [Numeral,Digits,Decimal] ** open ResUrd,CommonHindustani,ParamX, Prelude in { flags coding=utf8 ; param DForm = unit | ten ; @@ -110,6 +110,19 @@ lin D_8 = { s = "۸" ; n = Pl}; lin D_9 = { s = "۹" ; n = Pl}; lin IDig d = { s = \\_ => d.s ; n = d.n} ; lin IIDig d dg = { s = \\df => Prelude.glue (dg.s ! df) d.s ; n = Pl }; +lin PosDecimal d = d ** {hasDot=False} ; +lin NegDecimal d = { + s = \\df => Prelude.glue "-" (d.s ! df) ; + n = Pl ; + hasDot=False + } ; + IFrac d i = { + s = \\df => d.s!df ++ + if_then_Str d.hasDot BIND (BIND++"."++BIND) ++ + i.s ; + n = Pl ; + hasDot=True + } ; oper ekhazar : Str = variants {"ہزار" ; "ایک" ++ "ہزار"} ; oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {singl => ekhazar ; _ => s ++ "ہزار"} ! sz ;