diff --git a/examples/numerals/MkScript.hs b/examples/numerals/MkScript.hs new file mode 100644 index 000000000..6a514d6b3 --- /dev/null +++ b/examples/numerals/MkScript.hs @@ -0,0 +1,27 @@ +module Main where + +import System + +-- to create a gfs script that builds a gfcm file. AR 29/1/2004 +-- reads old GF + +-- change these to your needs + +scriptFile = "mkNumerals.gfs" +multiFile = "numerals.gfcm" +absModule = "Numerals" +excluded = ["numerals.Abs.gf"] + +main :: IO () +main = do + system "ls >files" + s <- readFile "files" + writeFile scriptFile $ unlines $ map mkOne $ + filter (flip notElem excluded) $ lines s + appendFile scriptFile "s\n" + appendFile scriptFile $ "pm | wf " ++ multiFile + +mkOne file = "i -old -abs=" ++ absModule ++ " -cnc=" ++ lang ++ " " ++ file + where + lang = takeWhile (/= '.') file + diff --git a/examples/numerals/af_tunni.gf b/examples/numerals/af_tunni.gf new file mode 100644 index 000000000..600397690 --- /dev/null +++ b/examples/numerals/af_tunni.gf @@ -0,0 +1,50 @@ +include numerals.Abs.gf ; + +param Size = sg | pl ; +param DForm = unit | ten ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO: Encoding + +oper mkNum : Str -> Str -> LinDigit = \mbili -> \lama -> + {s = table {unit => mbili ; ten => lama }; size = pl }; + +-- lin n1 = mkNum "ków" ; +lin n2 = mkNum "lámma" "labaatón"; +lin n3 = mkNum "síddi?" "soddón" ; +lin n4 = mkNum "áfar" "afartón"; +lin n5 = mkNum "s^án" "kontón"; +lin n6 = mkNum "lí?" "lihdón"; +lin n7 = mkNum "toddóbo" "toddobátan"; +lin n8 = mkNum "siyéed" "siyyeétan" ; +lin n9 = mkNum "sagáal" "sagaás^an"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = table {f => "ków" }; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "tómon" ; +lin pot111 = ss ("tómon" ++ "i" ++ "ków") ; +lin pot1to19 d = ss ("tómon" ++ "i" ++ (d.s ! unit)) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size } ; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = ss (d.s ! ten ++ "i" ++ e.s ! unit) ; +lin pot1as2 n = n ; +lin pot2 d = ss (selsg d.size (d.s ! unit) ++ "boqól" ); +lin pot2plus d e = ss ((selsg d.size (d.s ! unit)) ++ "boqól" ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = (selsg n.size n.s) ++ "kún"} ; +lin pot3plus n m = {s = (selsg n.size n.s) ++ "kún" ++ m.s} ; + +oper selsg : Size -> Str -> Str = \sz -> \attr -> + table {pl => attr ; sg => [] } ! sz ; diff --git a/examples/numerals/albanian.gf b/examples/numerals/albanian.gf new file mode 100644 index 000000000..dfe0e9f82 --- /dev/null +++ b/examples/numerals/albanian.gf @@ -0,0 +1,45 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +param DForm = unit | teen | ten ; + +oper LinDigit = {s : DForm => Str }; +oper LinSub100 = {s : Str } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; + +oper mkNum : Str -> LinDigit = \tri -> + { s = table {unit => tri ; teen => tri + "mbë" + "dhjetë" ; ten => tri + "dhjetë" }}; + +lin num x = {s = x.s } ; + +lin n2 = {s = table {unit => "dy" ; teen => "dy" + "mbë" + "dhjetë" ; ten => "njëzet" }}; +lin n3 = mkNum "tre" ; +lin n4 = {s = table {unit => "katër" ; teen => "katër" + "mbë" + "dhjetë" ; ten => "dyzet" } }; +lin n5 = mkNum "pesë" ; +lin n6 = mkNum "gjashtë"; +lin n7 = mkNum "shtatë"; +lin n8 = mkNum "tetë"; +lin n9 = mkNum "nëntë"; + +oper mkR : Str -> LinSub100 = \n -> {s = n } ; + +lin pot01 = { s = table {_ => "një" }}; +lin pot0 d = d ; +lin pot110 = mkR "dhjetë" ; +lin pot111 = mkR ("një" + "mbë" + "dhjetë") ; +lin pot1to19 d = mkR (d.s ! teen) ; +lin pot0as1 n = mkR (n.s ! unit) ; +lin pot1 d = mkR (d.s ! ten) ; +lin pot1plus d e = mkR ((d.s ! ten) ++ "e" ++ (e.s ! unit)) ; +lin pot1as2 n = n ; +lin pot2 d = mkR (bind (d.s ! unit) "qind") ; +lin pot2plus d e = mkR ((bind (d.s ! unit) "qind") ++ "e" ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = n.s ++ "mijë" } ; +lin pot3plus n m = {s = n.s ++ "mijë" ++ m.s} ; + diff --git a/examples/numerals/amharic.gf b/examples/numerals/amharic.gf new file mode 100644 index 000000000..b02a00456 --- /dev/null +++ b/examples/numerals/amharic.gf @@ -0,0 +1,81 @@ +include numerals.Abs.gf ; + +-- 14, 15 have variants in pronounciation {asraratt, asrammIst} + +-- No long consonants marked in the indigen. script +-- s is set intersection s +-- h is set union h +-- H is three-fork h +-- x is hook-looking h +-- L is sin-looking s +-- X is h looking like k with a roof +-- ) is chair-vowel i.e historically glottal stop +-- ( is round-shape vowel sign i.e historically 3ayn +-- Z is zh +-- $ is sh +-- N is n~ +-- I is i" (6th row) +-- A is a" (1st row) +-- Capitalis for ejectives KPTCS + + +param DForm = unit | ten ; +param Size = sg | pl | tenplus ; +param S100 = indep | tenpart | tenelfu | sihpart ; + +oper LinDigit = {s : DForm => Str ; size : Size} ; +oper LinSub100 = {s : S100 => Str ; size : Size} ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> Str -> LinDigit = \hulatt -> \haya -> + {s = table {unit => hulatt ; ten => haya} ; size = pl} ; + +lin num x0 = + {s = "/E" ++ x0.s ++ "E/"} ; +lin n2 = mkNum "hulAt" (variants {"haya" ; "Haya" ; "xaya" ; "kaya" }) ; +lin n3 = mkNum "Lost" "LAlasa" ; +lin n4 = mkNum "arat" "arba" ; +lin n5 = mkNum "amIst" (variants { "amsa" ; "xamsa" }) ; +lin n6 = mkNum "sIdIst" (variants { "sIdsa" ; "sIlsa" }) ; +lin n7 = mkNum "sAbat" "sAba" ; +lin n8 = mkNum "sImInt" "sAmanya" ; +lin n9 = mkNum "zATAN" "zATAna" ; + +oper ss1 : Str -> Str -> Str -> LinSub100 = \assir -> \ten -> \unitpart -> + {s = table {indep => assir ; tenpart => ten ; tenelfu => [] ; sihpart => unitpart} ; size = tenplus } ; + +oper ss : Str -> Str -> Str -> LinSub100 = \assir -> \ten -> \unitpart -> + {s = table {indep => assir ; tenpart => ten ; tenelfu => ten ; sihpart => unitpart} ; size = tenplus } ; + +lin pot01 = + {s = table {unit => "and" ; ten => "asra" }; size = sg}; +lin pot0 d = d ; +lin pot110 = ss1 "asIr" "and" [] ; +lin pot111 = ss1 (variants {"asrand" ; "asra" ++ "and" }) "and" Sih ; +lin pot1to19 d = ss1 ("asra" ++ d.s ! unit) "and" (mkSih d.size (d.s ! unit)) ; +lin pot0as1 n = {s = table {indep => n.s ! unit ; sihpart => mkSih n.size (n.s ! unit) ; _ => [] } ; size = n.size} ; +lin pot1 d = ss (d.s ! ten) (d.s ! unit) [] ; +lin pot1plus d e = ss ((d.s ! ten) ++ (e.s ! unit)) + (d.s ! unit) + (mkSih e.size (e.s ! unit)); + +lin pot1as2 n = {s = n.s ! indep ; s2 = n.s ! tenelfu ++ "Ilef" ++ n.s ! sihpart ; size = n.size} ; + +lin pot2 d = {s = (sel d.size [] (d.s ! unit)) ++ "mAto" ; + s2 = sel d.size "asIr" (d.s ! ten) ; size = tenplus} ; +lin pot2plus d e = {s = (sel d.size [] (d.s ! unit)) ++ "mAto" ++ e.s ! indep ; s2 = d.s ! ten ++ e.s ! tenpart ++ "Ilef" ++ e.s ! sihpart ; size = tenplus} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = table {pl => n.s ++ Sih ; sg => Sih ; tenplus => n.s2 } ! n.size} ; +lin pot3plus n m = {s = table {pl => n.s ++ Sih ; sg => Sih ; tenplus => n.s2 } ! n.size ++ m.s} ; + +oper Sih : Str = variants {"$ih" ; "$i"} ; + +oper mkSih : Size -> Str -> Str = \sz -> \attr -> (sel sz [] attr) ++ Sih ; + +oper sel : Size -> Str -> Str -> Str = \sz -> \a -> \b -> table {sg => a ; _ => b} ! sz ; \ No newline at end of file diff --git a/examples/numerals/arabic_classical.gf b/examples/numerals/arabic_classical.gf new file mode 100644 index 000000000..767be53d6 --- /dev/null +++ b/examples/numerals/arabic_classical.gf @@ -0,0 +1,96 @@ +include numerals.Abs.gf ; + +-- There is uncertainty as to wthere forms like 102 000 should be +-- hundred and thousand or hundred and two thousands or +-- as implemented hundred and two thousand + +param DForm = unit Place | teen | ten | hund ; +param Size = sg | pl | dual | eleventonineteen ; +param Place = attr | indep ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Place => Str ; size : Size} ; +lincat Sub1000 = {s : Place => Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/6" ++ x0.s ++ "6/"} ; -- the Arabic0x0600 environment + +lin n2 = + {s = table {(unit attr) => [] ; + (unit indep) => "avnan" ; + teen => "avna" ; + ten => "ocrwn" ; + hund => "maOtan"} ; size = dual} ; +lin n3 = + {s = table {(unit _) => "vlavA" ; + teen => "vlavA" ; + ten => "vlavwn" ; + hund => variants {"vlav" ++ "maOA" ; "vlavmaOA"}} ; + size = pl} ; +lin n4 = + {s = table {(unit _) => "urboA" ; + teen => "urboA" ; + ten => "urbown" ; + hund => variants {"urbo" ++ "maOA" ; "urbomaOA"}} ; + size = pl} ; +lin n5 = + {s = table {(unit _) => "CmsA" ; + teen => "CmsA" ; + ten => "Cmswn" ; + hund => variants {"Cms" ++ "maOA" ; "CmsmaOA"}} ; size = pl} ; +lin n6 = + {s = table {(unit _) => "stA" ; + teen => "stA" ; + ten => "stwn" ; + hund => variants {"st" ++ "maOA" ; "stmaOA"}} ; size = pl} ; +lin n7 = + {s = table {(unit _) => "sboA" ; + teen => "sboA" ; + ten => "sbown" ; + hund => variants {"sbo" ++ "maOA" ; "sbomaOA"}} ; size = pl} ; +lin n8 = + {s = table {(unit _) => "vmanyA" ; + teen => "vmanyA" ; + ten => "vmanwn" ; + hund => variants {"vman" ++ "maOA" ; "vmanmaOA"}} ; + size = pl} ; +lin n9 = + {s = table {(unit _) => "tsoA" ; + teen => "tsoA" ; + ten => "tsown" ; + hund => variants {"tso" ++ "maOA" ; "tsomaOA"}} ; + size = pl} ; + +lin pot01 = + {s = table {hund => (variants {"maOA" ; "m0A"} ) ; (unit attr) => [] ; f => "waHd"} ; size = sg} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "ocrA"} ; size = pl} ; +lin pot111 = + {s = table {_ => "aHd" ++ "ocr"} ; size = eleventonineteen} ; +lin pot1to19 d = + {s = table {_ => d.s ! teen ++ "ocr"} ; size = eleventonineteen} ; +lin pot0as1 n = + {s = table {p => n.s ! unit p} ; size = n.size} ; +lin pot1 d = + {s = table {_ => d.s ! ten} ; size = eleventonineteen} ; +lin pot1plus d e = + {s = table {_ => e.s ! unit indep ++ "w" ++ d.s ! ten} ; size = e.size} ; +lin pot1as2 n = + {s = n.s ; size = n.size} ; +lin pot2 d = + {s = table {_ => d.s ! hund} ; size = pl} ; +lin pot2plus d e = + {s = table {_ => d.s ! hund ++ "w" ++ e.s ! indep} ; size = e.size} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = n.s ! attr ++ Alf ! n.size} ; +lin pot3plus n m = + {s = n.s ! attr ++ Alf ! n.size ++ "w" ++ m.s ! indep} ; + +oper Alf : Size => Str = + table {{pl} => "Ulaf" ; {dual} => "alfan" ; {eleventonineteen} => "alfa" ; sg => "alf"} ; + diff --git a/examples/numerals/arabic_modern.gf b/examples/numerals/arabic_modern.gf new file mode 100644 index 000000000..5c2433400 --- /dev/null +++ b/examples/numerals/arabic_modern.gf @@ -0,0 +1,88 @@ +include numerals.Abs.gf ; + +param DForm = unit Place | teen | ten | hund ; +param Size = small | large | dual ; +param Place = attr | indep ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Place => Str ; size : Size} ; +lincat Sub1000 = {s : Place => Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/-" ++ x0.s ++ "-/"} ; -- the Arabic environment + +lin n2 = + {s = table {(unit attr) => [] ; + (unit indep) => "avnyn" ; + teen => "avnj" ; + ten => "ocryn" ; + hund => "maOtyn"} ; size = dual} ; +lin n3 = + {s = table {(unit _) => "vlavA" ; + teen => "vlavA" ; + ten => "vlavyn" ; + hund => "vlavmaOA"} ; size = small} ; +lin n4 = + {s = table {(unit _) => "urboA" ; + teen => "urboA" ; + ten => "urboyn" ; + hund => "urbomaOA"} ; size = small} ; +lin n5 = + {s = table {(unit _) => "CmsA" ; + teen => "CmsA" ; + ten => "Cmsyn" ; + hund => "CmsmaOA"} ; size = small} ; +lin n6 = + {s = table {(unit _) => "stA" ; + teen => "stA" ; + ten => "styn" ; + hund => "stmaOA"} ; size = small} ; +lin n7 = + {s = table {(unit _) => "sboA" ; + teen => "sboA" ; + ten => "sboyn" ; + hund => "sbomaOA"} ; size = small} ; +lin n8 = + {s = table {(unit _) => "vmanyA" ; + teen => "vmanyA" ; + ten => "vmanyn" ; + hund => "vmanmaOA"} ; size = small} ; +lin n9 = + {s = table {(unit _) => "tsoA" ; + teen => "tsoA" ; + ten => "tsoyn" ; + hund => "tsomaOA"} ; size = small} ; + +lin pot01 = + {s = table {hund => "maOA"; (unit attr) => [] ; f => "waHd"} ; size = large} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "ocrA"} ; size = small} ; +lin pot111 = + {s = table {_ => "aHd" ++ "ocr"} ; size = large} ; +lin pot1to19 d = + {s = table {_ => d.s ! teen ++ "ocr"} ; size = large} ; +lin pot0as1 n = + {s = table {p => n.s ! unit p} ; size = n.size} ; +lin pot1 d = + {s = table {_ => d.s ! ten} ; size = large} ; +lin pot1plus d e = + {s = table {_ => e.s ! unit indep ++ "w" ++ d.s ! ten} ; size = large} ; +lin pot1as2 n = + {s = n.s ; size = n.size} ; +lin pot2 d = + {s = table {_ => d.s ! hund} ; size = large} ; +lin pot2plus d e = + {s = table {_ => d.s ! hund ++ "w" ++ e.s ! indep} ; size = large} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = n.s ! attr ++ Alf ! n.size} ; +lin pot3plus n m = + {s = n.s ! attr ++ Alf ! n.size ++ "w" ++ m.s ! indep} ; + +oper Alf : Size => Str = + table {{small} => "Ulaf" ; {dual} => "alfyn" ; _ => "alf"} ; + diff --git a/examples/numerals/basque.gf b/examples/numerals/basque.gf new file mode 100644 index 000000000..ba77d9219 --- /dev/null +++ b/examples/numerals/basque.gf @@ -0,0 +1,59 @@ +include numerals.Abs.gf ; + +oper LinDigit = {s : DForm => Str ; even20 : Even20 ; size : Size} ; + +oper mk20Ten : Str -> Str -> Str -> Str -> LinDigit = + \tri -> \t -> \fiche -> \h -> + { s = table {unit => tri ; teen => t ; twenty => fiche ; hund => h + "ehun"} ; even20 = ten ; size = pl} ; + +oper mkEven20 : Str -> Str -> Str -> Str -> LinDigit = + \se -> \t -> \trifichid -> \h -> + { s = table {unit => se ; teen => t ; twenty => trifichid ; hund => h + "ehun"} ; even20 = even ; size = pl} ; + +param Even20 = ten | even ; +param DForm = unit | teen | twenty | hund ; +param Size = sg | pl ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = mkEven20 "bi" "hamabi" "hogei" "berr" ; +lin n3 = mk20Ten "hiru" (variants {"hamahiru" ; "hamahirur"}) "hogei" "hirur"; +lin n4 = mkEven20 "lau" (variants {"hamalau" ; "hamalaur"}) "berrogei" "laur"; +lin n5 = mk20Ten "bost" (variants {"hamabost" ; "hamabortz"}) "berrogei" "bost"; +lin n6 = mkEven20 "sei" "hamasei" "hirurogei" "seir" ; +lin n7 = mk20Ten "zazpi" "hamazazpi" "hirurogei" "zazpi" ; +lin n8 = mkEven20 "zortzi" "hemezortzi" "laurogei" "zortzi" ; +lin n9 = mk20Ten "bederatzi" "hemeretzi" "laurogei" "bederatzi" ; + +lin pot01 = + {s = table {unit => "bat" ; hund => "ehun" ; _ => "dummy"} ; even20 = ten ; size = sg}; +lin pot0 d = {s = d.s ; even20 = d.even20 ; size = d.size} ; +lin pot110 = {s = "hamar" ; size = pl} ; +lin pot111 = {s = variants {"hamaika" ; "hameka"} ; size = pl} ; +lin pot1to19 d = {s = d.s ! teen ; size = pl} ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = + {s = table {even => d.s ! twenty ; + ten => d.s ! twenty ++ "tahamar"} ! d.even20 ; -- glue + size = pl} ; +lin pot1plus d e = + {s = table {even => d.s ! twenty ++ "ta" ++ e.s ! unit; + ten => d.s ! twenty ++ "ta" ++ e.s ! teen} ! (d.even20) ; + size = pl} ; + +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hund ; size = pl} ; +lin pot2plus d e = + {s = variants {d.s ! hund ++ e.s ; d.s ! hund ++ "ta" ++ e.s} ; size = pl} ; +lin pot2as3 n = + {s = n.s } ; +lin pot3 n = + {s = table {sg => [] ; pl => n.s } ! n.size ++ "mila"} ; +lin pot3plus n m = + {s = table {sg => [] ; pl => n.s } ! n.size ++ "mila" ++ "ta" ++ m.s } ; diff --git a/examples/numerals/bearlake_slave.gf b/examples/numerals/bearlake_slave.gf new file mode 100644 index 000000000..32329bcf8 --- /dev/null +++ b/examples/numerals/bearlake_slave.gf @@ -0,0 +1,44 @@ +include numerals.Abs.gf ; + +param DForm = unit | hundred ; + +oper LinDigit = {s : Str } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; + +oper mkNum : Str -> LinDigit = \two -> + {s = two } ; + +-- TODO: Transl. + +lin num x = x ; +-- lin n1 mkNum "l-ée" ; +lin n2 = mkNum "nákee" ; +lin n3 = mkNum "tai" ; +lin n4 = mkNum "di,i," ; +lin n5 = mkNum "so,lái" ; +lin n6 = mkNum "?ehts'é,tai" ; +lin n7 = mkNum "l-á,hdi,i," ; +lin n8 = mkNum "?ehts'é,di,i," ; +lin n9 = mkNum "l-óto," ; + +oper o : Str = "?ó," ; + +lin pot01 = {s = "l-ée" } ; +lin pot0 d = d ; +lin pot110 = {s = variants {"honéno," ; "hóno" }} ; +lin pot111 = {s = variants {"honéno," ; "hóno" } ++ o ++ "l-ée" } ; +lin pot1to19 d = {s = (variants {"honéno," ; "hóno" }) ++ o ++ d.s } ; +lin pot0as1 n = n ; +lin pot1 d = {s = d.s ++ (variants {"honéno," ; "óno,"})} ; +lin pot1plus d e = {s = d.s ++ (variants {"honéno," ; "óno,"}) ++ o ++ e.s } ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ++ "lak'o, óno,"} ; +lin pot2plus d e = {s = d.s ++ "lak'o, óno," ++ e.s} ; +lin pot2as3 n = n ; +lin pot3 n = {s = n.s ++ "lamíl"} ; +lin pot3plus n m = {s = n.s ++ "lamíl" ++ m.s } ; + diff --git a/examples/numerals/bulgarian.gf b/examples/numerals/bulgarian.gf new file mode 100644 index 000000000..fd330152f --- /dev/null +++ b/examples/numerals/bulgarian.gf @@ -0,0 +1,51 @@ +-- ä is ya +-- q is [ch] +-- w for [sh] +-- j for i kratkoe i.e i with a thing + +include numerals.Abs.gf ; + +param Size = sg | below10 | tenover ; +param DForm = unit | teen | ten | hundred ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; size : Size } ; +lincat Sub1000 = {s : Str ; size : Size } ; + +oper mkNum : Str -> Str -> Str -> LinDigit = \tri -> \trijset -> \trista -> + { s = table {unit => tri ; teen => variants {tri + "nadeset" ; tri + "najset" }; ten => trijset ; hund => trista} ; size = below10}; + +lin num x = {s = "/_" ++ x.s ++ "_/"} ; -- the (Russian) Cyrillic ad-hoc translation + +lin n2 = {s = table {unit => "dve" ; teen => variants {"dvanadeset" ; "dvanajset"}; ten => "dvajset" ; hund => "dvesta" } ; size = below10 } ; +lin n3 = mkNum "tri" (variants {"trijset"; "trideset"}) "trista" ; +lin n4 = mkNum "qetiri" (variants {"qetiriset" ; "qetirijset" ; "qetirideset"}) "qetiristotin" ; +lin n5 = mkNum "pet" "petdeset" "petstotin" ; +lin n6 = mkNum "west" (variants {"westdeset" ; "wejset"}) "weststotin" ; +lin n7 = mkNum "sedem" "sedemdeset" "sedemstotin" ; +lin n8 = mkNum "osem" "osemdeset" "osemstotin" ; +lin n9 = mkNum "devet" "devetdeset" "devetstotin" ; + +lin pot01 = { s = table {unit => "edno" ; hundred => "sot" ; _ => "dummy" } ; size = sg }; +lin pot0 d = d ; +lin pot110 = {s = "deset" ; size = below10}; +lin pot111 = {s = variants {"edinadeset" ; "edinajset" }; size = tenover}; +lin pot1to19 d = {s = d.s ! teen ; size = tenover}; +lin pot0as1 n = {s = n.s ! unit ; size = n.size } ; +lin pot1 d = {s = d.s ! ten ; size = tenover} ; +lin pot1plus d e = {s = d.s ! ten ++ "i" ++ e.s ! unit ; size = tenover} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hundred ; size = tenover} ; +lin pot2plus d e = { s = d.s ! hundred ++ maybei e.size ++ e.s ; size = tenover } ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = mkThou n.size n.s} ; +lin pot3plus n m = {s = mkThou n.size n.s ++ m.s} ; + +oper mkThou : Size -> Str -> Str = \sz -> \attr -> + table {sg => "xiläda" ; _ => attr ++ "xilädi" } ! sz ; + +oper maybei : Size -> Str = \sz -> table {tenover => [] ; _ => "i"} ! sz ; + diff --git a/examples/numerals/catalan.gf b/examples/numerals/catalan.gf new file mode 100644 index 000000000..b1396c6b3 --- /dev/null +++ b/examples/numerals/catalan.gf @@ -0,0 +1,56 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \s1 -> \s2 -> s1 ++ s2 ; + +param DForm = unit | teen | ten | hundred | vint ; +param Size = sg | two | pl ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size } ; +lincat Sub10 = {s : DForm => Str ; size : Size } ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> Str -> Str -> Lin Digit = + \dois -> \doze -> \vinte -> + {s = table {unit => dois ; teen => doze ; ten => vinte ; hundred => dois + "-" + "cents" ; vint => "vint-i-" + dois } ; size = pl} ; + +lin num x0 = + {s = x0.s} ; + +lin n2 = {s = table {unit => "dos" ; teen => "dotze" ; ten => "vint" ; hundred => "dos-cents" ; vint => "vint-i-" + "dos" } ; size = two } ; +lin n3 = mkNum "tres" "tretze" "trenta" ; +lin n4 = mkNum "quatre" "catorze" "quaranta" ; +lin n5 = mkNum "cinc" "quinze" "cinqanta" ; +lin n6 = mkNum "sis" "setze" "seixanta" ; +lin n7 = mkNum "set" "disset" "setanta" ; +lin n8 = mkNum "vuit" "divuit" "vuitanta" ; +lin n9 = mkNum "nou" "dinou" "noranta" ; + +lin pot01 = {s = table {unit => "u" ; hundred => "cent" ; vint => "vint-i-" + "u" ; _ => "dummy"} ; size = sg} ; +lin pot0 d = d ; +lin pot110 = + {s = "deu" ; size = pl} ; +lin pot111 = + {s = "onze" ; size = pl} ; +lin pot1to19 d = + {s = d.s ! teen ; size = pl} ; +lin pot0as1 n = + {s = n.s ! unit ; size = n.size } ; +lin pot1 d = + {s = d.s ! ten ; size = pl} ; +lin pot1plus d e = + {s = table {two => e.s ! vint ; _ => bind (bind (d.s ! ten) "-") (e.s ! unit) } ! d.size ; size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = + {s = d.s ! hundred ; size = pl} ; +lin pot2plus d e = + {s = d.s ! hundred ++ e.s ; size = pl} ; +lin pot2as3 n = + {s = n.s } ; +lin pot3 n = + {s = table {sg => "mil" ; _ => n.s ++ "mil"} ! n.size} ; +lin pot3plus n m = + {s = table {sg => "mil" ; _ => n.s ++ "mil"} ! n.size ++ m.s } ; + diff --git a/examples/numerals/chinese.gf b/examples/numerals/chinese.gf new file mode 100644 index 000000000..93d7395b3 --- /dev/null +++ b/examples/numerals/chinese.gf @@ -0,0 +1,112 @@ +include numerals.Abs.gf ; + +flags coding=utf8 ; + +param Qform = bai | bai0 | shiwan | shiwan0 ; +param Bform = shi | shi0 | wan | wan0 ; +param Zero = zero | nozero ; +oper ling : Zero * Zero => Str = + table {<{zero},z> => "é›¶" ; + => "é›¶" ; + <{nozero},{nozero}> => []} ; +oper Wan : Zero => Str = + table {{zero} => "万" ; + {nozero} => []} ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : Str} ; +lincat Sub10 = {s : Str} ; +lincat Sub100 = {inh : Zero ; s : Bform => Str} ; +lincat Sub1000 = {inh : Zero ; s : Qform => Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = "è´°"} ; +lin n3 = + {s = "å"} ; +lin n4 = + {s = "肆"} ; +lin n5 = + {s = "ä¼"} ; +lin n6 = + {s = "陆"} ; +lin n7 = + {s = "柒"} ; +lin n8 = + {s = "æŒ"} ; +lin n9 = + {s = "玖"} ; +lin pot01 = + {s = "壹"} ; +lin pot0 d = + {s = d.s} ; +lin pot110 = + {inh = nozero ; + s = table { + {shi} => "壹拾" ; + {shi0} => "壹拾" ; + {wan} => "壹万" ; + {wan0} => "壹万"}} ; +lin pot111 = + {inh = nozero ; + s = table { + {shi} => "拾壹" ; + {shi0} => "壹拾壹" ; + {wan} => "拾壹万" ; + {wan0} => "拾壹万"}} ; +lin pot1to19 d = + {inh = nozero ; + s = table { + {shi} => "壹拾" ++ d.s ; + {shi0} => "壹拾" ; + {wan} => "壹万" ++ d.s ++ "仟" ; + {wan0} => "壹万" ++ d.s ++ "仟"}} ; +lin pot0as1 n = + {inh = zero ; + s = table { + {shi} => n.s ; + {shi0} => n.s ; + {wan} => n.s ++ "仟" ; + {wan0} => n.s ++ "仟"}} ; +lin pot1 d = + {inh = zero ; + s = table { + {shi} => d.s ++ "拾" ; + {shi0} => d.s ++ "拾" ; + {wan0} => d.s ++ "万" ; + {wan} => d.s ++ "万"}} ; +lin pot1plus d e = + {inh = nozero ; + s = table { + {shi} => d.s ++ "拾" ++ e.s ; + {shi0} => d.s ++ "拾" ++ e.s ; + {wan} => d.s ++ "万" ++ e.s ++ "仟" ; + {wan0} => d.s ++ "万" ++ e.s ++ "仟"}} ; +lin pot1as2 n = + {inh = zero ; + s = table { + {bai} => n.s ! shi ; + {bai0} => n.s ! shi ; + {shiwan} => n.s ! wan ; + {shiwan0} => n.s ! wan0}} ; +lin pot2 d = + {inh = zero ; + s = table { + {bai} => d.s ++ "ä½°" ; + {bai0} => d.s ++ "ä½°" ; + {shiwan0} => d.s ++ "拾万" ; + {shiwan} => d.s ++ "拾万"}} ; +lin pot2plus d e = + {inh = nozero ; + s = table { + {bai} => d.s ++ "ä½°" ++ (ling ! ) ++ e.s ! shi0 ; + {bai0} => d.s ++ "ä½°" ++ (ling ! ) ++ e.s ! shi0 ; + {shiwan} => d.s ++ "拾" ++ (Wan ! (e.inh)) ++ e.s ! wan ; + {shiwan0} => d.s ++ "拾" ++ (Wan ! (e.inh)) ++ e.s ! wan0}} ; +lin pot2as3 n = + {s = n.s ! bai} ; +lin pot3 n = + {s = n.s ! shiwan} ; +lin pot3plus n m = + {s = (n.s ! shiwan0) ++ (ling ! ) ++ m.s ! bai0} ; + diff --git a/examples/numerals/croatian.gf b/examples/numerals/croatian.gf new file mode 100644 index 000000000..501c81dcc --- /dev/null +++ b/examples/numerals/croatian.gf @@ -0,0 +1,69 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten | hund ; + +-- [c^], [s^], [c'] + + +param ThForm = onlyone | lastone | twoorthreeorfour | fiveup ; + +oper LinDigit = {s : DForm => Str; o : ThForm ; t : ThForm } ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str; o : ThForm ; t : ThForm } ; +lincat Sub100 = {s : Str; t : ThForm } ; +lincat Sub1000 = {s : Str; t : ThForm } ; + +oper mkNum : Str -> Str -> Str -> Str -> ThForm -> LinDigit = + \dwa -> \dwanascie -> \dwadziescia -> \dwiescie -> \thform -> + { s = table {unit => dwa ; teen => dwanascie ; ten => dwadziescia ; hund => +dwiescie }; + o = thform ; t = thform + }; + +oper mkRegNum : Str -> LinDigit = + \sedam -> + { s = table { unit => sedam ; teen => sedam + "naest" ; + ten => sedam + "deset" ; hund => sedam ++ "stotina" + }; + o = fiveup ; t = fiveup + }; + +oper mkTh : Str -> ThForm => Str = \attr -> + table { onlyone => variants {"hiljada" ; "tisuc'a"} ; lastone => attr ++ "hiljada" ; + twoorthreeorfour => attr ++ "hiljade" ; fiveup => attr ++ "hiljada" + }; + +oper ss : Str -> ThForm -> {s : Str ; t : ThForm} = \str -> \th -> {s = str; t = th} ; + +lin num x = {s = "/L" ++ x.s ++ "L/"} ; -- Latin A Supplement environment + +lin n2 = mkNum "dva" "dvanaest" "dvadeset" (variants { "dve" ++ "stotine" ; "dvesta" } ) twoorthreeorfour ; +lin n3 = mkNum "tri" "trinaest" "trideset" (variants { "tri" ++ "stotine" ; "trista" } ) twoorthreeorfour ; +lin n4 = mkNum "c^etiri" "c^etrnaest" "c^etrdeset" ("c^etiri" ++ "stotine") twoorthreeorfour ; +lin n5 = mkNum "pet" "petnaest" "pedeset" ("pet" ++ "stotina") fiveup ; +lin n6 = mkNum "s^est" "s^esnaest" "s^ezdeset" ("s^est" ++ "stotina") fiveup ; +lin n7 = mkRegNum "sedam" ; +lin n8 = mkRegNum "osam" ; +lin n9 = mkNum "devet" "devetnaest" "devedeset" ("devet" ++ "stotina") fiveup; + +lin pot01 = { s = table {hund => variants {"sto" ; "stotina" }; f => "jedan" }; + o = onlyone ; t = lastone + }; +lin pot0 d = {s = table {f => d.s ! f} ; o = d.o ; t = d.t} ; +lin pot110 = ss "deset" fiveup ; +lin pot111 = ss "jedanaest" fiveup ; +lin pot1to19 d = {s = d.s ! teen ; t = fiveup} ; +lin pot0as1 n = {s = n.s ! unit ; t = n.o} ; +lin pot1 d = {s = d.s ! ten ; t = fiveup} ; +lin pot1plus d e = {s = d.s ! ten ++ "i" ++ e.s ! unit; t = e.t} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hund ; t = fiveup} ; +lin pot2plus d e = { s = d.s ! hund ++ e.s ; + t = table { onlyone => lastone ; f => f } ! e.t + } ; + +lin pot2as3 n = n ; +lin pot3 n = {s = (mkTh n.s) ! n.t} ; +lin pot3plus n m = {s = (mkTh n.s) ! n.t ++ m.s} ; + + diff --git a/examples/numerals/czech.gf b/examples/numerals/czech.gf new file mode 100644 index 000000000..880bd25d5 --- /dev/null +++ b/examples/numerals/czech.gf @@ -0,0 +1,58 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \s1 -> \s2 -> s1 ++ s2 ; + +-- [c^], [s^], [r^], [e^] + +param Size = sg | twothreefour | fiveup ; +param DForm = unit | teen | ten | hundred ; + +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str; size : Size } ; +lincat Sub1000 = {s : Str; size : Size } ; + +oper mkNum : Str -> Str -> Str -> Str -> Size -> Lin Digit = + \dva -> \dvanast -> \dvadsat -> \dveste -> \sz -> + { s = table {unit => dva ; teen => dvanast + "náct" ; ten => dvadsat ; hundred => dveste } ; size = sz }; + +oper mk2Num : Str -> Str -> Str -> Str -> Lin Digit = \unit -> \teenbase -> \tenbase -> \hundred -> + mkNum unit teenbase (tenbase + "cet") hundred twothreefour ; + +oper mk5Num : Str -> Str -> Str -> Lin Digit = \unit -> \teenbase -> \tenbase -> + mkNum unit teenbase (tenbase + "desát") (unit ++ "set") fiveup ; + +lin num x = {s = "/L" ++ x.s ++ "L/" } ; -- Latin A supplement encoding + +lin n2 = mk2Num "dva" "dva" "dva" ("dve^" ++ "ste^") ; +lin n3 = mk2Num "tr^i" "tr^i" "tr^i" ("tr^i" ++ "sta") ; +lin n4 = mk2Num "c^tyr^i" "c^tr" "c^tyr^i" ("c^tyr^i" ++ "sta") ; +lin n5 = mk5Num "pe^t" "pat" "pa" ; +lin n6 = mk5Num "s^est" "s^est" "s^e" ; +lin n7 = mk5Num "sedm" "sedm" "sedm"; +lin n8 = mk5Num "osm" "osm" "osm"; +lin n9 = mk5Num "deve^t" "devate" "deva" ; + +lin pot01 = {s = table {unit => "jeden" ; hundred => "sto" ; _ => "dummy" } ; + size = sg } ; +lin pot0 d = d ; +lin pot110 = {s = "deset" ; size = fiveup } ; +lin pot111 = {s = "jedenáct" ; size = fiveup }; +lin pot1to19 d = {s = d.s ! teen ; size = fiveup} ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; size = fiveup} ; +lin pot1plus d e = {s = variants { d.s ! ten ++ e.s ! unit ; bind (bind (e.s ! unit) "a") (d.s ! ten)} ; size = tfSize e.size} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hundred ; size = fiveup} ; +lin pot2plus d e = {s = d.s ! hundred ++ e.s ; size = tfSize e.size} ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = (mkTh n.s) ! n.size} ; +lin pot3plus n m = {s = (mkTh n.s) ! n.size ++ m.s} ; + +oper tfSize : Size -> Size = \sz -> + table {sg => fiveup ; other => other} ! sz ; + +oper mkTh : Str -> Size => Str = \attr -> + table {sg => "tisíc" ; + twothreefour => attr ++ "tisíce" ; + fiveup => attr ++ "tisíc" } ; diff --git a/examples/numerals/dagur.gf b/examples/numerals/dagur.gf new file mode 100644 index 000000000..80cfdf45b --- /dev/null +++ b/examples/numerals/dagur.gf @@ -0,0 +1,59 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten ; +param Size = sg | pl | tenplus ; +param S100 = indep | tenpart | tenelfu | sihpart ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +oper LinSub100 = {s : S100 => Str ; size : Size} ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> Str -> LinDigit = \hulatt -> \haya -> + {s = table {unit => hulatt ; ten => haya} ; size = pl} ; + +lin num x0 = + {s = x0.s } ; +lin n2 = mkNum "hoire" "hori" ; +lin n3 = mkNum "guarebe" "goci" ; +lin n4 = mkNum "durube" "duci" ; +lin n5 = mkNum "taau" "tabi" ; +lin n6 = mkNum "jireuoo" "jari" ; +lin n7 = mkNum "doloo" "dale" ; +lin n8 = mkNum "naime" "nai" ; +lin n9 = mkNum "ise" "ire" ; + +oper ss1 : Str -> Str -> Str -> LinSub100 = \assir -> \ten -> \unitpart -> + {s = table {indep => assir ; tenpart => ten ; tenelfu => [] ; sihpart => unitpart} ; size = tenplus } ; + +oper ss : Str -> Str -> Str -> LinSub100 = \assir -> \ten -> \unitpart -> + {s = table {indep => assir ; tenpart => ten ; tenelfu => ten ; sihpart => unitpart} ; size = tenplus } ; + +lin pot01 = + {s = table {unit => "neke" ; ten => "harebe" }; size = sg}; +lin pot0 d = d ; +lin pot110 = ss1 "harebe" "neke" [] ; +lin pot111 = ss1 ("hareben" ++ "neke") "neke" "miange" ; +lin pot1to19 d = ss1 ("hareben" ++ d.s ! unit) "neke" (mkmiange d.size (d.s ! unit)) ; +lin pot0as1 n = {s = table {indep => n.s ! unit ; sihpart => mkmiange n.size (n.s ! unit) ; _ => [] } ; size = n.size} ; +lin pot1 d = ss (d.s ! ten) (d.s ! unit) [] ; +lin pot1plus d e = ss ((d.s ! ten) ++ (e.s ! unit)) + (d.s ! unit) + (mkmiange e.size (e.s ! unit)); + +lin pot1as2 n = {s = n.s ! indep ; s2 = n.s ! tenelfu ++ "tume" ++ n.s ! sihpart ; size = n.size} ; + +lin pot2 d = {s = (sel d.size [] (d.s ! unit)) ++ "jau" ; + s2 = sel d.size "harebe" (d.s ! ten) ; size = tenplus} ; +lin pot2plus d e = {s = (sel d.size [] (d.s ! unit)) ++ "jau" ++ e.s ! indep ; s2 = d.s ! ten ++ e.s ! tenpart ++ "tume" ++ e.s ! sihpart ; size = tenplus} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = table {pl => n.s ++ "miange" ; sg => "miange" ; tenplus => n.s2 } ! n.size} ; +lin pot3plus n m = {s = table {pl => n.s ++ "miange" ; sg => "miange" ; tenplus => n.s2 } ! n.size ++ m.s} ; + +oper mkmiange : Size -> Str -> Str = \sz -> \attr -> (sel sz [] attr) ++ "miange" ; + +oper sel : Size -> Str -> Str -> Str = \sz -> \a -> \b -> table {sg => a ; _ => b} ! sz ; \ No newline at end of file diff --git a/examples/numerals/danish.gf b/examples/numerals/danish.gf new file mode 100644 index 000000000..d1f97525f --- /dev/null +++ b/examples/numerals/danish.gf @@ -0,0 +1,44 @@ +include numerals.Abs.gf ; + +-- AR 12/10/2002 following www.geocities.com/tsca.geo/dansk/dknummer.html + +param DForm = ental | ton | tiotal ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm => Str} ; +lincat Sub100 = {s : Str} ; +lincat Sub1000 = {s : Str} ; +lincat Sub1000000 = {s : Str} ; + +oper mkTal : Str -> Str -> Str -> Lin Digit = + \to, tolv, tyve -> + {s = table {ental => to ; ton => tolv ; tiotal => tyve}} ; +oper regTal : Str -> Lin Digit = \fem -> mkTal fem (fem + "ton") (fem + "tio") ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; + +lin n2 = mkTal "to" "tolv" "tyve" ; +lin n3 = mkTal "tre" "tretten" "tredive" ; +lin n4 = mkTal "fire" "fjorten" "fyrre" ; +lin n5 = mkTal "fem" "femten" "halvtreds" ; +lin n6 = mkTal "seks" "seksten" "tres" ; +lin n7 = mkTal "syv" "sytten" "halvfjerds" ; +lin n8 = mkTal "otte" "atten" "firs" ; +lin n9 = mkTal "ni" "nitten" "halvfems" ; + +lin pot01 = {s = table {f => "en"}} ; --- +lin pot0 d = {s = table {f => d.s ! f}} ; +lin pot110 = ss "ti" ; +lin pot111 = ss "elleve" ; +lin pot1to19 d = ss (d.s ! ton) ; +lin pot0as1 n = ss (n.s ! ental) ; +lin pot1 d = ss (d.s ! tiotal) ; +lin pot1plus d e = ss (e.s ! ental ++ "og" ++ d.s ! tiotal) ; +lin pot1as2 n = n ; +lin pot2 d = ss (d.s ! ental ++ "hundrede") ; +lin pot2plus d e = ss (d.s ! ental ++ "hundrede" ++ "og" ++ e.s) ; +lin pot2as3 n = n ; +lin pot3 n = ss (n.s ++ "tusind") ; +lin pot3plus n m = ss (n.s ++ "tusind" ++ "og" ++ m.s) ; --- diff --git a/examples/numerals/decimal.gf b/examples/numerals/decimal.gf new file mode 100644 index 000000000..c27485373 --- /dev/null +++ b/examples/numerals/decimal.gf @@ -0,0 +1,43 @@ +include numerals.Abs.gf ; + +flags lexer=chars ; unlexer=concat ; + +param Zeros = noz | zz ; + +lincat Sub100 = {s : Zeros => Str} ; +lincat Sub1000 = {s : Zeros => Str} ; +lincat Sub1000000 = {s : Zeros => Str} ; + +oper ss : Str -> {s : Str} = \s -> {s = s} ; +oper mkz : Str -> {s : Zeros => Str} = \s -> {s = table {_ => s}} ; + +lin num n = {s = n.s ! noz} ; +lin n2 = ss "2" ; +lin n3 = ss "3" ; +lin n4 = ss "4" ; +lin n5 = ss "5" ; +lin n6 = ss "6" ; +lin n7 = ss "7" ; +lin n8 = ss "8" ; +lin n9 = ss "9" ; + +lin pot01 = ss "1" ; +lin pot0 d = d ; + +lin pot110 = mkz ("1" ++ "0") ; +lin pot111 = mkz ("1" ++ "1") ; +lin pot1to19 d = mkz ("1" ++ d.s) ; + +lin pot0as1 n = {s = table {noz => n.s ; zz => "0" ++ n.s}} ; + +lin pot1 d = mkz (d.s ++ "0") ; +lin pot1plus d e = mkz (d.s ++ e.s) ; + +lin pot1as2 n = {s = table {noz => n.s ! noz ; zz => "0" ++ n.s ! zz}} ; +lin pot2 d = mkz (d.s ++ "0" ++ "0") ; +lin pot2plus d e = mkz (d.s ++ e.s ! zz) ; + +lin pot2as3 n = {s = table {noz => n.s ! noz ; zz => "0" ++ n.s ! zz}} ; + +lin pot3 n = mkz (n.s ! noz ++ "0" ++ "0" ++ "0") ; +lin pot3plus n m = {s = table {z => n.s ! z ++ m.s ! zz}} ; diff --git a/examples/numerals/dutch.gf b/examples/numerals/dutch.gf new file mode 100644 index 000000000..69f101f04 --- /dev/null +++ b/examples/numerals/dutch.gf @@ -0,0 +1,48 @@ +-- Koen Claessen from Deu, 11/1/2001. + +include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; +param Place = indep | prae | attr ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm * Place => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; + +oper mkGetal : Str -> Str -> Str -> Lin Digit = + \två -> \tolv -> \tjugo -> + {s = table {unit => två ; teen => tolv ; ten => tjugo}} ; +oper regGetal : Str -> Lin Digit = + \vier -> mkGetal vier (vier + "tien") (vier + "tig") ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; + +lin n2 = mkGetal "twee" "twaalf" "twintig" ; +lin n3 = mkGetal "drie" "dertien" "dertig" ; +lin n4 = mkGetal "vier" "veertien" "veertig"; +lin n5 = regGetal "vijf" ; +lin n6 = regGetal "zes" ; +lin n7 = regGetal "zeven" ; +lin n8 = mkGetal "acht" "achttien" "tachtig"; +lin n9 = regGetal "negen" ; + +lin pot01 = {s = table { => "een" ; => "een" ; => []}} ; +lin pot0 d = {s = table { => d.s ! f}} ; +lin pot110 = {s = table {p => "tien"}} ; +lin pot111 = {s = table {p => "elf"}} ; +lin pot1to19 d = {s = table {p => d.s ! teen}} ; +lin pot0as1 n = {s = table {p => n.s ! }} ; +lin pot1 d = {s = table {p => d.s ! ten}} ; +lin pot1plus d e = {s = table {p => e.s ! ++ "en" ++ d.s ! ten}} ; +lin pot1as2 n = {s = table {p => n.s ! p}} ; +lin pot2 d = {s = table {p => d.s ! ++ "honderd"}} ; +lin pot2plus d e = {s = table { + _ => d.s ! ++ "honderd" ++ e.s ! indep}} ; +lin pot2as3 n = ss (n.s ! indep) ; +lin pot3 n = ss (n.s ! attr ++ "duizend") ; +lin pot3plus n m = ss (n.s ! attr ++ "duizend" ++ m.s ! prae) ; + diff --git a/examples/numerals/english.gf b/examples/numerals/english.gf new file mode 100644 index 000000000..d4aa3e3de --- /dev/null +++ b/examples/numerals/english.gf @@ -0,0 +1,39 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; + +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm => Str} ; + +oper mkNum : Str -> Str -> Str -> Lin Digit = + \two -> \twelve -> \twenty -> + {s = table {unit => two ; teen => twelve ; ten => twenty}} ; +oper regNum : Str -> Lin Digit = + \six -> mkNum six (six + "teen") (six + "ty") ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; +lin n2 = mkNum "two" "twelve" "twenty" ; +lin n3 = mkNum "three" "thirteen" "thirty" ; +lin n4 = mkNum "four" "fourteen" "forty" ; +lin n5 = mkNum "five" "fifteen" "fifty" ; +lin n6 = regNum "six" ; +lin n7 = regNum "seven" ; +lin n8 = mkNum "eight" "eighteen" "eighty" ; +lin n9 = regNum "nine" ; + +lin pot01 = {s = table {f => "one"}} ; +lin pot0 d = {s = table {f => d.s ! f}} ; +lin pot110 = ss "ten" ; +lin pot111 = ss "eleven" ; +lin pot1to19 d = {s = d.s ! teen} ; +lin pot0as1 n = {s = n.s ! unit} ; +lin pot1 d = {s = d.s ! ten} ; +lin pot1plus d e = {s = d.s ! ten ++ "-" ++ e.s ! unit} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! unit ++ "hundred"} ; +lin pot2plus d e = {s = d.s ! unit ++ "hundred" ++ "and" ++ e.s} ; +lin pot2as3 n = n ; +lin pot3 n = {s = n.s ++ "thousand"} ; +lin pot3plus n m = {s = n.s ++ "thousand" ++ m.s} ; + diff --git a/examples/numerals/finnish.gf b/examples/numerals/finnish.gf new file mode 100644 index 000000000..6cb789ff2 --- /dev/null +++ b/examples/numerals/finnish.gf @@ -0,0 +1,60 @@ +include numerals.Abs.gf ; + +param Place = attr | indep ; +param Nm = sg | pl ; +oper sata : Nm => Str = + table {{sg} => "sata" ; {pl} => "sataa"} ; +oper tuhat : Nm => Str = + table {{sg} => "tuhat" ; {pl} => "tuhatta"} ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : Str} ; +lincat Sub10 = {inh : Nm ; s : Place => Str} ; +lincat Sub100 = {inh : Nm ; s : Place => Str} ; +lincat Sub1000 = {inh : Nm ; s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = "kaksi"} ; +lin n3 = + {s = "kolme"} ; +lin n4 = + {s = "neljä"} ; +lin n5 = + {s = "viisi"} ; +lin n6 = + {s = "kuusi"} ; +lin n7 = + {s = "seitsemän"} ; +lin n8 = + {s = "kahdeksan"} ; +lin n9 = + {s = "yhdeksän"} ; +lin pot01 = + {inh = sg ; s = table {{attr} => [] ; {indep} => "yksi"}} ; +lin pot0 d = + {inh = pl ; s = table {p => d.s}} ; +lin pot110 = + {inh = pl ; s = table {p => "kymmenen"}} ; +lin pot111 = + {inh = pl ; s = table {p => "yksi"++"toista"}} ; +lin pot1to19 d = + {inh = pl ; s = table {p => d.s ++ "toista"}} ; +lin pot0as1 n = + {inh = n.inh ; s = table {p => n.s ! p}} ; +lin pot1 d = + {inh = pl ; s = table {p => d.s ++ "kymmentä"}} ; +lin pot1plus d e = + {inh = pl ; s = table {p => d.s ++ "kymmentä" ++ e.s ! indep}} ; +lin pot1as2 n = + {inh = n.inh ; s = table {p => n.s ! p}} ; +lin pot2 d = + {inh = pl ; s = table {p => (d.s ! attr) ++ sata ! (d.inh)}} ; +lin pot2plus d e = + {inh = pl ; s = table {p => (d.s ! attr) ++ (sata ! (d.inh)) ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = (n.s ! attr) ++ tuhat ! (n.inh)} ; +lin pot3plus n m = + {s = (n.s ! attr) ++ (tuhat ! (n.inh)) ++ m.s ! indep} ; diff --git a/examples/numerals/french.gf b/examples/numerals/french.gf new file mode 100644 index 000000000..532a4598d --- /dev/null +++ b/examples/numerals/french.gf @@ -0,0 +1,60 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | jten | ten | tenplus ; +param Nm = sg | pl ; +param Place = indep | attr ; + + +lincat Numeral = {s : Str} ; +lincat Digit = {inh : DForm ; inh1 : Nm ; s : DForm => Str} ; +lincat Sub10 = {inh : Nm ; s : {p1 : DForm ; p2 : Place} => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; + +lin num x0 = + {s = x0.s} ; +lin n2 = + {inh = unit ; inh1 = sg ; s = table {unit => "deux" ; teen => "douze" ; jten => "vingt" ; ten => "vingt" ; tenplus => "vingt"}} ; +lin n3 = + {inh = unit ; inh1 = sg ; s = table {unit => "trois" ; teen => "treize" ; jten => "trente" ; ten => "trente" ; tenplus => "trente"}} ; +lin n4 = + {inh = unit ; inh1 = sg ; s = table {unit => "quatre" ; teen => "quatorze" ; jten => "quarante" ; ten => "quarante" ; tenplus => "quarante"}} ; +lin n5 = + {inh = unit ; inh1 = sg ; s = table {unit => "cinq" ; teen => "quinze" ; jten => "cinquante" ; ten => "cinquante" ; tenplus => "cinquante"}} ; +lin n6 = + {inh = unit ; inh1 = sg ; s = table {unit => "six" ; teen => "seize" ; jten => "soixante" ; ten => "soixante" ; tenplus => "soixante"}} ; +lin n7 = + {inh = teen ; inh1 = sg ; s = table {unit => "sept" ; teen => "dix" ++ "-" ++ "sept" ; jten => "soixante" ++ "-" ++ "dix" ; ten => "soixante" ++ "-" ++ "dix" ; tenplus => "soixante"}} ; +lin n8 = + {inh = unit ; inh1 = pl ; s = table {unit => "huit" ; teen => "dix" ++ "-" ++ "huit" ; jten => "quatre" ++ "-" ++ "vingts" ; ten => "quatre" ++ "-" ++ "vingt" ; tenplus => "quatre" ++ "-" ++ "vingt"}} ; +lin n9 = + {inh = teen ; inh1 = pl ; s = table {unit => "neuf" ; teen => "dix" ++ "-" ++ "neuf" ; jten => "quatre" ++ "-" ++ "vingt" ++ "-" ++ "dix" ; ten => "quatre" ++ "-" ++ "vingt" ++ "-" ++ "dix" ; tenplus => "quatre" ++ "-" ++ "vingt"}} ; +lin pot01 = + {inh = sg ; s = table {{p1 = unit ; p2 = indep} => "un" ; {p1 = unit ; p2 = attr} => [] ; {p1 = teen ; p2 = indep} => "onze" ; {p1 = teen ; p2 = attr} => [] ; {p1 = jten ; p2 = indep} => "dix" ; {p1 = jten ; p2 = attr} => [] ; {p1 = ten ; p2 = indep} => "dix" ; {p1 = ten ; p2 = attr} => [] ; {p1 = tenplus ; p2 = indep} => "dix" ; {p1 = tenplus ; p2 = attr} => []}} ; +lin pot0 d = + {inh = pl ; s = table {{p1 = unit ; p2 = indep} => d.s ! unit ; {p1 = unit ; p2 = attr} => d.s ! unit ; {p1 = teen ; p2 = indep} => d.s ! teen ; {p1 = teen ; p2 = attr} => d.s ! teen ; {p1 = jten ; p2 = indep} => d.s ! jten ; {p1 = jten ; p2 = attr} => d.s ! jten ; {p1 = ten ; p2 = indep} => d.s ! ten ; {p1 = ten ; p2 = attr} => d.s ! ten ; {p1 = tenplus ; p2 = indep} => d.s ! tenplus ; {p1 = tenplus ; p2 = attr} => d.s ! tenplus}} ; +lin pot110 = + {s = table {indep => "dix" ; attr => "dix"}} ; +lin pot111 = + {s = table {indep => "onze" ; attr => "onze"}} ; +lin pot1to19 d = + {s = table {indep => d.s ! teen ; attr => d.s ! teen}} ; +lin pot0as1 n = + {s = table {indep => n.s ! {p1 = unit ; p2 = indep} ; attr => n.s ! {p1 = unit ; p2 = attr}}} ; +lin pot1 d = + {s = table {indep => d.s ! jten ; attr => d.s ! ten}} ; +lin pot1plus d e = + {s = table {indep => (d.s ! tenplus) ++ (table {{p1 = sg ; p2 = sg} => "et" ; {p1 = sg ; p2 = pl} => "-" ; {p1 = pl ; p2 = sg} => "-" ; {p1 = pl ; p2 = pl} => "-"} ! {p1 = d.inh1 ; p2 = e.inh}) ++ e.s ! {p1 = d.inh ; p2 = indep} ; attr => (d.s ! tenplus) ++ (table {{p1 = sg ; p2 = sg} => "et" ; {p1 = sg ; p2 = pl} => "-" ; {p1 = pl ; p2 = sg} => "-" ; {p1 = pl ; p2 = pl} => "-"} ! {p1 = d.inh1 ; p2 = e.inh}) ++ e.s ! {p1 = d.inh ; p2 = indep}}} ; +lin pot1as2 n = + {s = table {indep => n.s ! indep ; attr => n.s ! attr}} ; +lin pot2 d = + {s = table {indep => (d.s ! {p1 = unit ; p2 = attr}) ++ table {sg => "cent" ; pl => "cents"} ! (d.inh) ; attr => (d.s ! {p1 = unit ; p2 = attr}) ++ "cent"}} ; +lin pot2plus d e = + {s = table {indep => (d.s ! {p1 = unit ; p2 = attr}) ++ "cent" ++ e.s ! indep ; attr => (d.s ! {p1 = unit ; p2 = attr}) ++ "cent" ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = (n.s ! attr) ++ "mille"} ; +lin pot3plus n m = + {s = (n.s ! attr) ++ "mille" ++ m.s ! indep} ; diff --git a/examples/numerals/french_swiss.gf b/examples/numerals/french_swiss.gf new file mode 100644 index 000000000..1966c25c0 --- /dev/null +++ b/examples/numerals/french_swiss.gf @@ -0,0 +1,72 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; +param Nm = sg | pl ; +param Place = indep | attr ; + +lincat Numeral = {s : Str} ; +lincat Digit = {inh : DForm ; inh1 : Nm ; s : DForm => Str} ; +lincat Sub10 = {inh : Nm ; s : {p1 : DForm ; p2 : Place} => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; + +lin num x0 = + {s = x0.s} ; +lin n2 = + {inh = unit ; inh1 = sg ; s = table {unit => "deux" ; teen => "douze" ; ten => "vingt" }} ; +lin n3 = + {inh = unit ; inh1 = sg ; s = table {unit => "trois" ; teen => "treize" ; ten => "trente" }} ; +lin n4 = + {inh = unit ; inh1 = sg ; s = table {unit => "quatre" ; teen => "quatorze" ; ten => "quarante" }} ; +lin n5 = + {inh = unit ; inh1 = sg ; s = table {unit => "cinq" ; teen => "quinze" ; ten => "cinquante" }} ; +lin n6 = + {inh = unit ; inh1 = sg ; s = table {unit => "six" ; teen => "seize" ; ten => "soixante" }} ; +lin n7 = + {inh = unit ; inh1 = sg ; s = table {unit => "sept" ; teen => "dix" ++ "-" ++ "sept" ; ten => "septante" }} ; +lin n8 = + {inh = unit ; inh1 = pl ; s = table {unit => "huit" ; teen => "dix" ++ "-" ++ "huit" ; ten => "huitante" }} ; +lin n9 = + {inh = unit ; inh1 = pl ; s = table {unit => "neuf" ; teen => "dix" ++ "-" ++ "neuf" ; ten => "nonante" }} ; +lin pot01 = + {inh = sg ; + s = table {{p1 = unit ; p2 = indep} => "un" ; + {p1 = unit ; p2 = attr} => [] ; + {p1 = teen ; p2 = indep} => "onze" ; + {p1 = teen ; p2 = attr} => [] ; + {p1 = ten ; p2 = indep} => "dix" ; + {p1 = ten ; p2 = attr} => [] }} ; +lin pot0 d = + {inh = pl ; + s = table {{p1 = unit ; p2 = indep} => d.s ! unit ; + {p1 = unit ; p2 = attr} => d.s ! unit ; + {p1 = teen ; p2 = indep} => d.s ! teen ; + {p1 = teen ; p2 = attr} => d.s ! teen ; + {p1 = ten ; p2 = indep} => d.s ! ten ; + {p1 = ten ; p2 = attr} => d.s ! ten }} ; + +lin pot110 = + {s = table {indep => "dix" ; attr => "dix"}} ; +lin pot111 = + {s = table {indep => "onze" ; attr => "onze"}} ; +lin pot1to19 d = + {s = table {indep => d.s ! teen ; attr => d.s ! teen}} ; +lin pot0as1 n = + {s = table {indep => n.s ! {p1 = unit ; p2 = indep} ; attr => n.s ! {p1 = unit ; p2 = attr}}} ; +lin pot1 d = + {s = table {indep => d.s ! ten ; attr => d.s ! ten}} ; +lin pot1plus d e = + {s = table {indep => (d.s ! ten) ++ (table {{p1 = sg ; p2 = sg} => "et" ; {p1 = sg ; p2 = pl} => "-" ; {p1 = pl ; p2 = sg} => "-" ; {p1 = pl ; p2 = pl} => "-"} ! {p1 = d.inh1 ; p2 = e.inh}) ++ e.s ! {p1 = d.inh ; p2 = indep} ; attr => (d.s ! ten) ++ (table {{p1 = sg ; p2 = sg} => "et" ; {p1 = sg ; p2 = pl} => "-" ; {p1 = pl ; p2 = sg} => "-" ; {p1 = pl ; p2 = pl} => "-"} ! {p1 = d.inh1 ; p2 = e.inh}) ++ e.s ! {p1 = d.inh ; p2 = indep}}} ; +lin pot1as2 n = + {s = table {indep => n.s ! indep ; attr => n.s ! attr}} ; +lin pot2 d = + {s = table {indep => (d.s ! {p1 = unit ; p2 = attr}) ++ table {sg => "cent" ; pl => "cents"} ! (d.inh) ; attr => (d.s ! {p1 = unit ; p2 = attr}) ++ "cent"}} ; +lin pot2plus d e = + {s = table {indep => (d.s ! {p1 = unit ; p2 = attr}) ++ "cent" ++ e.s ! indep ; attr => (d.s ! {p1 = unit ; p2 = attr}) ++ "cent" ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = (n.s ! attr) ++ "mille"} ; +lin pot3plus n m = + {s = (n.s ! attr) ++ "mille" ++ m.s ! indep} ; diff --git a/examples/numerals/fulfulde.gf b/examples/numerals/fulfulde.gf new file mode 100644 index 000000000..0531d35de --- /dev/null +++ b/examples/numerals/fulfulde.gf @@ -0,0 +1,50 @@ +include numerals.Abs.gf ; + +param Size = sg | pl | two; + +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = Form ; +lincat Sub10 = Form ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO: Encoding + +oper mkNum = ss ; + +oper ss : Str -> Form = \f -> {s = f ; size = pl } ; + +-- lin n1 = mkNum "go'o" ; +lin n2 = {s = "d.id.i" ; size = two } ; +lin n3 = mkNum "tati" ; +lin n4 = mkNum "nai" ; +lin n5 = mkNum "jowi" ; +lin n6 = mkNum "jowe:go" ; +lin n7 = mkNum "jowe:d.id.i" ; +lin n8 = mkNum "jowe:tati" ; +lin n9 = mkNum "jowe:nai" ; + +lin pot01 = {s = "go'o" ; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "sappo" ; +lin pot111 = ss ("sappo" ++ "e" ++ "go'o") ; +lin pot1to19 d = ss ("sappo" ++ "e" ++ d.s) ; +lin pot0as1 n = n ; +lin pot1 d = ss (mkten d.size d.s) ; +lin pot1plus d e = ss ((mkten d.size d.s) ++ "e" ++ e.s) ; +lin pot1as2 n = n ; +lin pot2 d = ss (mkhund d.size d.s) ; +lin pot2plus d e = ss ((mkhund d.size d.s) ++ "e" ++ e.s) ; +lin pot2as3 n = n ; +lin pot3 n = ss (mkthou n.size n.s) ; +lin pot3plus n m = ss ((mkthou n.size n.s) ++ m.s) ; + +oper mkten : Size -> Str -> Str = \sz -> \attr -> + table {two => "no:gas" ; _ => "chappand.e" ++ attr } ! sz ; +oper mkhund : Size -> Str -> Str = \sz -> \attr -> + table {sg => "temerre" ; _ => "temed.d.e" ++ attr} ! sz ; +oper mkthou : Size -> Str -> Str = \sz -> \attr -> + table {sg => "ujine:re"; _ => variants {"ujine" ++ attr ; "ujine:je" ++ attr}} ! sz ; diff --git a/examples/numerals/geez.gf b/examples/numerals/geez.gf new file mode 100644 index 000000000..9178f8760 --- /dev/null +++ b/examples/numerals/geez.gf @@ -0,0 +1,121 @@ +include numerals.Abs.gf ; + +-- No long consonants marked in the indigen. script +-- s is set intersection s +-- h is set union h +-- H is three-fork h +-- x is hook-looking h +-- L is sin-looking s +-- X is h looking like k with a roof +-- Z is zh +-- $ is sh +-- ) is the glottal stop hamza = independent vowel in word +-- ( is 3ayn +-- Capitalis for ejectives KPTCS +-- stress not indicated in indigen. script + +param DForm = unit | ten ; +param Size = sg | less100 | more100 ; +param Ending = zero | nonzero | tenzero; +param S100 = tenp | tenpalf | unitp ; +param S1000 = indep | alf | tenm | tailform ; + +oper LinDigit = {s : DForm => Str ; size : Size} ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; s2 : S100 => Str ; unitp_ending : Ending ; size : Size} ; +lincat Sub1000 = {s : S1000 => Str ; ending : Ending ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/E" ++ x0.s ++ "E/"} ; -- The Ethiopic script environment +lin n2 = mkNum "kïl)etu" "(ï$ra" ; +lin n3 = mkNum "Lälastu" "Lälasa" ; +lin n4 = mkNum ")ärba(tu" ")ärbï(a" ; +lin n5 = mkNum "xämïstu" "xämsa" ; +lin n6 = mkNum "sïdïstu" "sïssa" ; +lin n7 = mkNum (variants { "säb(ätu" ; "säb(atu" }) "säb(a" ; +lin n8 = mkNum (variants { "sämantu" ; "sämanitu" }) "sämanya" ; +lin n9 = mkNum (variants { "tïs(ätu" ; "täs(ätu" ; "täsa(tu" }) (variants {"täs(a" ; "tïs(a"}) ; + +oper mkNum : Str -> Str -> LinDigit = \tva -> \tjugo -> + {s = table {unit => tva ; ten => tjugo} ; size = less100 } ; + +lin pot01 = + {s = table {unit => ")äHädu" ; ten => "(ä$ärtu" } ; size = sg}; +lin pot0 d = d ; +lin pot110 = {s = "(ä$ärtu" ; + s2 = table {tenp => "wä" ++ ")äHädu" ; + tenpalf => ")ïlf" ; + unitp => [] } ; + unitp_ending = zero ; + size = less100} ; +lin pot111 = {s = "(ä$ärtu" ++ "wä" ++ ")äHädu" ; + s2 = table {tenp => "wä" ++ ")äHädu" ; + tenpalf => ")ïlf" ; + unitp => "(ä$ärtu" } ; + unitp_ending = nonzero ; + size = less100} ; +lin pot1to19 d = + {s = "(ä$ärtu" ++ "wä" ++ d.s ! unit ; + s2 = table {tenp => "wä" ++ ")äHädu" ; + tenpalf => ")ïlf" ; + unitp => d.s ! ten } ; + unitp_ending = nonzero ; + size = less100} ; +lin pot0as1 n = + {s = n.s ! unit ; + s2 = table {unitp => n.s ! ten ; _ => [] }; + unitp_ending = nonzero ; + size = n.size} ; +lin pot1 d = + {s = d.s ! ten ; + s2 = table {tenp => "wä" ++ d.s ! unit ; + tenpalf => d.s ! unit ++ ")ïlf" ; + unitp => [] } ; + unitp_ending = tenzero ; + size = less100} ; +lin pot1plus d e = + {s = d.s ! ten ++ "wä" ++ e.s ! unit ; + s2 = table {tenp => "wä" ++ d.s ! unit ; + tenpalf => d.s ! unit ++ ")ïlf" ; + unitp => e.s ! ten } ; + unitp_ending = nonzero ; + size = less100} ; +lin pot1as2 n = + {s = table {indep => n.s ; + tailform => n.s ; + tenm => n.s2 ! unitp ; + alf => n.s2 ! tenpalf ++ n.s2 ! unitp } ; + ending = n.unitp_ending ; + size = n.size} ; +lin pot2 d = + {s = table {indep => table {sg => "mï)t" ; _ => d.s ! unit ++ "mï)t" } ! d.size ; + tenm => "dummy" ; + alf => d.s ! ten ++ ")ïlf" ; + tailform => d.s ! unit ++ "mï)t" } ; + size = more100 ; + ending = zero} ; +lin pot2plus d e = + {s = table {indep => table {sg => "mï)t" ; _ => d.s ! unit ++ "mï)t" } ! d.size ++ e.s ; + tenm => "dummy"; + alf => d.s ! ten ++ e.s2 ! tenp ++ ")ïlf" ++ e.s2 ! unitp ; + tailform => d.s ! unit ++ "mï)t" ++ e.s} ; + size = more100 ; + ending = e.unitp_ending } ; + +lin pot2as3 n = {s = n.s ! indep } ; +lin pot3 n = + {s = table {more100 => mkmit n.ending (n.s ! alf) ; _ => n.s ! tenm ++ "mï)t"} ! n.size} ; +lin pot3plus n m = + {s = table + {more100 => table {more100 => n.s ! alf ; less100 => n.s ! alf ; _ => n.s ! tenm} ! n.size ++ + table {zero => m.s ! indep ; + tenzero => m.s ! indep ; + nonzero => "wä" ++ m.s ! tailform } ! n.ending; + _ => table {more100 => mkmit n.ending (n.s ! alf) ; + less100 => n.s ! alf ++ table {nonzero => "mï)t" ; _ => []} ! n.ending ; + _ => n.s ! tenm ++ "mï)t"} ! n.size ++ m.s ! indep} ! m.size } ; + +oper mkmit : Ending -> Str -> Str = \e -> \s -> table {zero => [] ; _ => s ++"mï)t" } ! e; \ No newline at end of file diff --git a/examples/numerals/german.gf b/examples/numerals/german.gf new file mode 100644 index 000000000..3e7b9990c --- /dev/null +++ b/examples/numerals/german.gf @@ -0,0 +1,47 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; +param Place = indep | prae | attr ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm*Place => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; + +oper mkZahl : Str -> Str -> Str -> Lin Digit = + \två -> \tolv -> \tjugo -> + {s = table {unit => två ; teen => tolv ; ten => tjugo}} ; +oper regZahl : Str -> Lin Digit = + \vier -> mkZahl vier (vier + "zehn") (vier + "zig") ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; + +lin n2 = mkZahl "zwei" "zwölf" "zwanzig" ; +lin n3 = mkZahl "drei" "dreizehn" "dreissig" ; +lin n4 = regZahl "vier" ; +lin n5 = regZahl "fünf" ; +lin n6 = regZahl "sechs" ; +lin n7 = mkZahl "sieben" "siebzehn" "siebzig" ; +lin n8 = regZahl "acht" ; +lin n9 = regZahl "neun" ; + +lin pot01 = {s = table { => "eins" ; => "ein" ; => []}} ; +lin pot0 d = {s = table { => d.s ! f}} ; +lin pot110 = {s = table {p => "zehn"}} ; +lin pot111 = {s = table {p => "elf"}} ; +lin pot1to19 d = {s = table {p => d.s ! teen}} ; +lin pot0as1 n = {s = table {p => n.s ! }} ; +lin pot1 d = {s = table {p => d.s ! ten}} ; +lin pot1plus d e = {s = table {p => e.s ! ++ "und" ++ d.s ! ten}} ; +lin pot1as2 n = {s = table {p => n.s ! p}} ; +lin pot2 d = {s = table {p => d.s ! ++ "hundert"}} ; +lin pot2plus d e = {s = table { + attr => d.s ! ++ "hundert" ++ e.s ! prae ; + _ => d.s ! ++ "hundert" ++ e.s ! indep}} ; +lin pot2as3 n = ss (n.s ! indep) ; +lin pot3 n = ss (n.s ! attr ++ "tausend") ; +lin pot3plus n m = ss (n.s ! attr ++ "tausend" ++ m.s ! prae) ; + diff --git a/examples/numerals/greek_classical.gf b/examples/numerals/greek_classical.gf new file mode 100644 index 000000000..44ce57fe7 --- /dev/null +++ b/examples/numerals/greek_classical.gf @@ -0,0 +1,197 @@ +include numerals.Abs.gf ; +-- Classical Greek (of Athens) +-- Aarne's transliteration +-- There are attested variant forms. kai:s between the elements in bigger -> +-- smaller order is also possible but not common. + +param DForm = unit | tkismyr | teen | ten | hund | kisxil | kismyr | + tenkismyr | tenkis ; +param InterData = indep Order | xiliad | myriad Order ; +param Tenpart = kis1 | tkis1 ; +param Size = sg | pl | tenoverpl ; +param Order = des | asc; +lincat Numeral = {s : Str} ; + +oper LinDigit = {s : DForm => Str} ; +oper LinSub1000 = {s : InterData => Str ; size : Size} ; + +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str ; + size : Size} ; +lincat Sub100 = {s : InterData => Str ; + s1 : Tenpart => Str ; + s2 : Str ; + size : Size} ; +lincat Sub1000 = LinSub1000 ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "//" ++ x0.s ++ "//"} ; -- Greek environment + +oper mkNum : Str -> Str -> Str -> Str -> Str -> Str -> Str -> LinDigit = + \dyo -> \dis -> \dwdekakis -> \dwdeka -> \eikosi -> \diakosioi -> + \eikosakis -> + {s = table {unit => dyo ; + tkismyr => dwdekakis + "m'yrioi" ; + teen => dwdeka ; + ten => eikosi ; + hund => diakosioi ; + kisxil => dis + "c'ilioi" ; + kismyr => dis + "m'yrioi" ; + tenkis => eikosakis ; + tenkismyr => eikosakis + "m'yrioi"} }; + +lin n2 = mkNum + "d'yo" + "dis" + "dwdekakis" + "d'wdeka" + "e)'ikosi" + "diak'osioi" + "e)ikos'akis" ; + +lin n3 = mkNum + "tre~ij" + "tris" + "treiskaidekakis" + (variants {"tre~ij" ++ "ka`i" ++ "d'eka" ; "treiska'ideka"} ) + "tri'akonta" + "triak'osioi" + "triakont'akis" ; + +lin n4 = mkNum + "t'ettarej" + "tetrakis" + "tettareskaidekakis" + (variants {"t'ettarej" ++ "ka`i" ++ "d'eka" ; "tettareska'ideka"}) + "tettar'akonta" + "tetrak'osioi" + "tettarakont'akis" ; + +lin n5 = mkNum + "p'ente" + "pentakis" + "pentekaidekakis" + "penteka'ideka" + "pent'hkonta" + "pentak'osioi" + "penthkont'akis" ; + +lin n6 = mkNum + "('ex" + "(exakis" + "(ekkaidekakis" + "(ekka'ideka" + "(ex'hkonta" + "(exak'osioi" + "(exhkont'akis" ; + +lin n7 = mkNum + "(ept'a" + "(eptakis" + "(eptakaidekakis" + "(eptaka'ideka" + "(ebdom'hkonta" + "(eptak'osioi" + "(ebdomhkont'akis" ; + +lin n8 = mkNum + ")okt'w" + ")oktakis" + ")oktwkaidekakis" + ")oktwka'ideka" + ")ogdo'hkonta" + ")oktak'osioi" + ")ogdohkont'akis" ; + +lin n9 = mkNum + ")enn'ea" + ")enakis" + ")enneakaidekakis" + ")enneaka'ideka" + ")enen'hkonta" + ")enak'osioi" + ")enenhkont'akis" ; + +lin pot01 = + {s = table {hund => "(ekat'on" ; + kisxil => "c'ilioi" ; + kismyr => "('apax" + "m'yrioi" ; + _ => "e('ij" } ; + size = sg} ; +lin pot0 d = + {s = d.s ; size = pl} ; +lin pot110 = + {s = table {xiliad => "dummy" ; + (myriad _) => "m'yrioi" ; + (indep _) => "d'eka" }; + s1 = table {kis1 => "('apax" + "m'yrioi" ; tkis1 => "(endek'akis" + "m'yrioi"} ; + s2 = [] ; + size = tenoverpl} ; +lin pot111 = + {s = table {xiliad => "dummy" ; + (myriad des) => "m'yrioi" ++ "c'ilioi" ; + (myriad asc) => "c'ilioi" ++ "ka`i" ++ "m'yrioi" ; + (indep _) => "('endeka" } ; + s1 = table {kis1 => "('apax" + "m'yrioi" ; tkis1 => "(endek'akis" + "m'yrioi"} ; + s2 = "c'ilioi" ; + size = tenoverpl} ; +lin pot1to19 d = + {s = table {xiliad => "dummy" ; + (myriad des) => "m'yrioi" ++ d.s ! kisxil ; + (myriad asc) => d.s ! kisxil ++ "ka`i" ++ "m'yrioi" ; + (indep _) => d.s ! teen } ; + s1 = table {kis1 => "('apax" + "m'yrioi" ; tkis1 => "(endek'akis" + "m'yrioi" } ; + s2 = d.s ! kisxil ; + size = tenoverpl} ; +lin pot0as1 n = + {s = table {xiliad => n.s ! kisxil ; + (indep _) => n.s ! unit ; + (myriad _) => "dummy" } ; + s1 = table {_ => []} ; + s2 = n.s ! kisxil ; + size = n.size} ; +lin pot1 d = + {s = table {xiliad => "dummy" ; + (myriad _) => d.s ! kismyr ; + (indep _) => d.s ! ten} ; + s1 = table {kis1 => d.s ! kismyr ; tkis1 => d.s ! tkismyr } ; + s2 = []; + size = tenoverpl} ; +lin pot1plus d e = + {s = table {xiliad => "dummy" ; + (myriad des) => d.s ! kismyr ++ e.s ! kisxil ; + (myriad asc) => e.s ! kisxil ++ "ka`i" ++ d.s ! kismyr ; + (indep des) => d.s ! ten ++ e.s ! unit ; + (indep asc) => e.s ! unit ++ "ka`i" ++ d.s ! ten } ; + s1 = table {kis1 => d.s ! kismyr ; tkis1 => d.s ! tkismyr } ; + s2 = e.s ! kisxil ; + size = tenoverpl} ; +lin pot1as2 n = + {s = n.s ; size = n.size} ; +lin pot2 d = + {s = table {(indep _) => d.s ! hund ; + (myriad _) => d.s ! tenkismyr; + xiliad => "dummy"} ; + size = tenoverpl} ; +lin pot2plus d e = + {s = table {(myriad _) => table {sg => e.s1 ! tkis1 ; + pl => d.s ! tenkis ++ e.s1 ! kis1 ; + tenoverpl => "dummy" } ! d.size ++ e.s2 ; + (indep des) => d.s ! hund ++ e.s ! indep des ; + (indep asc) => (e.s ! indep asc) ++ "ka`i" ++ d.s ! hund ; + xiliad => "dummy" } ; + size = tenoverpl} ; + +lin pot2as3 n = + {s = variants { n.s ! indep des ; n.s ! indep asc}} ; +lin pot3 n = + {s = variants {(Myr n des) ! n.size ; (Myr n asc) ! n.size} } ; +lin pot3plus n m = + {s = variants {(Myr n des) ! n.size ++ m.s ! indep des; + m.s ! indep asc ++ "ka`i" ++ (Myr n asc) ! n.size }} ; + +oper Myr : LinSub1000 -> Order -> Size => Str = \n -> \order -> + table {sg => "c'ilioi" ; + pl => n.s ! xiliad ; + tenoverpl => n.s ! myriad order} ; + diff --git a/examples/numerals/greek_modern.gf b/examples/numerals/greek_modern.gf new file mode 100644 index 000000000..24ba24603 --- /dev/null +++ b/examples/numerals/greek_modern.gf @@ -0,0 +1,69 @@ +include numerals.Abs.gf ; + +-- Free variation on accents on m'ia and d'yo + +oper vowel : Strs = strs {"e" ; "o" ; "a" ; "'e" ; "'o" ; "'a"} ; + +param DForm = unit | fem | femteen | teen | ten | hundredneut | hundredfem ; +param Use = indep | femattr ; +param Size = sg | pl ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str } ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Use => Str ; size : Size} ; +lincat Sub1000 = {s : Use => Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "//" ++ x0.s ++ "//"} ; -- Greek environment + +oper mkNum : Str -> Str -> Str -> Str -> Str -> Str -> Lin Digit = + \dyo -> \dwdeka -> \eikosi -> \diakosi -> \dyofem -> \dwdekafem -> + {s = table {unit => dyo ; teen => dwdeka ; ten => eikosi ; + hundredneut => diakosi + "a" ; hundredfem => diakosi + "ej" ; + fem => dyofem ; femteen => dwdekafem}} ; + +oper mkIndeclNum : Str -> Str -> Str -> Str -> Lin Digit = + \dyo -> \dwdeka -> \eikosi -> \diakosi -> + {s = table {unit => dyo ; teen => dwdeka ; ten => eikosi ; + hundredneut => diakosi + "a" ; hundredfem => diakosi + "ej" ; + fem => dyo ; femteen => dwdeka}} ; + +lin n2 = mkIndeclNum "d'yo" "d'wdeka" "e'ikosi" "diak'osi" ; +lin n3 = mkNum "tr'ia" "dekatr'ia" "tri'anta" "triak'osi" "tre'ij" "dekatre'is" ; +lin n4 = mkNum "t'essera" "dekat'essera" "sar'anta" "tetrak'osi" "t'esserij" "dekat'esserij" ; +lin n5 = mkIndeclNum "p'ente" "dekap'ente" "pen'hnta" "pentak'osi" ; +lin n6 = mkIndeclNum "'exi" (variants { "deka'exi" ; "deka'exi" }) "ex'hnta" "exak'osi" ; +lin n7 = mkIndeclNum (variants {"ept'a" ; "eft'a" }) "dekaeft'a" "ebdom'hnta" "eftak'osi" ; +lin n8 = mkIndeclNum "oct'w" "dekaoct'w" "ogd'onta" "octak'osi" ; +lin n9 = mkIndeclNum (variants {"enn'ea" ; "enn'ia" }) "dekaenn'ea" "enen'hnta" "enniak'osi" ; +lin pot01 = + {s = table {unit => "'ena" ; fem => "m'ia" ; _ => "ekat'o" + pre {[] ; "n" / vowel}} ; size = sg} ; +lin pot0 d = + {s = d.s ; size = pl} ; +lin pot110 = + {s = table {indep => "d'eka" ; femattr => "d'eka"} ; size = pl} ; +lin pot111 = + {s = table {indep => "'enteka" ; femattr => "'enteka" } ; size = pl} ; +lin pot1to19 d = + {s = table {indep => d.s ! teen; femattr => d.s ! femteen } ; size = pl} ; +lin pot0as1 n = + {s = table {indep => n.s ! unit ; femattr => n.s ! fem } ; size = n.size} ; +lin pot1 d = + {s = table {indep => d.s ! ten ; femattr => d.s ! ten } ; size = pl } ; +lin pot1plus d e = + {s = table {indep => d.s ! ten ++ e.s ! unit ; femattr => d.s ! ten ++ e.s ! fem } ; size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = + {s = table {indep => d.s ! hundredneut ; femattr => d.s ! hundredfem} ; size = pl} ; +lin pot2plus d e = + {s = table {indep => d.s ! hundredneut ++ e.s ! indep ; femattr => d.s ! hundredfem ++ e.s ! femattr} ; size = pl} ; +lin pot2as3 n = + {s = n.s ! indep } ; +lin pot3 n = + {s = (Xilias (n.s ! femattr)) ! n.size} ; +lin pot3plus n m = + {s = (Xilias (n.s ! femattr)) ! n.size ++ m.s ! indep} ; + +oper Xilias : Str -> Size => Str = + \s -> table {sg => "c'ilia" ; pl => s ++ "cili'adej" } ; \ No newline at end of file diff --git a/examples/numerals/guahibo.gf b/examples/numerals/guahibo.gf new file mode 100644 index 000000000..d9cb69ebc --- /dev/null +++ b/examples/numerals/guahibo.gf @@ -0,0 +1,45 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +param Size = sg | pl ; + +oper All = {s : Str ; size : Size}; + +lincat Digit = All ; +lincat Sub10 = All ; +lincat Sub100 = All ; +lincat Sub1000 = All ; + +oper mkNum : Str -> All = \tri -> + { s = tri ; size = pl}; + +lin num x = {s = x.s } ; + +lin n2 = mkNum "aniha" ; +lin n3 = mkNum "akueya" ; +lin n4 = mkNum "yana" ; +lin n5 = mkNum "kobe" ; +lin n6 = mkNum "ku" ; +lin n7 = mkNum "iwi" ; +lin n8 = mkNum "yu" ; +lin n9 = mkNum "ho" ; + +oper ss : Str -> All = \s1 -> {s = s1 ; size = pl } ; + +lin pot01 = { s = "kae" ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss "xu" ; +lin pot111 = ss ("xu" + "kae") ; +lin pot1to19 d = ss (bind "xu" d.s) ; +lin pot0as1 n = n ; +lin pot1 d = ss (bind d.s "bae" ); +lin pot1plus d e = ss ((bind d.s "bae") ++ e.s ) ; +lin pot1as2 n = n ; +lin pot2 d = ss (bind ((selsg d.s) ! d.size) "sia" ) ; +lin pot2plus d e = ss ((bind ((selsg d.s) ! d.size) "sia") ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = bind ((selsg n.s) ! n.size) "sunu" } ; +lin pot3plus n m = {s = (bind ((selsg n.s) ! n.size) "sunu") ++ m.s} ; + +oper selsg : Str -> Size => Str = \s -> table {sg => [] ; pl => s } ; \ No newline at end of file diff --git a/examples/numerals/guarani.gf b/examples/numerals/guarani.gf new file mode 100644 index 000000000..7fbfa5d9b --- /dev/null +++ b/examples/numerals/guarani.gf @@ -0,0 +1,48 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +param Size = sg | pl ; + +oper All = {s : Str ; s2 : Str ; size : Size}; + +lincat Digit = All ; +lincat Sub10 = All ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size} ; + +oper mkNum : Str -> All = \tri -> + { s = tri ; s2 = "kua" + tri ; size = pl}; + +oper mkNum2 : Str -> Str -> All = \tri -> \teen -> + { s = tri ; s2 = "kua" + teen ; size = pl}; + +lin num x = {s = x.s } ; -- TODO + +lin n2 = mkNum2 "moko~i" "ko~i"; +lin n3 = mkNum2 "mpohapy" "py"; +lin n4 = mkNum2 "irundy" "rundy"; +lin n5 = mkNum "po" ; +lin n6 = mkNum "potei~" ; +lin n7 = mkNum "poko~i" ; +lin n8 = mkNum "poapy" ; +lin n9 = mkNum "porundy" ; + +oper ss : Str -> {s : Str ; size : Size} = \s1 -> {s = s1 ; size = pl } ; + +lin pot01 = { s = "petei~" ; s2 = "dummy" ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss "kua~" ; +lin pot111 = ss ("kua" + "tei~") ; +lin pot1to19 d = ss d.s2 ; +lin pot0as1 n = {s = n.s ; size = n.size} ; +lin pot1 d = ss (bind d.s "kua~" ); +lin pot1plus d e = ss ((bind d.s "kua~") ++ e.s ) ; +lin pot1as2 n = n ; +lin pot2 d = ss (((selsg d.s) ! d.size) ++ "sa~" ) ; +lin pot2plus d e = ss ((((selsg d.s) ! d.size) ++ "sa~") ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = bind ((selsg n.s) ! n.size) "ma" } ; +lin pot3plus n m = {s = (bind ((selsg n.s) ! n.size) "ma") ++ m.s} ; + +oper selsg : Str -> Size => Str = \s -> table {sg => variants {[]; "petei~"}; pl => s } ; \ No newline at end of file diff --git a/examples/numerals/hebrew_biblical.gf b/examples/numerals/hebrew_biblical.gf new file mode 100644 index 000000000..d95ebfcc6 --- /dev/null +++ b/examples/numerals/hebrew_biblical.gf @@ -0,0 +1,88 @@ +include numerals.Abs.gf ; + +param DForm = unit Place | cons | ten | hund ; +param Size = small | large | dual ; +param Place = attr | indep ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Place => Str ; size : Size} ; +lincat Sub1000 = {s : Place => Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/+" ++ x0.s ++ "+/"} ; -- the Hebrew environment + +lin n2 = + {s = table {(unit attr) => [] ; + (unit indep) => "snyM" ; + cons => "sny" ; + ten => "osryM" ; + hund => "matyM"} ; size = dual} ; +lin n3 = + {s = table {(unit _) => "slsh" ; + cons => "slst" ; + ten => "slsyM" ; + hund => "sls" ++ "mawt"} ; size = small} ; +lin n4 = + {s = table {(unit _) => "arboh" ; + cons => "arbot" ; + ten => "arboyM" ; + hund => "arbo" ++ "mawt"} ; size = small} ; +lin n5 = + {s = table {(unit _) => "Hmsh" ; + cons => "Hmst" ; + ten => "HmsyM" ; + hund => "Hms" ++ "mawt"} ; size = small} ; +lin n6 = + {s = table {(unit _) => "ssh" ; + cons => "sst" ; + ten => "ssyM" ; + hund => "ss" ++ "mawt"} ; size = small} ; +lin n7 = + {s = table {(unit _) => "sboh" ; + cons => "sbot" ; + ten => "sboyM" ; + hund => "sbo" ++ "mawt"} ; size = small} ; +lin n8 = + {s = table {(unit _) => "smnh" ; + cons => "smnt" ; + ten => "smnyM" ; + hund => "smnh" ++ "mawt"} ; size = small} ; +lin n9 = + {s = table {(unit _) => "tsoh" ; + cons => "tsot" ; + ten => "tsoyM" ; + hund => "tso" ++ "mawt"} ; size = small} ; + +lin pot01 = + {s = table {hund => "mah"; (unit attr) => [] ; f => "aHd"} ; size = large} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "osr"} ; size = small} ; +lin pot111 = + {s = table {_ => variants {"aHd" ++ "osr" ; "osty" ++ "osr"} } ; size = large} ; +lin pot1to19 d = + {s = table {_ => d.s ! unit indep ++ "osr"} ; size = large} ; +lin pot0as1 n = + {s = table {p => n.s ! unit p} ; size = n.size} ; +lin pot1 d = + {s = table {_ => d.s ! ten} ; size = large} ; +lin pot1plus d e = + {s = table {_ => d.s ! ten ++ "w" ++ e.s ! unit indep} ; size = large} ; +lin pot1as2 n = + {s = n.s ; size = n.size} ; +lin pot2 d = + {s = table {_ => d.s ! hund} ; size = large} ; +lin pot2plus d e = + {s = table {_ => d.s ! hund ++ "w" ++ e.s ! indep} ; size = large} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = n.s ! attr ++ Alf ! n.size} ; +lin pot3plus n m = + {s = n.s ! attr ++ Alf ! n.size ++ "w" ++ m.s ! indep} ; + +oper Alf : Size => Str = + table {{small} => "alpyM" ; {dual} => "alpyM" ; _ => "alP"} ; + diff --git a/examples/numerals/hindi.gf b/examples/numerals/hindi.gf new file mode 100644 index 000000000..15a874f89 --- /dev/null +++ b/examples/numerals/hindi.gf @@ -0,0 +1,99 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten ; +param DSize = sg | r2 | r3 | r4 | r5 | r6 | r7 | r8 | r9 ; +param Size = sing | less100 | more100 ; + +oper LinDigit = {s : DForm => Str ; size : DSize} ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str ; size : DSize} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; + +lin num x0 = + {s = "/&" ++ x0.s ++ "&/"} ; -- the Devana:gari environment + + +-- H is for aspiration (h is a sepaarate letter) +-- M is anusvara +-- ~ is candrabindhu +-- c is is Eng. ch in e.g chop +-- cH is chH +-- _: is length +-- T, D, R are the retroflexes + +oper mkNum : Str -> Str -> DSize -> LinDigit = + \do -> \bis -> \sz -> + {s = table {unit => do ; ten => bis } ; + size = sz } ; + +-- lin n1 mkNum "ek" "gya:rah" "das" +lin n2 = mkNum "do" "bi:s" r2 ; +lin n3 = mkNum "ti:n" "ti:s" r3 ; +lin n4 = mkNum "ca:r" "ca:li:s" r4 ; +lin n5 = mkNum "pa:~nc" "paca:s" r5 ; +lin n6 = mkNum (variants {"cHah" ; "cHa;" ; "cHai"}) "sa:TH" r6 ; +lin n7 = mkNum "sa:t" "sattar" r7; +lin n8 = mkNum "a:TH" "assi:" r8; +lin n9 = mkNum "nau" (variants {"navve" ; "nabbe" }) r9 ; + +oper mkR : Str -> Str -> Str -> Str -> Str -> Str -> Str -> Str -> Str -> DSize => Str = \a1 -> \a2 -> \a3 -> \a4 -> \a5 -> \a6 -> \a7 -> \a8 -> \a9 -> table { + sg => a1 + "ah" ; + r2 => a2 + "i:s" ; + r3 => a3 + "ti:s" ; + r4 => a4 + "a:li:s" ; + r5 => a5 + "an" ; + r6 => a6 + "saTH" ; + r7 => a7 + "hattar" ; + r8 => a8 + "a:si:" ; + r9 => a9 + "a:nave" +} ; + +oper rows : DSize => DSize => Str = table { + sg => mkR "gya:r" "ikk" "ikat" "ekt" "ikya:v" "ik" "ik" "iky" "iky" ; + r2 => mkR "ba:r" "ba:" "bat" "bay" "ba:v" "ba:" "ba" "bay" "b" ; + r3 => mkR "ter" "te" "taiM" "taiMt" "tirp" "tir" "ti" "tir" "tir" ; + r4 => mkR "caud" "caub" "cauM" "cav" "caup" "cauM" "cau" "caur" "caur" ; + r5 => mkR "paMdr" "pacc" "paiM" "paiMt" "pacp" "paiM" "pac" "pac" "pac" ; + r6 => mkR "sol" "cHabb" "cHat" "cHiy" "cHapp" "cHiya:" "cHi" "cHiy" "cHiy" ; + r7 => mkR (variants { "sattr" ; "satr"}) "satta:v" "saiM" "saiMt" "satta:" "sar" "sat" (variants {"satt" ; "sat" }) "satt" ; + r8 => mkR "aTHa:r" "aTTHa:" "aR" "aRt" "aTTHa:v" "aR" "aTH" (variants { "aTTH" ; "aTH" }) "aTTH" ; + r9 => table {sg => "unni:s" ; r2 => "unati:s" ; r3 => "unata:li:s" ; + r4 => "unaca:s" ; r5 => "unasaTH" ; r6 => "unahattar" ; + r7 => (variants{"unna:si:" ; "unya:si:"}) ; + r8 => "nava:si:" ; r9 => "ninya:nave" } +} ; + +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin pot01 = {s = table {unit => "ek" ; _ => "dummy" } ; size = sg} ; +lin pot0 d = d ; +lin pot110 = {s = "das" ; size = less100} ; +lin pot111 = {s = rows ! sg ! sg ; size = less100} ; +lin pot1to19 d = {s = rows ! d.size ! sg ; size = less100} ; +lin pot0as1 n = {s = n.s ! unit ; size = table {sg => sing ; _ => less100} ! n.size } ; + +lin pot1 d = {s = d.s ! ten ; size = less100} ; +lin pot1plus d e = {s = rows ! e.size ! d.size ; size = less100} ; + +lin pot1as2 n = {s = n.s ; s2 = "dummy" ; size = n.size } ; +lin pot2 d = {s = (mksau (d.s ! unit) d.size) ; + s2 = d.s ! unit ++ "la:kH" ; size = more100} ; +lin pot2plus d e = + {s = (mksau (d.s ! unit) d.size) ++ e.s ; + s2 = (d.s ! unit) ++ "la:kH" ++ (mkhazar e.s e.size) ; + size = more100} ; + +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = table { sing => ekhazar ; + less100 => n.s ++ "haza:r" ; + more100 => n.s2 } ! n.size} ; +lin pot3plus n m = + {s = table {sing => ekhazar ; + less100 => n.s ++ "haza:r" ; + more100 => n.s2 } ! n.size ++ m.s} ; + + +oper ekhazar : Str = variants {"haza:r" ; "ek" ++ "haza:r"} ; +oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {sing => ekhazar ; _ => s ++ "haza:r"} ! sz ; +oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "sau" ; _ => s ++ "sau"} ! sz ; diff --git a/examples/numerals/hungarian.gf b/examples/numerals/hungarian.gf new file mode 100644 index 000000000..2489fb6ef --- /dev/null +++ b/examples/numerals/hungarian.gf @@ -0,0 +1,61 @@ +include numerals.Abs.gf ; + +-- by Patrik Jansson, Chalmers + +param DForm = ental | tiotal ; +param Place = attr | indep ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : (DForm*Place) => Str} ; +lincat Sub10 = {s : (DForm*Place) => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = table { => "kettö" ; + => "húsz" ; + => "két" ; + => "huszon"}} ; +lin n3 = + {s = table { => "három" ; => "harminc"}} ; +lin n4 = + {s = table { => "négy" ; => "negyven"}} ; +lin n5 = + {s = table { => "öt" ; => "ötven"}} ; +lin n6 = + {s = table { => "hat" ; => "hatvan"}} ; +lin n7 = + {s = table { => "hét" ; => "hetven"}} ; +lin n8 = + {s = table { => "nyolc" ; => "nyolcvan"}} ; +lin n9 = + {s = table { => "kilenc" ; => "kilencven"}} ; +lin pot01 = + {s = table { => [] ; => "egy"}} ; +lin pot0 d = + {s = table { => d.s ! }} ; +lin pot110 = + {s = table {p => "tíz"}} ; +lin pot111 = + {s = table {p => "tizen" ++ "egy"}} ; +lin pot1to19 d = + {s = table {p => "tizen" ++ d.s ! }} ; +lin pot0as1 n = + {s = table {p => n.s ! }} ; +lin pot1 d = + {s = table {p => d.s ! }} ; +lin pot1plus d e = + {s = table {p => (d.s ! ) ++ e.s ! }} ; +lin pot1as2 n = + {s = table {p => n.s ! p}} ; +lin pot2 d = + {s = table {p => (d.s ! ) ++ "száz"}} ; +lin pot2plus d e = + {s = table {p => (d.s ! ) ++ "száz" ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = n.s ! attr ++ "ezer"} ; +lin pot3plus n m = + {s = n.s ! attr ++ "ezer" ++ m.s ! indep} ; diff --git a/examples/numerals/icelandic.gf b/examples/numerals/icelandic.gf new file mode 100644 index 000000000..1933f7332 --- /dev/null +++ b/examples/numerals/icelandic.gf @@ -0,0 +1,51 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten | neuter ; +param Gen = com | neut ; +param Size = sg | less10 | pl ; + +oper LinDigit = {s : DForm => Str} ; + +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Gen => Str ; size : Size} ; +lincat Sub1000 = {s : Gen => Str ; size : Size} ; + +oper mkNum : Str -> Str -> Str -> Str -> LinDigit = + \two -> \twelve -> \twenty -> \tvo -> + {s = table {unit => two ; teen => twelve ; ten => twenty ; neuter => tvo}} ; +oper regNum : Str -> LinDigit = + \fimm -> mkNum fimm (fimm + "tán") (fimm + "tíu") fimm; + +oper ss : Str -> {s : Gen => Str ; size : Size} = \s -> {s = table {_ => s } ; size = pl}; + +lin num x = x ; +lin n2 = mkNum "tveir" "tólf" "tuttugu" "tvö" ; +lin n3 = mkNum "Þrír" "Þréttán" "Þrjátíu" "Þrjú" ; +lin n4 = mkNum "fjórir" "fjórtán" "fjörutíu" "fjögur"; +lin n5 = regNum "fimm" ; +lin n6 = regNum "sex" ; +lin n7 = mkNum "sjö" "sautján" "sjötíu" "sjö" ; +lin n8 = mkNum "átta" "átján" "áttíu" "átta" ; +lin n9 = mkNum "níu" "nítján" "níutíu" "níu" ; + +lin pot01 = {s = table {f => "einn"} ; size = sg } ; +lin pot0 d = {s = d.s ; size = less10 } ; +lin pot110 = ss "tíu" ; +lin pot111 = ss "ellefu" ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = table {com => n.s ! unit ; neut => n.s ! neuter } ; size = n.size } ; +lin pot1 d = {s = table {_ => d.s ! ten } ; size = pl}; +lin pot1plus d e = {s = table {com => d.s ! ten ++ "og" ++ e.s ! unit ; + neut => d.s ! ten ++ "og" ++ e.s ! neuter} ; size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = table {_ => omitsg (d.s ! neuter) d.size ++ "hundrað" } ; size = pl} ; +lin pot2plus d e = {s = table {f => omitsg (d.s ! neuter) d.size ++ "hundrað" ++ (maybeog) e.size ++ e.s ! f} ; size = pl} ; + +lin pot2as3 n = {s = n.s ! com } ; +lin pot3 n = {s = omitsg (n.s ! neut) n.size ++ "Þúsund"} ; +lin pot3plus n m = {s = omitsg (n.s ! neut) n.size ++ "Þúsund" ++ (maybeog m.size) ++ m.s ! com} ; + + +oper maybeog : Size -> Str = \sz -> table {pl => [] ; _ => "og" } ! sz ; +oper omitsg : Str -> Size -> Str = \s -> \sz -> table {sg => [] ; _ => s } ! sz ; \ No newline at end of file diff --git a/examples/numerals/irish.gf b/examples/numerals/irish.gf new file mode 100644 index 000000000..71e44a783 --- /dev/null +++ b/examples/numerals/irish.gf @@ -0,0 +1,79 @@ +include numerals.Abs.gf ; + +-- Not the archaic base-10 system fiche, triocha, daichead, caoga, seasca, seachtó, ochtó, nócha +-- scór can be used in place of fiche but is not implemented (since it's much less preferred) + +oper LinDigit = {s : DForm => Str ; even20 : Even20 ; size : Size} ; +oper mk20Ten : Str -> Str -> Size -> LinDigit = + \tri -> \fiche -> \thesize -> + { s = table {unit => tri ; twenty => fiche ; teen => tri ++ "déag" ; attrib => tri} ; even20 = ten ; size = thesize} ; + +oper mkEven20 : Str -> Str -> Size -> LinDigit = + \se -> \trifichid -> \thesize -> + { s = table {unit => se ; twenty => trifichid ; teen => se ++ "déag" ; attrib => se} ; even20 = even ; size = thesize} ; + +param HForm = attr | indep ; +param Even20 = ten | even ; +param DForm = unit | twenty | teen | attrib ; +param Size = sg | onetosix | seventonine | tenover | eventen ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : HForm => Str ; size : Size} ; +lincat Sub1000 = {s : HForm => Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = table {unit => "dó" ; twenty => "fiche" ; attrib => "dhá" ; teen => "dó" ++ "dhéag" } ; even20 = even ; size = onetosix } ; +lin n3 = mk20Ten "trí" "fiche" onetosix ; +lin n4 = + {s = table {unit => "ceathair" ; twenty => "dhá" ++ "fhichead" ; teen => "dó" ++ "dhéag" ; attrib => "ceithre" } ; even20 = even ; size = onetosix} ; +lin n5 = mk20Ten "cúig" ("dhá" ++ "fhichead") onetosix ; +lin n6 = mkEven20 "sé" ("trí" ++ "fichid") onetosix ; +lin n7 = mk20Ten "seacht" ("trí" ++ "fichid") seventonine ; +lin n8 = mkEven20 "hocht" ("cheithre" ++ "fichid") seventonine ; +lin n9 = mk20Ten "naoi" ("cheithre" ++ "fichid") seventonine ; + +lin pot01 = + {s = table {unit => "haon" ; attrib => [] ; _ => "dummy"} ; even20 = ten ; size = sg}; +lin pot0 d = + {s = d.s ; even20 = d.even20 ; size = d.size} ; +lin pot110 = + {s = table {attr => "deich" ; indep => "a" ++ "deich"} ; size = tenover} ; +lin pot111 = + {s = table {attr => "haon" ++ "déag" ; indep => "a" ++ "haon" ++ "déag"} ; size = tenover} ; +lin pot1to19 d = + {s = table {attr => d.s ! teen ; indep => "a" ++ d.s ! teen } ; size = tenover} ; +lin pot0as1 n = + {s = table {attr => n.s ! attrib ; indep => "a" ++ n.s ! unit} ; size = n.size} ; +lin pot1 d = + {s = table {attr => d.s ! twenty ++ AddDeich ! (d.even20) ; + indep => d.s ! twenty ++ AddADeich ! (d.even20)} ; + size = eventen} ; +lin pot1plus d e = + {s = table {attr => (d.s ! twenty) ++ e.s ! unit ++ + table {ten => "déag" ; _ => []} ! (d.even20) ; + indep => (d.s ! twenty) ++ "a" ++ e.s ! unit ++ + table {ten => "déag" ; _ => []} ! (d.even20)} ; + size = e.size} ; +lin pot1as2 n = + {s = table {attr => n.s ! attr ; indep => n.s ! indep} ; size = n.size} ; +lin pot2 d = + {s = table {_ => d.s ! attrib ++ EclipseLeniteCead ! d.size} ; size = tenover} ; +lin pot2plus d e = + {s = table {_ => d.s ! attrib ++ EclipseLeniteCead ! d.size ++ AddIs ! e.size ++ e.s ! indep} ; size = e.size} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = n.s ! attr ++ LeniteMile ! n.size} ; +lin pot3plus n m = + {s = n.s ! attr ++ LeniteMile ! n.size ++ m.s ! indep} ; + +oper AddDeich : Even20 => Str = table {ten => "deich" ; _ => []} ; +oper AddADeich : Even20 => Str = table {ten => "a" ++ "deich" ; _ => []} ; +oper AddIs : Size => Str = table {eventen => "is" ; _ => []} ; +oper EclipseLeniteCead : Size => Str = table {onetosix => "chead" ; seventonine => "gcéad" ; _ => "céad" } ; +oper LeniteMile : Size => Str = table {onetosix => "mhíle" ; _ => "míle" } ; + diff --git a/examples/numerals/irula.gf b/examples/numerals/irula.gf new file mode 100644 index 000000000..22b299193 --- /dev/null +++ b/examples/numerals/irula.gf @@ -0,0 +1,74 @@ +-- Irula +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +oper + vowel : Strs = strs {"o" ; "e" ; "a" ; "i" ; "u" ; "ä" ; "ö"} ; + cons : Strs = + strs {"b" ; "g" ; "d" ; "p" ; "t" ; "k" ; "l" ; "r" ; "m" ; "n" ; "s" ; "c"}; + oper adu : Str = "a" + pre {"du" ; "tt" / vowel} ; + oper uru : Str = "u:" + pre {"r_u" ; "tti" / cons ; "tt"/ vowel} ; + laks : Str = "lacca" + T ; + ayira : Str = "a:yira" + T ; + cavira : Str = variants {ayira ; "ca:vira" + T} ; + + T : Str = pre {[] ; "tt" / vowel ; "tti" / cons} ; + U : Str = pre {"u" ; [] / vowel } ;-- ; "ï" / cons} ; + +oper LinDigit = {s : DForm => Str }; +oper LinS100 = {s : Place => Str }; + +param DForm = unit | ten | teen | hund | thou | thou2; +param Place = p | lak ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO + +oper mkN : Str -> Str -> Str -> Str -> Str -> LinDigit = + \u -> \tn -> \t -> \h -> \a -> + {s = table {unit => u ; teen => tn ; ten => t+adu ; hund => h+uru ; thou => a+ayira ; thou2 => a+ayira} }; + +lin n2 = mkN (variants {"ren.d.u" ; "ran.d.u"}) ("pannen.d."+U) "iruv" "eran" "ren.d." ; +lin n3 = mkN "mu:nr_u" ("padimu:nr_"+U) "mupp" "munn" "mu:nr_" ; +lin n4 = mkN "nä:lu" ("padanä:l"+U) "na:pp" "nä:n" "nä:l" ; +lin n5 = mkN (variants {"anju" ; "anji"}) ("padananj"+U) "amb" "ayin" "anj" ; +lin n6 = mkN "a:ru" ("padana:r_"+U) "ar_uv" "ar_a" "a:r_" ; +lin n7 = mkN "e:l.u" ("padane:l."+U) "el.uv" "el.a" "e:l." ; +lin n8 = mkN "et.t.u" ("padanet.t."+U) "emb" "et.t.un" "et.t." ; +lin n9 = {s = table {unit => "ombadu" ; teen => "pattombad"+U ; + ten => "ton.n."+uru ; hund => "tol.l."+ayira ; + thou => "ombadan" + ayira ; thou2 => "ombadan" + ayira }}; + +oper ss : Str -> LinS100 = \s1 -> {s = table {p => s1 ; lak => bind s1 cavira }} ; + +lin pot01 = + {s = table {unit => pre {[] ; "önr_u" / strs {[]}} ; + thou => cavira ; + thou2 => "or" + ayira ; + hund => "n" + uru ; + _ => "dummy"} }; +lin pot0 d = d ; +lin pot110 = ss ("patt"+U) ; +lin pot111 = ss ("padanon.n."+U) ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = table {p => n.s ! unit ; lak => n.s ! thou } }; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = + {s = table {p => bind (d.s ! ten) (e.s ! unit) ; + lak => bind (d.s ! ten) (e.s ! thou2)}} ; +lin pot1as2 n = n ; +lin pot2 d = + {s = table {p => d.s ! hund ; lak => bind (d.s ! unit) laks }}; +lin pot2plus d e = + {s = table {p => bind (d.s ! hund) (e.s ! p) ; + lak => bind (bind (d.s ! unit) laks) (e.s ! lak)}} ; +lin pot2as3 n = {s = n.s ! p} ; +lin pot3 n = {s = n.s ! lak } ; +lin pot3plus n m = {s = bind (n.s ! lak) (m.s ! p) } ; diff --git a/examples/numerals/italian.gf b/examples/numerals/italian.gf new file mode 100644 index 000000000..29e15cd7b --- /dev/null +++ b/examples/numerals/italian.gf @@ -0,0 +1,45 @@ +include numerals.Abs.gf ; + +param DForm = ental Pred | ton | tiotal ; +param Num = sg | pl ; +param Pred = pred | indip ; + +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm => Str ; n : Num} ; +lincat Sub100 = {s : Str ; n : Num} ; +lincat Sub1000 = {s : Str ; n : Num} ; +lincat Sub1000000 = {s : Str} ; + +oper mkTal : Str -> Str -> Str -> Lin Digit = + \två -> \tolv -> \tjugo -> + {s = table {ental _ => två ; ton => tolv ; tiotal => tjugo}} ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; +oper spl : Str -> {s : Str ; n : Num} = \s -> {s = s ; n = pl} ; +oper mille : Num => Str = table {sg => "mille" ; pl => "mila"} ; + +lin num x = x ; + +lin n2 = mkTal "due" "dodici" "venti" ; +lin n3 = mkTal "tre" "tredici" "trenta" ; +lin n4 = mkTal "quattro" "quattordici" "quaranta" ; +lin n5 = mkTal "cinque" "quindici" "cinquanta" ; +lin n6 = mkTal "sei" "sedici" "sessanta" ; +lin n7 = mkTal "sette" "diciassette" "settanta" ; +lin n8 = mkTal "otto" "diciotto" "ottanta" ; +lin n9 = mkTal "nove" "diciannove" "novanta" ; + +lin pot01 = {s = table {ental pred => [] ; _ => "uno"} ; n = sg} ; +lin pot0 d = {s = table {f => d.s ! f} ; n = pl} ; +lin pot110 = spl "dieci" ; +lin pot111 = spl "undici" ; +lin pot1to19 d = spl (d.s ! ton) ; +lin pot0as1 n = {s = n.s ! ental indip ; n = n.n} ; +lin pot1 d = spl (d.s ! tiotal) ; +lin pot1plus d e = spl (d.s ! tiotal ++ e.s ! ental indip) ; +lin pot1as2 n = {s = n.s ; n = n.n} ; +lin pot2 d = spl (d.s ! ental pred ++ "cento") ; +lin pot2plus d e = spl (d.s ! ental pred ++ "cento" ++ e.s) ; +lin pot2as3 n = {s = n.s ; n = n.n} ; +lin pot3 n = ss (n.s ++ mille ! n.n) ; +lin pot3plus n m = ss (n.s ++ mille ! n.n ++ m.s) ; + diff --git a/examples/numerals/japanese.gf b/examples/numerals/japanese.gf new file mode 100644 index 000000000..6cd55a576 --- /dev/null +++ b/examples/numerals/japanese.gf @@ -0,0 +1,59 @@ +include numerals.Abs.gf ; + +param DForm = unit | attr | ten | hundred | thousand ; +param Size = sg | pl | more10 ; +param S100 = tenp | senp ; +param S1000 = indep | man | sen; + +-- Standard Romajii +-- Everything should be glued + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : S100 => Str; size : Size} ; +lincat Sub1000 = {s : S1000 => Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/J" ++ x0.s ++ "J/"} ; + +oper mkNum : Str -> LinDigit = \base -> + {s = table {unit => base ; attr => base ; ten => base + "juu" ; hundred => base + "hyaku" ; thousand => base + "sen" } ; size = pl} ; + +oper mkNum4 : Str -> Str -> Str -> Str -> LinDigit = \ni -> \base -> \nihyaku -> \nisen -> + {s = table {unit => ni ; attr => base ; ten => base + "juu" ; hundred => nihyaku ; thousand => nisen } ; size = pl} ; + +oper mkNum2 : Str -> Str -> LinDigit = \yon -> \base -> + {s = table {unit => yon ; attr => base ; ten => base + "juu" ; hundred => base + "hyaku" ; thousand => base + "sen" } ; size = pl} ; + +-- lin n1 = mkNum "ichi" ; +lin n2 = mkNum "ni" ; +lin n3 = mkNum4 "san" "san" "sanbyaku" "sanzen" ; +lin n4 = mkNum2 (variants { "shi" ; "yon" }) "yon" ; +lin n5 = mkNum "go" ; +lin n6 = mkNum4 "roku" "roku" "roppyaku" "rokusen" ; +lin n7 = mkNum2 (variants {"nana" ; "shichi" }) "nana" ; +lin n8 = mkNum4 "hachi" "hachi" "happyaku" "hassen" ; +lin n9 = mkNum2 (variants {"kyuu" ; "ku" }) "kyuu" ; + +lin pot01 = + {s = table {unit => "ichi" ; attr => [] ; ten => "juu" ; hundred => "hyaku" ; thousand => "sen"} ; size = sg }; +lin pot0 d = d ; +lin pot110 = {s = "juu" ; s2 = table {tenp => "ichi" + "man" ; senp => []} ; size = more10} ; +lin pot111 = {s = "juu" + "ichi" ; s2 = table {tenp => "ichi" + "man" ; senp => "sen"} ; size = more10} ; +lin pot1to19 d = {s = "juu" ++ d.s ! unit ; s2 = table {tenp => "ichi" + "man" ; senp => d.s ! thousand} ; size = more10} ; +lin pot0as1 n = {s = n.s ! unit ; s2 = table {tenp => [] ; senp => n.s ! thousand} ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; s2 = table {tenp => d.s ! unit ++ "man" ; senp => []} ; size = more10} ; +lin pot1plus d e = + {s = d.s ! ten ++ e.s ! unit ; + s2 = table {tenp => d.s ! unit ++ "man" ; senp => e.s ! thousand} ; + size = more10} ; + +lin pot1as2 n = {s = table {indep => n.s ; man => n.s2 ! tenp ++ n.s2 ! senp ; sen => n.s2 ! senp} ; size = n.size} ; +lin pot2 d = {s = table {indep => d.s ! hundred ; man => d.s ! ten ++ "man" ; sen => "dummy"} ; size = more10 }; +lin pot2plus d e = {s = table {indep => d.s ! hundred ++ e.s ; man => d.s ! ten ++ e.s2 ! tenp ++ e.s2 ! senp ; sen => "dummy" } ; size = more10 }; +lin pot2as3 n = {s = n.s ! indep } ; +lin pot3 n = {s = table {more10 => n.s ! man ; _ => n.s ! sen} ! n.size} ; +lin pot3plus n m = {s = table {more10 => n.s ! man ; _ => n.s ! sen} ! n.size ++ m.s ! indep} ; + diff --git a/examples/numerals/kabardian.gf b/examples/numerals/kabardian.gf new file mode 100644 index 000000000..e6716ca93 --- /dev/null +++ b/examples/numerals/kabardian.gf @@ -0,0 +1,79 @@ +-- Kabardian + +-- W is superscript w (= IPA labialisation) +-- & is schwa upside down e +-- s' +-- L is lambda +-- L is lambda with dash across +-- x^ is x with ^ ontop +-- G is gamma + +include numerals.Abs.gf ; + +param DForm = unit | unite | unitra | teen | ten | tenra | hund | thou; + +oper LinDigit = {s : DForm => Str }; +oper LinS100 = {s : Str; s2 : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; + +oper mkNum : Str -> LinDigit = \dwa -> + {s = table {unit => dwa ; unite => dwa + "&" ; unitra => dwa + "&ra" ; + ten => dwa + "&s'" ; tenra => dwa + "&s'ra" ; + teen => "p's''&" + "k'W&" + dwa ; + hund => "s'a" + "&y" + dwa ; + thou => variants {"m&yn"+"&y"+dwa ; dwa+"a"+"s''a"++"m&yn"}}}; + +oper mkNum2 : Str -> LinDigit = \dwa -> + {s = table {unit => dwa ; unite => dwa + "&" ; unitra => dwa + "&ra" ; + ten => dwa + "as'" ; tenra => dwa + "as'ra" ; + teen => "p's''&"+"k'W&"+"t'" ; + hund => "s'a" + "&y" + "t'" ; + thou => variants {"m&yn"+"&y"+"t'" ; dwa+"a"+"s''a"++"m&yn"}}}; + +oper mkNum3 : Str -> LinDigit = \dwa -> + {s = table {unit => dwa ; unite => dwa + "&" ; unitra => dwa + "&ra" ; + ten => dwa + "as'" ; tenra => dwa + "as'ra" ; + teen => "p's''&"+"k'W&"+dwa ; + hund => "s'a" + "&y" + dwa ; + thou => variants {"m&yn"+"&y"+dwa ; dwa+"a"+"s''a"++"m&yn"}}}; + +lin num x = {s = x.s } ; -- TODO ; + +lin n2 = mkNum2 "t'?W" ; +lin n3 = mkNum3 "s'" ; +lin n4 = mkNum "p'L-'" ; +lin n5 = mkNum "tx^W" ; +lin n6 = mkNum "x^"; +lin n7 = mkNum "bL" ; +lin n8 = mkNum "y" ; +lin n9 = mkNum "bGW" ; + +oper bind : Str -> Str -> Str = \s1 -> \s2 -> s1 ++ s2 ; + +lin pot01 = + {s = table {unit => "z" ; unite => "z&" ; unitra => "z&" + "ra" ; + teen => "p's''&"+"k'W&"+"z" ; ten => "dummy" ; tenra => "dummy" ; + hund => "s'a" ; thou => "m&yn"}}; + +oper ss : Str -> LinS100 = \f -> + {s = f ; s2 = variants {("m&yn"+"&y") ++ f ; (bind f "as'a") ++ "m&yn"}}; + +lin pot0 d = d ; +lin pot110 = + {s = "p's''&" ; + s2 = variants {"m&yn"+"&y"+"p's''" ; "p's''"+"a"+"s''a"++"m&yn"}}; +lin pot111 = ss ("p's''&"+"k'W&"+"z") ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = n.s ! unite ; s2 = n.s ! thou } ; +lin pot1 d = ss (variants {(d.s ! ten) ; (d.s ! unite) ++ "p's''&wa"}) ; + -- extra variant p's''ay = 80 +lin pot1plus d e = ss ((d.s ! tenra) ++ (e.s ! unitra)) ; +lin pot1as2 n = n ; +lin pot2 d = ss (d.s ! hund) ; +lin pot2plus d e = ss ((d.s ! hund) ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = n.s2} ; +lin pot3plus n m = {s = n.s2 ++ m.s} ; diff --git a/examples/numerals/kambera.gf b/examples/numerals/kambera.gf new file mode 100644 index 000000000..c42921b19 --- /dev/null +++ b/examples/numerals/kambera.gf @@ -0,0 +1,47 @@ +include numerals.Abs.gf ; + +param Size = sg | two | pl ; + +oper Form = {s : Str ; size : Size} ; + +lincat Digit = Form ; +lincat Sub10 = Form ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; + +oper mkNum : Str -> Form = \two -> + {s = two ; size = pl} ; + +lin num x = x ; +-- lin n1 mkNum "diha" ; +lin n2 = {s = "dua" ; size = two} ; +lin n3 = mkNum "tailu" ; +lin n4 = mkNum "patu" ; +lin n5 = mkNum "lima" ; +lin n6 = mkNum "nomu" ; +lin n7 = mkNum "pitu" ; +lin n8 = mkNum "walu" ; +lin n9 = mkNum "hiwa" ; + +oper ss : Str -> {s : Str ; size : Size} = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = {s = "diha" ; size = sg} ; +lin pot0 d = d ; +lin pot110 = ss "hakambulu" ; +lin pot111 = ss ("hakambulu" ++ "hau") ; +lin pot1to19 d = ss ("hakambulu" ++ (if12 d.size d.s)) ; +lin pot0as1 n = n ; +lin pot1 d = ss (d.s ++ "kambulu" ) ; +lin pot1plus d e = ss (d.s ++ "kambulu" ++ (if12 e.size e.s)) ; +lin pot1as2 n = n ; +lin pot2 d = ss (selsg d.size "hangahu" (d.s ++ "ngahu")) ; +lin pot2plus d e = ss (selsg d.size "hangahu" (d.s ++ "ngahu") ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = (selsg n.size "hariu" (n.s ++ "riu"))} ; +lin pot3plus n m = {s = (selsg n.size "hariu" (n.s ++ "riu")) ++ m.s } ; + +oper if12 : Size -> Str -> Str = \sz -> \a -> + table {sg => "hau" ; two => "dambu" ; _ => a} ! sz ; +oper selsg : Size -> Str -> Str -> Str = \sz -> \a -> \b -> + table {sg => a ; _ => b} ! sz ; + diff --git a/examples/numerals/kawaiisu.gf b/examples/numerals/kawaiisu.gf new file mode 100644 index 000000000..5e45a4eb6 --- /dev/null +++ b/examples/numerals/kawaiisu.gf @@ -0,0 +1,41 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; +oper na : {s : Str } = {s = "N/A" } ; + +oper LinDigit = {s : Str ; s2 : Str ; s3 : Str} ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO + +oper mkNum : Str -> LinDigit = \s1 -> {s = s1 ; s2 = s1 + "yu" ; s3 = s1 + "suu"} ; +oper mkNum2 : Str -> LinDigit = \s1 -> {s = s1 ; s2 = s1 + "yu" ; s3 = s1 + "cuu"} ; +lin n2 = mkNum "waha" ; +lin n3 = mkNum "pehe" ; +lin n4 = mkNum "wacuu" ; +lin n5 = mkNum2 "mani-gi" ; +lin n6 = mkNum2 "navaha" ; +lin n7 = {s = "no?mi-zi" ; s2 = "no?mi-zi" ; s3 = "no?mi-zicuu" }; +lin n8 = {s = "nanawacuu" ; s2 = "nanawacuu"; s3 = "nanawacuucuu" }; +lin n9 = mkNum2 "sukumi-su" ; + +lin pot01 = mkNum "suu" ; +lin pot0 d = d ; +lin pot110 = {s = "mi-mi-suuyu" } ; +lin pot111 = {s = "mi-mi-susuuyu" } ; +lin pot1to19 d = {s = bind "mi-mi-susuu" d.s2 } ; +lin pot0as1 n = {s = n.s } ; +lin pot1 d = {s = bind d.s3 "yu"} ; +lin pot1plus d e = {s = bind d.s3 e.s2 } ; +lin pot1as2 n = n ; +lin pot2 d = na ; +lin pot2plus d e = na ; +lin pot2as3 n = n ; +lin pot3 n = na ; +lin pot3plus n m = na ; diff --git a/examples/numerals/khmer.gf b/examples/numerals/khmer.gf new file mode 100644 index 000000000..7c4fb1051 --- /dev/null +++ b/examples/numerals/khmer.gf @@ -0,0 +1,50 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten ; +param Size = sg | pl ; + +oper LinDigit = {s : DForm => Str ; size : Size} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; + +oper mkNum : Str -> Str -> LinDigit = \u -> \t -> {s = table {unit => u ; ten => t} ; size = pl} ; + +lin n2 = mkNum "bi:ra" "mbhai" ; +lin n3 = mkNum "pi:" ("sa:ma" ++ "sipa") ; +lin n4 = mkNum "pwna" ("se:" ++ "sipa") ; +lin n5 = mkNum "pra:m." ("ha:" ++ "sipa") ; +lin n6 = mkNum ("pra:m." ++ "mwya") ("huka" ++ "sipa") ; +lin n7 = mkNum ("pra:m." ++ "bi:ra") ("cita" ++ "sipa") ; +lin n8 = mkNum ("pra:m." ++ "pi:") ("pe:ta" ++ "sipa") ; +lin n9 = mkNum ("pra:m." ++ "pwna") ("kau" ++ "sipa") ; + +oper bana : Str = variants {"mwya" ++ "ba:'na" ; "mpa:'na"} ; + +lin num x = {s = "/X" ++ x.s ++ "X/"} ; -- for the diacritics + +lin pot01 = {s = table { _ => "mwya" } ; size = sg } ; +lin pot0 d = d ; +lin pot110 = {s = "t.a'pa" ; s2 = "hmi-na" ; size = pl} ; +lin pot111 = {s = "mwya" ++ "t.an.ta'pa" ; s2 = "hmi-na" ++ bana; size = pl} ; +lin pot1to19 d = {s = (d.s ! unit) ++ "t.an.ta'pa" ; s2 = "hmi-na" ++ (d.s ! unit) ++ "ba:'na" ; size = pl } ; +lin pot0as1 n = {s = n.s ! unit ; s2 = xsg n.size bana (n.s ! unit ++ "ba:'na") ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; s2 = d.s ! unit ++ "hmi-na" ; size = pl} ; +lin pot1plus d e = {s = d.s ! ten ++ e.s ! unit ; s2 = d.s ! unit ++ "hmi-na" ++ xsg e.size bana (e.s ! unit ++ "ba:'na") ; size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = xsg d.size (variants {"raya" ; "mraya"}) (d.s ! unit ++ "raya") ; + s2 = (d.s ! unit) ++ "se:na" ; + size = pl } ; +lin pot2plus d e = {s = xsg d.size (variants {"raya" ; "mraya"}) (d.s ! unit ++ "raya") ++ e.s ; + s2 = (d.s ! unit) ++ "se:na" ++ e.s2 ; + size = pl} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = n.s2 } ; +lin pot3plus n m = {s = n.s2 ++ m.s } ; + +oper xsg : Size -> Str -> Str -> Str = \sz -> \s1 -> \s2 -> table {sg => s1 ; _ => s2} ! sz ; + + + diff --git a/examples/numerals/khowar.gf b/examples/numerals/khowar.gf new file mode 100644 index 000000000..7bb890a75 --- /dev/null +++ b/examples/numerals/khowar.gf @@ -0,0 +1,57 @@ +include numerals.Abs.gf ; + +-- 2 has a non-general variant "joowáloo" ; + +param DForm = unit | ten S100 | teen ; +param Size = sg | pl | more100; +param Par20 = even | odd ; +param S100 = attr | preceded ; +param S1000 = indep | dep | lakh ; + +oper LinDigit = {s : DForm => Str ; size : Size ; par20 : Par20} ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : S100 => Str ; size : Size} ; +lincat Sub1000 = {s : S1000 => Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/L" ++ x0.s ++ "L/"} ; -- Latin A Supplement + +oper mkNum : Str -> Str -> Par20 -> LinDigit = \s -> \tw -> \p20 -> + {s = table {unit => s ; teen => "jo.sh" + "-" + s ; ten _ => tw ++ "bîsher"} ; size = pl ; par20 = p20} ; + +-- lin n1 = mkNum variants {"î" ; "îwáloo"} ; +lin n2 = + {s = table {unit => "joo" ; teen => "jo.sh" + "-" + "joo" ; ten attr => "bîsher" ; ten preceded => "î" ++ "bîsher" } ; size = pl ; par20 = even }; +lin n3 = + {s = table {unit => "troi" ; teen => "jo.sh" + "-" + "troi" ; ten attr => "bîsher" ; ten preceded => "î" ++ "bîsher" } ; size = pl ; par20 = odd }; +lin n4 = mkNum "cho.r" "joo" even ; +lin n5 = mkNum "po.nj" "joo" odd ; +lin n6 = mkNum "chöi" "troi" even ; +lin n7 = mkNum "so.t" "troi" odd ; +lin n8 = mkNum "o.sht" "chöi" even ; +lin n9 = mkNum "nyun" "chöi" odd ; + +lin pot01 = + {s = table {unit => "î" ; _ => "dummy" } ; size = sg ; par20 = odd}; +lin pot0 d = d ; +lin pot110 = {s = table {_ => "jo.sh" } ; size = pl} ; +lin pot111 = {s = table {_ => "jo.sh" + "-" + "î" } ; size = pl} ; +lin pot1to19 d = {s = table {_ => d.s ! teen }; size = pl} ; +lin pot0as1 n = {s = table {_ => n.s ! unit } ; size = n.size} ; +lin pot1 d = {s = table {f => table {even => d.s ! ten f ; odd => d.s ! ten f ++ "jo.sh" } ! d.par20 } ; size = pl} ; +lin pot1plus d e = {s = table {f => table {even => d.s ! ten f ++ e.s ! unit ; odd => d.s ! ten f ++ e.s ! teen } ! d.par20 }; size = pl} ; +lin pot1as2 n = {s = table {indep => n.s ! attr ; dep => n.s ! preceded ; lakh => "dummy"} ; size = n.size} ; +lin pot2 d = + {s = table {lakh => table {sg => "lakh" ; _ => d.s ! unit ++ "lakh"} ! d.size ; + _ => table {sg => "sho.r" ; _ => d.s ! unit ++ "sho.r" } ! d.size } ; + size = more100 }; +lin pot2plus d e = + {s = table {lakh => table {sg => "lakh" ; _ => d.s ! unit ++ "lakh"} ! d.size ++ table {sg => [] ; _ => e.s ! preceded } ! e.size ++ "hazâr" ; + _ => table {sg => "sho.r" ; _ => d.s ! unit ++ "sho.r" } ! d.size ++ "oché" ++ e.s ! preceded } ; + size = more100} ; +lin pot2as3 n = {s = table {sg => [] ++ variants {"î" ; "îwáloo"} ; _ => n.s ! indep} ! n.size } ; +lin pot3 n = {s = table {pl => n.s ! indep ++ "hazâr" ; sg => "hazâr" ; more100 => n.s ! lakh} ! n.size} ; +lin pot3plus n m = {s = table {pl => n.s ! indep ++ "hazâr" ; sg => "hazâr" ; more100 => n.s ! lakh} ! n.size ++ m.s ! dep} ; diff --git a/examples/numerals/kodagu.gf b/examples/numerals/kodagu.gf new file mode 100644 index 000000000..33d80ae35 --- /dev/null +++ b/examples/numerals/kodagu.gf @@ -0,0 +1,71 @@ +-- Kodagu +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +oper + vowel : Strs = strs {"o" ; "e" ; "a" ; "i" ; "u" ; "ï" ; "ë"} ; + cons : Strs = + strs {"b" ; "g" ; "d" ; "p" ; "t" ; "k" ; "l" ; "r" ; "m" ; "n" ; "s" ; "ñ"} ; + + oper adi : Str = "a" + pre {"dï" ; "tt" / vowel} ; + oper uri : Str = "u:" + pre {"rï" ; "yt.a" / cons ; "yt."/ vowel} ; + laks : Str = "laks.a" + T ; + ayra : Str = "a:yra" + T ; + + T : Str = pre {[] ; "t" / vowel ; "t" / cons} ; + I : Str = pre {"ï" ; [] / vowel } ;-- ; "ï" / cons} ; + +oper LinDigit = {s : DForm => Str }; +oper LinS100 = {s : Place => Str }; + +param DForm = unit | ten | teen | hund | thou; +param Place = p | lak ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO + +oper mkN : Str -> Str -> Str -> Str -> Str -> LinDigit = + \u -> \tn -> \t -> \h -> \a -> + {s = table {unit => u ; teen => tn ; ten => t+adi ; hund => h+uri ; thou => a+ayra} }; + +lin n2 = mkN "dan.d.ï" ("panneran.d."+I) "iruv" "inn" "i:r" ; +lin n3 = mkN "mu:ndï" ("padïmu:nd"+I) "nupp" "mu:n" "mu:v" ; +lin n4 = mkN "na:lï" ("padïna:l"+I) "na:p" "na:n" "na:l" ; +lin n5 = mkN "an~ji" "padïnan~ji" "aymb" "aññ" "ay" ; +lin n6 = mkN "a:rï" ("padïna:r"+I) "arup" "a:rïn" "a:r" ; +lin n7 = mkN "ë:lï" ("padïnë:l"+I) "ël.up" "ë:l.n" "ë:l." ; +lin n8 = mkN "ët.t.ï" ("padïnët.t."+I) "ëmb" "et.n" "et.t." ; +lin n9 = mkN "oymbadï" ("pattoymbad"+I) "tomb" "oymbayn" "oymbad" ; + +oper ss : Str -> LinS100 = \s1 -> {s = table {p => s1 ; lak => bind s1 ayra }} ; + +lin pot01 = + {s = table {unit => pre {[] ; "ondï" / strs {[]}} ; + thou => variants {ayra ; "o:r" + ayra} ; + hund => "n" + uri ; + _ => "dummy"} }; +lin pot0 d = d ; +lin pot110 = ss ("patt"+I) ; +lin pot111 = ss ("pannond"+I) ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = table {p => n.s ! unit ; lak => n.s ! thou } }; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = + {s = table {p => bind (d.s ! ten) (e.s ! unit) ; + lak => bind (d.s ! ten) (e.s ! thou)}} ; +lin pot1as2 n = n ; +lin pot2 d = + {s = table {p => d.s ! hund ; lak => bind (d.s ! unit) laks }}; +lin pot2plus d e = + {s = table {p => bind (d.s ! hund) (e.s ! p) ; + lak => bind (bind (d.s ! unit) laks) (e.s ! lak)}} ; +lin pot2as3 n = {s = n.s ! p} ; +lin pot3 n = {s = n.s ! lak } ; +lin pot3plus n m = {s = bind (n.s ! lak) (m.s ! p) } ; diff --git a/examples/numerals/kolyma_yukaghir.gf b/examples/numerals/kolyma_yukaghir.gf new file mode 100644 index 000000000..b7cade9af --- /dev/null +++ b/examples/numerals/kolyma_yukaghir.gf @@ -0,0 +1,45 @@ +include numerals.Abs.gf ; + +oper na = {s = "N/A" }; + +param DForm = u | teen ; + +oper LinDigit = {s : DForm => Str } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +oper mkNum : Str -> LinDigit = \a -> + {s = table {u => a ; teen => "kun'il" ++ a ++ "budie"}} ; +oper mkNum2 : Str -> Str -> LinDigit = \a -> \b -> + {s = table {u => a ; teen => b ++ "budie"}} ; + +lin num x = x ; +-- lin n1 mkNum "irkin" ; +lin n2 = mkNum2 "ataqun" ("kun" ++ "ataqun") ; +lin n3 = mkNum2 "ja:n" ("kun'il" ++ "ja:l"); +lin n4 = mkNum "ilekun" ; +lin n5 = mkNum "n'ahanbo:d'e" ; +lin n6 = mkNum "malha:n" ; +lin n7 = mkNum "purki:n" ; +lin n8 = mkNum "malhi:lek" ; +lin n9 = mkNum "kunirkil'd'o:j" ; + +lin pot01 = mkNum2 "irkin" ("kun" ++ "irku"); +lin pot0 d = d ; +lin pot110 = {s = "kun'in"}; +lin pot111 = {s = ("kun" ++ "irkubudie")} ; +lin pot1to19 d = {s = d.s ! teen} ; +lin pot0as1 n = {s = n.s ! u} ; +lin pot1 d = {s = d.s ! u ++ "kun'el"} ; +lin pot1plus d e = {s = d.s ! u ++ "kun'el" ++ e.s ! u}; +lin pot1as2 n = n ; +lin pot2 d = {s = "kun'in" ++ "kun'in" ++ d.s ! u ++ "budie"} ; +lin pot2plus d e = {s = "kun'in" ++ "kun'in" ++ d.s ! u ++ "budie" ++ e.s } ; +lin pot2as3 n = n ; +lin pot3 n = na ; +lin pot3plus n m = na ; diff --git a/examples/numerals/korean.gf b/examples/numerals/korean.gf new file mode 100644 index 000000000..fa804ed58 --- /dev/null +++ b/examples/numerals/korean.gf @@ -0,0 +1,109 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten | tenq | chi | chiten ; +param Size = sg | twotoeight | nine | exten | more10 ; +param S100 = tenpart | chenpart ; + +-- Korean +-- Sorry, no hangul transliteration + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : S100 => Str; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/L" ++ x0.s ++ "L/" } ; -- just makes colons into length bar ontop of char + +oper mkNumq : Str -> Str -> Str -> Str -> LinDigit = + \twul -> \yelqtwul -> \sumul -> \i -> + {s = table {unit => twul ; teen => yelqtwul ; ten => sumul ; tenq => sumul + "q" ; chi => i ; chiten => i ++ "sip"} ; size = twotoeight} ; + +oper mkNum : Str -> Str -> Str -> Str -> LinDigit = + \twul -> \yelqtwul -> \sumul -> \i -> + {s = table {unit => twul ; teen => yelqtwul ; ten => sumul ; tenq => sumul ; chi => i ; chiten => i ++ "sip"} ; size = twotoeight} ; + +oper mkNum6 : Str -> Str -> Str -> Str -> LinDigit = + \twul -> \yelqtwul -> \sumul -> \i -> + {s = table {unit => twul ; teen => yelqtwul ; ten => sumul ; tenq => sumul + "q" ; chi => i ; chiten => (i + "q") ++ "sip"} ; size = twotoeight} ; + +oper mkNum9 : Str -> Str -> Str -> Str -> LinDigit = + \twul -> \yelqtwul -> \sumul -> \i -> + {s = table {unit => twul ; teen => yelqtwul ; ten => sumul ; tenq => sumul + "q" ; chi => i ; chiten => i ++ "sip"} ; size = nine} ; + +-- lin n1 = mkNum variants{"hana" ; "han } ; variants {"yelhana" ; "yelhan" } +lin n2 = mkNumq (variants {"twu:l" ; "twu" }) + (variants {"yelqtwul" ; "yelqtwu" }) + (variants {"sumul" ; "sumu" }) + "i:" ; +lin n3 = mkNum (variants {"se:ys" ; "se:y" ; "se:k" ; "se:" }) + (variants {"yelqseys" ; "yelqsey" ; "yelqsek" ; "yelqse" }) + (variants {"seun" ; "sehun" }) + "sam" ; +lin n4 = mkNum (variants {"ne:ys" ; "ne:y" ; "ne:k" ; "ne:" }) + (variants {"yelneys" ; "yelney" ; "yelnek" ; "yelne" }) + "mahun" "sa:" ; +lin n5 = mkNum "tases" "yelqtases" "swi:n" "o:"; +lin n6 = mkNum6 "yeses" (variants {"yelqyeses" ; "yelyeses"}) "yeyswun" "yuk" ; +lin n7 = mkNum6 "ilkop" (variants {"yelqilkop" ; "yelilkop"}) "ilhun" "chil" ; +lin n8 = mkNum6 "yetel" (variants {"yelqyetel" ; "yelyetel"}) "yetun" "phal" ; +lin n9 = mkNum9 "ahop" "yelahop" "ahun" "kwu" ; + +lin pot01 = + {s = table {unit => variants {"hana" ; "han"} ; + ten => variants {"yel" ; "yelq"} ; + tenq => "dummy" ; + teen => variants {"yelhana" ; "yelhan" } ; + chi => "il" ; chiten => "sip"} ; + size = sg }; +lin pot0 d = d ; +lin pot110 = {s = variants {"yel" ; "yelq"} ; + s2 = table {tenpart => "il" ++ "man" ; + chenpart => [] } ; + size = exten} ; +lin pot111 = {s = variants {"yelhana" ; "yelhan"} ; + s2 = table {tenpart => "il" ++ "man" ; + chenpart => maybeil sg "il" "chen" } ; + size = more10} ; +lin pot1to19 d = {s = d.s ! teen ; + s2 = table {tenpart => "il" ++ "man" ; + chenpart => maybeil d.size (d.s ! chi) "chen" } ; + size = more10} ; +lin pot0as1 n = {s = n.s ! unit ; + s2 = table {tenpart => "man" ; + chenpart => maybeil n.size (n.s ! chi) "chen" } ; + size = n.size} ; +lin pot1 d = {s = d.s ! ten ; + s2 = table {tenpart => d.s ! chi ++ "man" ; + chenpart => [] } ; + size = more10} ; +lin pot1plus d e = + {s = table {twotoeight => d.s ! tenq ; + _ => d.s ! ten } ! e.size ++ e.s ! unit; + s2 = table {tenpart => d.s ! chi ++ "man"; + chenpart => maybeil e.size (e.s ! chi) "chen" } ; + size = more10} ; + +lin pot1as2 n = {s = n.s ; + s2 = table {more10 => n.s2 ! tenpart ; + exten => (variants {"ma:n" ; "il" ++ "man"}) ; + _ => []} ! n.size ++ n.s2 ! chenpart ; + size = n.size} ; +lin pot2 d = + {s = maybeil d.size (d.s ! chi) "payk" ; + s2 = d.s ! chiten ; + size = more10 }; +lin pot2plus d e = + {s = (maybeil d.size (d.s ! chi) "payk") ++ e.s ; + s2 = d.s ! chiten ++ e.s2 ! tenpart ++ e.s2 ! chenpart ; + size = more10 }; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = n.s2 } ; +lin pot3plus n m = {s = n.s2 ++ m.s } ; + +oper maybeil : Size -> Str -> Str -> Str = \sz -> \a -> \chen -> + table {twotoeight => a ++ chen ; sg => variants {chen ; "il" ++ chen } ; _ => a ++ chen} ! sz ; + + diff --git a/examples/numerals/kulung.gf b/examples/numerals/kulung.gf new file mode 100644 index 000000000..f5eda8634 --- /dev/null +++ b/examples/numerals/kulung.gf @@ -0,0 +1,55 @@ +include numerals.Abs.gf ; + +param DForm = basic | belowtenform | tenindep | ten; +param Size = sg | less100 | more100 ; +param Scale = reg | lakh ; + +-- From Krishna Bahadur Rai in Werner Winter: When Numeral Systems are +-- Expanded in Jadranka Gvozdanovic' (ed.) Numeral Types and Changes +-- Worldwide, 1999 + +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Scale => Str ; size : Size} ; + +oper mkNum : Str -> Str -> Str -> Str -> Lin Digit = + \two -> \two2 -> \twenty -> \twenty2 -> + {s = table {basic => two ; belowtenform => two2 ; tenindep => twenty ; ten => twenty2}} ; + +oper mkRegNum : Str -> Lin Digit = + \su -> + { s = table { basic => su ; belowtenform => su + "kci" ; tenindep => su + "kká" ; ten => su + "k"} }; + +lin num x = x ; +-- lin n1 mkNum "i" "ibim" ... ; +lin n2 = mkNum "ni" "nicci" (variants { "nissá" ; "nukká" }) "nuk" ; +lin n3 = mkRegNum "su" ; +lin n4 = mkNum "li" "lici" "likká" "lik" ; +lin n5 = mkNum "ngá" "ngá" "ngakká" "ngak" ; +lin n6 = mkRegNum "tu" ; +lin n7 = mkRegNum "nu" ; +lin n8 = mkRegNum "re" ; +lin n9 = mkNum "vau" "vauci" "vavau" "vavau" ; + +oper ss : Str -> {s : Str ; size : Size} = \s -> {s = s ; size = less100} ; + +lin pot01 = {s = table {f => variants {"i" ; "ibim"}} ; size = sg} ; +lin pot0 d = {s = table {f => d.s ! f} ; size = less100} ; +lin pot110 = ss ( variants { "pau" ; "pauci" }) ; +lin pot111 = ss ("pau" ++ "i") ; +lin pot1to19 d = ss ("pau" ++ d.s ! basic) ; +lin pot0as1 n = {s = variants {n.s ! basic ; n.s ! belowtenform} ; size = n.size} ; +lin pot1 d = {s = d.s ! tenindep ; size = less100} ; +lin pot1plus d e = {s = (d.s ! ten) ++ e.s ! basic ; size = less100} ; +lin pot1as2 n = {s = table {_ => n.s } ; size = n.size} ; +lin pot2 d = {s = table {lakh => omitsg (d.s ! basic) d.size ++ "lankau" ; reg => omitsg (d.s ! basic) d.size ++ "chhum" }; size = more100} ; +lin pot2plus d e = {s = table {lakh => omitsg (d.s ! basic) d.size ++ "lankau" ++ omitsg e.s e.size ++ "habau" ; reg => omitsg (d.s ! basic) d.size ++ "chhum" ++ e.s } ; size = more100} ; + +lin pot2as3 n = {s = n.s ! reg }; +lin pot3 n = {s = mklankau n.size (n.s ! reg) (n.s ! lakh)} ; +lin pot3plus n m = {s = mklankau n.size (n.s ! reg) (n.s ! lakh) ++ m.s ! reg} ; + +oper mklankau : Size -> Str -> Str -> Str = \sz -> \attr -> \lankau -> + table {sg => "habau" ; less100 => attr ++ "habau" ; more100 => lankau} ! sz; +oper omitsg : Str -> Size -> Str = \s -> \sz -> table {sg => [] ; _ => s} ! sz ; \ No newline at end of file diff --git a/examples/numerals/kwami.gf b/examples/numerals/kwami.gf new file mode 100644 index 000000000..cb441f3ee --- /dev/null +++ b/examples/numerals/kwami.gf @@ -0,0 +1,48 @@ +include numerals.Abs.gf ; + +-- D^ is from implosive d IPA symbol +-- N Num + +param Size = sg | two | three | other ; + +oper LinDigit = {s : Str ; size : Size} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinDigit ; +lincat Sub1000 = LinDigit ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> LinDigit = \kunun -> + {s = kunun ; size = other} ; + +lin num x0 = + {s = "/L" ++ x0.s ++ "L/"} ; -- for D^ + +lin n2 = {s = variants {"póllów" ; "fóllów"} ; size = two }; +lin n3 = {s = "kúnún" ; size = three } ; +lin n4 = mkNum (variants {"pòD^òw" ; "fòD^òw"}) ; +lin n5 = mkNum (variants {"páaD^í" ; "fáaD^í"}) ; +lin n6 = mkNum (variants {"páyíndì" ; "fáyíndì"}) ; +lin n7 = mkNum (variants {"pópíllów" ; "fópíllów"}) ; +lin n8 = mkNum (variants {"pówùrD^ów" ; "fówùrD^ów"}) ; +lin n9 = mkNum "làmbáD^à" ; + +oper thirty : Str = variants {("kúu" ++ "kúnún") ; "tàlàatín"} ; +oper two100 : Str = variants {"dálmágí" ++ "póllów" ; "mèetán"} ; +oper thousand : Str = variants {("dálmágí" ++ "kúmó") ; "dùbúk" ; "dúbúk"} ; + +lin pot01 = + {s = "múndí" ; size = sg}; +lin pot0 d = d ; +lin pot110 = mkNum "kúmó" ; +lin pot111 = mkNum ("kúmó" ++ "kán" ++ "múndí") ; +lin pot1to19 d = mkNum ((variants {"kúmó" ++ "kán" ; "tùrò"}) ++ d.s ) ; +lin pot0as1 n = n ; +lin pot1 d = mkNum (table {three => thirty ; _ => "kúu" ++ d.s} ! d.size) ; +lin pot1plus d e = mkNum ((table {three => thirty ; _ => "kúu" ++ d.s} ! d.size) ++ "kán" ++ e.s) ; +lin pot1as2 n = n ; +lin pot2 d = mkNum (table {sg => (variants {"dálmágí" ; "dálmák"}) ; two => two100 ; _ => "dálmágí" ++ d.s } ! d.size) ; +lin pot2plus d e = mkNum ((table {two => two100 ; sg => (variants {"dálmágí" ; "dálmák"}) ; _ => "dálmágí" ++ d.s } ! d.size) ++ "kán" ++ e.s) ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = table {sg => thousand ; _ => "dùbúk" ++ n.s} ! n.size } ; +lin pot3plus n m = {s = table {sg => thousand ; _ => "dùbúk" ++ n.s} ! n.size ++ m.s} ; \ No newline at end of file diff --git a/examples/numerals/kwaza.gf b/examples/numerals/kwaza.gf new file mode 100644 index 000000000..e8ed82487 --- /dev/null +++ b/examples/numerals/kwaza.gf @@ -0,0 +1,37 @@ +include numerals.Abs.gf ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : Str } ; +lincat Sub10 = {s : Str } ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO + +oper na = {s = "N/A" } ; + +lin n2 = {s = "aky'hy~" }; +lin n3 = {s = "e'ma~" }; +lin n4 = {s = "ElE'lE" }; +lin n5 = {s = "bwako'je" }; +lin n6 = na ; +lin n7 = na ; +lin n8 = na ; +lin n9 = na ; + +lin pot01 = + {s = "tei'hy~"}; +lin pot0 d = d ; +lin pot110 = na ; +lin pot111 = na ; +lin pot1to19 d = na ; +lin pot0as1 n = n ; +lin pot1 d = na ; +lin pot1plus d e = na ; +lin pot1as2 n = n ; +lin pot2 d = na ; +lin pot2plus d e = na ; +lin pot2as3 n = n ; +lin pot3 n = na ; +lin pot3plus n m = na ; diff --git a/examples/numerals/lalo.gf b/examples/numerals/lalo.gf new file mode 100644 index 000000000..853ac219a --- /dev/null +++ b/examples/numerals/lalo.gf @@ -0,0 +1,41 @@ +include numerals.Abs.gf ; + +param Zero = yes | nozero ; + +oper LinS100 = {s : Str ; zero : Zero } ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : Str} ; +lincat Sub10 = {s : Str} ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; + +-- TODO encoding + +oper ss : Str -> LinS100 = \s1 -> {s = s1 ; zero = nozero} ; + +lin num x0 = {s = x0.s} ; +lin n2 = {s = "`n."} ; +lin n3 = {s = "sa" } ; +lin n4 = {s = "i"} ; +lin n5 = {s = "Nà" } ; +lin n6 = {s = "khùq" } ; +lin n7 = {s = "x`&" } ; +lin n8 = {s = "hìq" } ; +lin n9 = {s = "kw" } ; +lin pot01 = {s = "tjh`&"} ; +lin pot0 d = d ; +lin pot110 = ss "tjhí" ; +lin pot111 = ss "tjhítì" ; +lin pot1to19 d = ss ("tjhí" ++ d.s) ; +lin pot0as1 n = {s = n.s ; zero = yes } ; +lin pot1 d = ss (d.s ++ "tjhí") ; +lin pot1plus d e = ss (d.s ++ "tjhí" ++ e.s) ; +lin pot1as2 n = {s = n.s ; zero = yes } ; +lin pot2 d = ss (d.s ++ "há") ; +lin pot2plus d e = ss (d.s ++ "há" ++ if0 ! e.zero ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = n.s ++ "t'w" }; +lin pot3plus n m = ss (n.s ++ "t'w" ++ if0 ! m.zero ++ m.s) ; + +oper if0 = table {yes => "ni" ++ "ka" ; nozero => []} ; diff --git a/examples/numerals/lamani.gf b/examples/numerals/lamani.gf new file mode 100644 index 000000000..d295ebaa2 --- /dev/null +++ b/examples/numerals/lamani.gf @@ -0,0 +1,95 @@ +include numerals.Abs.gf ; + +-- the sporadic kam-forms not implemented (general minus formations are hardly possible to implement) + +param DForm = unit | ten | teen | tene | next | inv ; +param Size = sg | two | five | seven | nine | e25 | e75 | e50s | e90s | other ; + +oper LinDigit = {s : DForm => Str ; s2 : Str ; size : Size} ; +oper LinSub100 = {s : Str ; s2 : Str ; s3 : Str ; size : Size} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = {s : Str ; s2 : Str } ; + +lin num x0 = + {s = x0.s } ; + +oper mkNum : Str -> Str -> Str -> Str -> Str -> LinDigit = + \do -> \baara -> \bis -> \nxt -> \inverse -> + {s = table {unit => do ; teen => baara ; ten => bis ; tene => bis + "e" ; next => nxt ; inv => inverse} ; + s2 = do ++ "hajaar" ; + size = other } ; + +oper mkNumS : Str -> Str -> Str -> Str -> Str -> Size -> LinDigit = + \do -> \baara -> \bis -> \nxt -> \inverse -> \sz -> + {s = table {unit => do ; teen => baara ; ten => bis ; tene => bis + "e" ; next => nxt ; inv => inverse} ; + s2 = do ++ "hajaar" ; + size = sz } ; + +-- lin n1 mkNum "ek" "gyaara" "das" +lin n2 = mkNum "di" "baara" "vis" ("tin" ++ "se") "aaT" ; +lin n3 = mkNumS "tin" "tera" "tis" ("caar"++ "se") "saat" two ; +lin n4 = mkNum "caar" "cawda" "caaLis" ("paanc" ++ "se") "cho" ; +lin n5 = mkNumS "paanc" "pandra" "pacaas" ("cho" ++ "se") "paanc" five; +lin n6 = mkNum "cho" "sola" "saaT" ("saat" ++ "se") "caar" ; +lin n7 = mkNumS "saat" "satara" "sattar" ("aaT" ++ "se") "tin" seven ; +lin n8 = mkNum "aaT" "aTara" "ãysi" ("naw" ++ "se") "di" ; +lin n9 = mkNumS "naw" "wagNis" "nawwad" "hajaar" "ek" nine; + +oper ss : Str -> LinSub100 = \s1 -> {s = s1 ; s2 = s1 ++ "hajaar" ; s3 = s1 ; size = other} ; +oper sssize : Str -> Str -> Size -> LinSub100 = \s1 -> \aux -> \sz -> + {s = s1 ; s2 = s1 ++ "hajaar" ; s3 = aux ; size = sz} ; + +oper spcsize : Size -> Size -> Size = \s1 -> \s2 -> + table {two => table {five => e25 ; _ => other} ; + five => table {_ => e50s} ; + seven => table {five => e75 ; _ => other} ; + nine => table {_ => e90s} ; + _ => table {_ => other}} ! s1 ! s2 ; + +lin pot01 = {s = table {unit => "ek" ; next => "di" ; inv => "naw" ; _ => "dummy" } ; s2 = "hajaar" ; size = sg} ; +lin pot0 d = d ; +lin pot110 = ss "das" ; +lin pot111 = ss "gyaara" ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = n.s ! unit ; s2 = n.s2 ; s3 = (n.s ! unit) ; size = n.size} ; + +lin pot1 d = sssize (d.s ! ten) [] (table {five => e50s ; _ => other} ! d.size) ; +lin pot1plus d e = sssize (variants {(d.s ! tene) ++ "par" ++ (e.s ! unit) ; (d.s ! ten) ++ "an" ++ (e.s ! unit)}) (table {nine => e.s ! inv ; _ => e.s ! unit} ! d.size) (spcsize d.size e.size) ; + +lin pot1as2 n = {s = n.s ; s2 = n.s2 } ; + +lin pot2 d = {s = selsg d.size "so" ((d.s ! unit) ++ "se") ; + s2 = selsg d.size [] ((d.s ! unit) ++ "laak") } ; + +lin pot2plus d e = + {s = mkso d.size e.size (table {e75 => d.s ! next ; e90s => d.s ! next ; _ => d.s ! unit} ! e.size) + (table {e50s => e.s3 ; e90s => e.s3 ; _ => e.s } ! e.size) ; + s2 = (d.s ! unit) ++ "laak" ++ (selsg e.size "hajaar" (e.s ++ "hajaar")) } ; + +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = n.s2 } ; +lin pot3plus n m = {s = n.s2 ++ m.s } ; + +oper selsg : Size -> Str -> Str -> Str = \sz -> \s1 -> \s2 -> table {sg => s1 ; _ => s2} ! sz ; + +oper mkso : Size -> Size -> Str -> Str -> Str = \ds -> \es -> \auxd -> \auxe -> table { + sg => table {e25 => "sawaa" + "se" ; + e50s => "DoD" ++ "se" ++ auxe ; + e75 => "pawNe" ++ auxd ; + e90s => variants { auxd ++ "kam" ++ auxe ; auxe ++ "kam" ++ auxd} ; + _ => "ek" ++ "so" ++ auxe} ; + two => table {e50s => "aDaai" ++ auxe ; + e25 => "sawaa" ++ auxd ++ "se" ; + e75 => "pawNe" ++ auxd ; + e90s => variants { auxd ++ "kam" ++ auxe ; auxe ++ "kam" ++ auxd} ; + _ => "do" ++ "se" ++ auxe} ; + _ => table {e50s => "saaDe" ++ auxd ++ "se" ++ auxe ; + e25 => "sawaa" ++ auxd ++ "se" ; + e75 => "pawNe" ++ auxd ; + e90s => variants { auxd ++ "kam" ++ auxe ; auxe ++ "kam" ++ auxd} ; + _ => auxd ++ "se" ++ auxe} + } ! ds ! es ; + diff --git a/examples/numerals/latvian.gf b/examples/numerals/latvian.gf new file mode 100644 index 000000000..0ce032c4c --- /dev/null +++ b/examples/numerals/latvian.gf @@ -0,0 +1,49 @@ +-- c^ +-- s^ +-- n, is n with a comma under +-- u^ with line over + +include numerals.Abs.gf ; + +param DForm = unit | teen | ten | hundred ; + +oper LinDigit = {s : DForm => Str ; s2 : Str }; +oper LinSub100 = {s : Str ; s2 : Str } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; + +oper mkNum : Str -> Str -> LinDigit = \tri -> \tribase -> + { s = table {unit => tri ; teen => tribase + "padsmit" ; ten => tribase + "desmit" ; hundred => variants {tribase + "simt" ; tri ++ "simti"} } ; s2 = tribase + "tu^kstos^" }; + +lin num x = {s = "/L" ++ x.s ++ "L/"} ; -- Latin A Supplement diacritics ; + +lin n2 = mkNum "divi" "div" ; +lin n3 = mkNum "tri:s" "tri:s" ; +lin n4 = mkNum "c^etri" "c^etr" ; +lin n5 = mkNum "pieci" "piec" ; +lin n6 = mkNum "ses^i" "ses^" ; +lin n7 = mkNum "septin,i" "septin," ; +lin n8 = mkNum "aston,i" "aston," ; +lin n9 = mkNum "devin,i" "devin," ; + +oper mkR : Str -> LinSub100 = \n -> {s = n ; s2 = n ++ "tu^kstos^" } ; + +lin pot01 = { s = table {hundred => "simts" ; _ => "viens" } ; s2 = "tu^kstotis" }; +lin pot0 d = d ; +lin pot110 = mkR "desmit" ; +lin pot111 = mkR "vienpadsmit" ; +lin pot1to19 d = mkR (d.s ! teen) ; +lin pot0as1 n = {s = n.s ! unit ; s2 = n.s2 } ; +lin pot1 d = mkR (d.s ! ten) ; +lin pot1plus d e = mkR ((d.s ! ten) ++ (e.s ! unit)) ; +lin pot1as2 n = n ; +lin pot2 d = mkR (d.s ! hundred) ; +lin pot2plus d e = mkR ((d.s ! hundred) ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = n.s2} ; +lin pot3plus n m = {s = n.s2 ++ m.s} ; + + diff --git a/examples/numerals/lithuanian.gf b/examples/numerals/lithuanian.gf new file mode 100644 index 000000000..703d8ca0d --- /dev/null +++ b/examples/numerals/lithuanian.gf @@ -0,0 +1,56 @@ +include numerals.Abs.gf ; + +-- y: +-- e: +-- i~ +-- s^ +-- m~ +-- n~ +-- ú: +-- u, + +param Size = sg | pl ; +param DForm = unit | teen | ten ; + +oper LinDigit = {s : DForm => Str ; size : Size }; +oper LinSub100 = {s : Str ; size : Size } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; + +oper mkNum : Str -> Str -> Str -> LinDigit = \tri -> \dvylika -> \tribase -> + { s = table {unit => tri ; teen => dvylika ; ten => tribase + "des^imt" } ; size = pl}; + +lin num x = {s = x.s} ; -- TODO ; + +lin n2 = mkNum "dù" "dvýlika" "dvì" ; +lin n3 = mkNum "try:s" "trýlika" "trìs" ; +lin n4 = mkNum "keturì" "keturiólika" "ke:turias" ; +lin n5 = mkNum "penkì" "penkiólika" "pen~kias" ; +lin n6 = mkNum "s^es^ì" "s^es^iólika" "s^e:s^ias" ; +lin n7 = mkNum "septynì" "septyniólika" "septýnias" ; +lin n8 = mkNum "as^tuonì" "as^tuoniólika" "as^túonias" ; +lin n9 = mkNum "devynì" "devyniólika" "devýnias" ; + +oper mkR : Str -> LinSub100 = \n -> {s = n ; size = pl } ; + +lin pot01 = { s = table {_ => "víenas" } ; size = sg }; +lin pot0 d = d ; +lin pot110 = mkR (variants {"de:s^imt"; "des^imtìs" }); +lin pot111 = mkR "vienúolika" ; +lin pot1to19 d = mkR (d.s ! teen) ; +lin pot0as1 n = mkR (n.s ! unit) ; +lin pot1 d = mkR (d.s ! ten) ; +lin pot1plus d e = mkR ((d.s ! ten) ++ (e.s ! unit)) ; +lin pot1as2 n = n ; +lin pot2 d = mkR (selsg d.size "s^im~tas" ((d.s ! unit) ++ "s^imtai~")) ; +lin pot2plus d e = mkR ((selsg d.size "s^im~tas" ((d.s ! unit) ++ "s^imtai~")) ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = selsg n.size "tú:kstantis" (n.s ++ "tú:kstanc^iu,") } ; +lin pot3plus n m = {s = (selsg n.size "tú:kstantis" (n.s ++ "tú:kstanc^iu,")) ++ m.s} ; + +oper selsg : Size -> Str -> Str -> Str = \sz -> \s1 -> \s2 -> + table {sg => s1 ; pl => s2} ! sz ; + diff --git a/examples/numerals/lotuxo.gf b/examples/numerals/lotuxo.gf new file mode 100644 index 000000000..02ddf52ff --- /dev/null +++ b/examples/numerals/lotuxo.gf @@ -0,0 +1,61 @@ +include numerals.Abs.gf ; + +param Size = sg | pl ; + +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = Form ; +lincat Sub10 = Form ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO: Encoding + +oper mkNum : Str -> Form = \mbili -> + {s = mbili; size = pl }; + +-- N [ng] +-- E epsilon +-- I i without dot +-- O IPA for o in cod + +-- lin n1 = mkNum "âbotye" ; +lin n2 = mkNum "ârrexai" ; +lin n3 = mkNum "xunixoi" ; +lin n4 = mkNum "aNwan" ; +lin n5 = mkNum "miet" ; +lin n6 = mkNum "IllE" ; +lin n7 = mkNum "xattarIk" ; +lin n8 = mkNum "xottoxunik" ; +lin n9 = mkNum "xOttONwan" ; + +oper xo : Str = pre {"xO" ; + "xo" / strs {"m" ; "xu" ; "xo"} ; + "x'" / strs {"â" ; "a"}} ; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = "âbotye" ; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "'tOmOn" ; +lin pot111 = ss ("'tOmOn" ++ xo ++ "âbotye") ; +lin pot1to19 d = ss ("'tOmOn" ++ xo ++ d.s ) ; +lin pot0as1 n = n ; +lin pot1 d = ss ("atOmwana" ++ d.s ) ; +lin pot1plus d e = ss ("atOmwana" ++ d.s ++ xo ++ e.s ) ; +lin pot1as2 n = n ; +lin pot2 d = ss (mkessixa d.size d.s) ; +lin pot2plus d e = ss ((mkessixa d.size d.s) ++ "ikO" ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = mktau n.size n.s } ; +lin pot3plus n m = {s = (mktau n.size n.s) ++ "ikO" ++ m.s} ; + +oper mkessixa : Size -> Str -> Str = \sz -> \attr -> + table {pl => "EssIxa" ++ attr ; + sg => variants {"EssIxa" ++ "âbotye"; "atOmwana" ++ "'tOmOn"}} ! sz ; +oper mktau : Size -> Str -> Str = \sz -> \attr -> + table {pl => "tausand" ++ attr ; + sg => variants {"tausand" ++ "âbotye"; "EssIxa" ++ "'tOmOn"}} ! sz ; diff --git a/examples/numerals/maale.gf b/examples/numerals/maale.gf new file mode 100644 index 000000000..5b8d309a0 --- /dev/null +++ b/examples/numerals/maale.gf @@ -0,0 +1,55 @@ +include numerals.Abs.gf ; + +param Size = sg | pl ; +param DForm = unit | ten ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = Form ; +lincat Sub1000 = {s : Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO: Encoding + +oper mkNum : Str -> Str -> LinDigit = \mbili -> \lama -> + {s = table {unit => mbili ; ten => lama + "-támmi" }; size = pl }; + +-- b> is b with right bend +-- ? without dot +-- $ IPA [sh] + +-- lin n1 = mkNum "pétte" ; +lin n2 = mkNum "lam?ó" "lamá"; +lin n3 = mkNum "haitsó" "haytsí" ; +lin n4 = mkNum "?oidó" "?oydí"; +lin n5 = mkNum "dóngo" "dóngi"; +lin n6 = mkNum "láhhó" "láhhi"; +lin n7 = mkNum "lánkayi" "lánkayi"; +lin n8 = mkNum "sálli" "sálli" ; +lin n9 = mkNum "tásub>a" "tázub>i"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = table {f => "pétte" }; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "táb>b>ó" ; +lin pot111 = ss ("táb>b>ó" ++ "pétte") ; +lin pot1to19 d = ss ("táb>b>ó" ++ (d.s ! unit)) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size } ; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = ss (d.s ! ten ++ e.s ! unit) ; +lin pot1as2 n = n ; +lin pot2 d = {s = mkseeta d.size (d.s ! unit) }; +lin pot2plus d e = {s = (mkseeta d.size (d.s ! unit)) ++ e.s} ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = n.s ++ "$íya"} ; +lin pot3plus n m = {s = n.s ++ "$íya" ++ m.s} ; + +oper mkseeta : Size -> Str -> Str = \sz -> \attr -> + table {pl => attr ++ "s'ééta" ; + sg => "s'ééta" } ! sz ; diff --git a/examples/numerals/malay.gf b/examples/numerals/malay.gf new file mode 100644 index 000000000..1213a96ee --- /dev/null +++ b/examples/numerals/malay.gf @@ -0,0 +1,71 @@ +-- Malay Numerals (Indonesian) +-- David Wahlstedt Sep 2002 + +include numerals.Abs.gf ; + +param + Place = attr | indep ; + Nm = sg | pl ; + +oper Num = {inh : Nm ; s : Place => Str} ; + +lincat + Numeral = {s : Str} ; + Digit = {s : Str} ; + Sub10 = Num ; + Sub100 = Num ; + Sub1000 = Num ; + Sub1000000 = {s : Str} ; + +oper + ratus : Nm => Str = -- 100 + table {{sg} => "seratus" ; {pl} => "ratus"} ; + + ribu : Nm => Str = -- 1000 + table {{sg} => "seribu" ; {pl} => "ribu"} ; + + mkTab : Str -> Place => Str = \s -> table { _ => s } ; + + mkNum : Str -> Num = \s -> {inh = pl ; s = mkTab s} ; + + ss : Str -> { s : Str } = \s -> { s = s } ; + +lin + num x0 = x0 ; + + n2 = ss "dua" ; + n3 = ss "tiga" ; + n4 = ss "empat" ; + n5 = ss "lima" ; + n6 = ss "enam" ; + n7 = ss "tujuh" ; + n8 = ss "delapan" ; + n9 = ss "sembilan" ; + + pot01 = {inh = sg ; s = table {{attr} => [] ; {indep} => "satu"}} ; + + pot0 d = mkNum d.s ; + + pot110 = mkNum "sepuluh" ; + + pot111 = mkNum "sebelas" ; + + pot1to19 d = mkNum ( d.s ++ "belas" ) ; + + pot0as1 n = n ; + + pot1 d = mkNum ( d.s ++ "puluh" ) ; + + pot1plus d e = mkNum ( d.s ++ "puluh" ++ e.s ! indep ) ; + + pot1as2 n = n ; + + pot2 d = mkNum ( d.s ! attr ++ ratus ! d.inh ) ; + + pot2plus d e = mkNum ( d.s ! attr ++ ratus ! d.inh ++ e.s ! indep ) ; + + pot2as3 n = ss ( n.s ! indep ) ; + + pot3 n = ss ( n.s ! attr ++ ribu ! n.inh ) ; + + pot3plus n m = ss ( n.s ! attr ++ ribu ! n.inh ++ m.s ! indep ) ; diff --git a/examples/numerals/maltese.gf b/examples/numerals/maltese.gf new file mode 100644 index 000000000..153f6a9c9 --- /dev/null +++ b/examples/numerals/maltese.gf @@ -0,0 +1,59 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | teenil | ten | hund ; +param Size = sg | pl | dual ; + +oper LinDigit = {s: DForm => Str ; s2 : Str ; size : Size } ; +oper Form = {s : Str ; s2 : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; + +lin num x = x ; -- TODO + +oper mkN : Str -> Str -> Str -> Str -> Str -> LinDigit = \u -> \tn -> \t -> \h -> \e -> + {s = table {unit => u ; teen => tn + "ax" ; teenil => tn + "ax" + "il" ; + ten => t ; hund => h ++ "mija"} ; s2 = e ; size = pl }; + +lin n2 = + {s = table {unit => "tnejn" ; + teen => "tnax" ; teenil => "tnax-il" ; + ten => "gh-oxrin" ; + hund => "mitejn"} ; s2 = "tnejn" ; size = dual} ; +lin n3 = mkN "tlieta" "tlett" "tletin" "tliet" "tlitt"; +lin n4 = mkN "erbgh-a" "erbat" "erbgh-in" "erba'" "erbat"; +lin n5 = mkN "h-amsa" "h-mist" "h-amsin" "h-ames" "h-amest" ; +lin n6 = mkN "sitta" "sitt" "sitt" "sitt" "sitt"; +lin n7 = mkN "sebgh-a" "sbat" "sbebgh-in" "seba'" "sebat" ; +lin n8 = mkN "tmienja" "tmint" "tmenin" "tmien" "tmint" ; +lin n9 = mkN "disgh-a" "dsat" "disgh-in" "disa'" "disat"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; s2 = s1 ; size = pl }; +oper ss2 : Str -> Str -> Form = \a -> \b -> {s = a ; s2 = b ; size = pl }; + +lin pot01 = + {s = table {unit => "wieh-ed" ; teen => "h-dax" ; _ => "mija" } ; + s2 = "wieh-ed" ; + size = sg}; +lin pot0 d = d; +lin pot110 = ss "gh-axra" ; +lin pot111 = ss2 "h-dax" "h-dax-il"; +lin pot1to19 d = ss2 (d.s ! teen) (d.s ! teenil); +lin pot0as1 n = {s = n.s ! unit ; s2 = n.s2 ; size = n.size} ; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = ss ((e.s ! unit) ++ "u" ++ (d.s ! ten)) ; +lin pot1as2 n = n ; +lin pot2 d = ss (d.s ! hund) ; +lin pot2plus d e = ss2 ((d.s ! hund) ++ "u" ++ e.s) + ((d.s ! hund) ++ "u" ++ e.s2) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = { s = (elf n.s2) ! n.size } ; +lin pot3plus n m = { s = (elf n.s2) ! n.size ++ m.s} ; + +oper elf : Str -> Size => Str = \attr -> + table {pl => attr ++ "elef" ; dual => "elfejn" ; sg => "elf"} ; + diff --git a/examples/numerals/mapuche.gf b/examples/numerals/mapuche.gf new file mode 100644 index 000000000..390f87c73 --- /dev/null +++ b/examples/numerals/mapuche.gf @@ -0,0 +1,43 @@ +include numerals.Abs.gf ; + +param Size = sg | pl ; + +oper All = {s : Str ; size : Size}; + +lincat Digit = All ; +lincat Sub10 = All ; +lincat Sub100 = All ; +lincat Sub1000 = All ; + +oper mkNum : Str -> All = \tri -> + { s = tri ; size = pl}; + +lin num x = {s = x.s } ; + +lin n2 = mkNum "epu" ; +lin n3 = mkNum "külá" ; +lin n4 = mkNum "meli" ; +lin n5 = mkNum "kechu" ; +lin n6 = mkNum "kayu" ; +lin n7 = mkNum "reqle" ; +lin n8 = mkNum "pura" ; +lin n9 = mkNum "aylla" ; + +oper ss : Str -> All = \s1 -> {s = s1 ; size = pl } ; + +lin pot01 = { s = "kiñe" ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss "mari" ; +lin pot111 = ss ("mari" ++ "kiñe") ; +lin pot1to19 d = ss ("mari" ++ d.s ); +lin pot0as1 n = n ; +lin pot1 d = ss (d.s ++ "mari" ); +lin pot1plus d e = ss (d.s ++ "mari" ++ e.s ) ; +lin pot1as2 n = n ; +lin pot2 d = ss (((selsg d.s) ! d.size) ++ "pataka" ) ; +lin pot2plus d e = ss (((selsg d.s) ! d.size) ++ "pataka" ++ e.s) ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = (selsg n.s) ! n.size ++ "warangka" } ; +lin pot3plus n m = {s = (selsg n.s) ! n.size ++ "warangka" ++ m.s} ; + +oper selsg : Str -> Size => Str = \s -> table {sg => [] ; pl => s } ; \ No newline at end of file diff --git a/examples/numerals/margi.gf b/examples/numerals/margi.gf new file mode 100644 index 000000000..4043d4580 --- /dev/null +++ b/examples/numerals/margi.gf @@ -0,0 +1,51 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten | oxy ; +param Size = sg | pl ; + +oper LinDigit = {s : DForm => Str ; size : Size} ; +oper LinS100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> Str -> Str -> LinDigit = \u -> \o -> \t -> + {s = table {unit => u ; ten => t + "kùmì" ; oxy => o} ; size = pl} ; + +oper mkNum2 : Str -> Str -> LinDigit = \u -> \t -> + {s = table {unit => u ; ten => t + "kùmì" ; oxy => u} ; size = pl} ; + +lin num x0 = {s = x0.s } ; -- TODO + +lin n2 = mkNum "s`&d>àN" "m'&tlú*" "m'&tl" ; +lin n3 = mkNum2 "mák`&r" "már" ; +lin n4 = mkNum (variants {"fòd>ù*" ; "fwàd>ù*"}) "fód>ú*" (variants {"fód>ú" ;"fód>"}) ; +lin n5 = mkNum (variants {"nt`&fù*" ; "mt`&fù*"}) "nt'&fú*" "nt'&f"; +lin n6 = mkNum2 "Nkwà" "Nkwá"; +lin n7 = mkNum2 "m'&d>'&fù*" "m'&d>'&f" ; +lin n8 = mkNum (variants {"ntsìsù*" ; "ncìsù*"}) "ntsísú*" "ntsís" ; +lin n9 = mkNum "'&mdlù*" "mdlù*" "'&mdlù" ; + +oper pwaser : Size => Str = table {sg => "s'&r" ; pl => "pwá"} ; +oper selsg : Str -> Str -> Size => Str = \s1 -> \attr -> + table {sg => s1 ; pl => s1 ++ attr} ; + +oper ss : Str -> LinS100 = \s1 -> {s = s1 ; s2 = s1 ; size = pl } ; + +lin pot01 = + {s = table {unit => "táN" ; oxy => "pátlú*" ; ten => "dummy" } ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss (variants { "kúmú*" ; "kúmù*" }); +lin pot111 = ss ("kúm" ++ "gà" ++ (variants {"s'&r" ; "s'&rnyá"}) ++ "táN") ; +lin pot1to19 d = ss ("kúm" ++ "gà" ++ "pwá" ++ d.s ! oxy) ; +lin pot0as1 n = {s = n.s ! unit ; s2 = n.s ! oxy ; size = n.size }; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = ss (d.s ! ten ++ "gà" ++ (pwaser ! e.size) ++ e.s ! oxy) ; +lin pot1as2 n = n ; +lin pot2 d = ss ((selsg "ghàrú" (d.s ! unit)) ! d.size) ; +lin pot2plus d e = ss ((selsg "ghàrú" (d.s ! unit) ! d.size) ++ "agá" ++ e.s2); +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = selsg "dúbú" n.s ! n.size }; +lin pot3plus n m = {s = ((selsg "dúbú" n.s) ! n.size) ++ m.s2 }; \ No newline at end of file diff --git a/examples/numerals/maybrat.gf b/examples/numerals/maybrat.gf new file mode 100644 index 000000000..604addcdd --- /dev/null +++ b/examples/numerals/maybrat.gf @@ -0,0 +1,71 @@ +include numerals.Abs.gf ; + +oper LinDigit = {s : DForm => Str ; even20 : Even20 } ; + +oper mk20Ten : Str -> Str -> Str -> LinDigit = \tri -> \t -> \h -> + { s = table {unit => tri ; unit2 => t ; twenty => "rae" ++ h } ; + even20 = ten}; + +oper mkEven20 : Str -> Str -> Str -> LinDigit = \se -> \t -> \h -> + { s = table {unit => se ; unit2 => t ; twenty => "rae" ++ h } ; + even20 = even}; + +oper na = {s = "N/A"} ; + +param Even20 = ten | even ; +param DForm = unit | unit2 | twenty ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = mkEven20 (variants{"ewok"; "eok"}) + ("krem" ++ "ewok") + ("sait" ++ "yhai") ; +lin n3 = mk20Ten "tuf" + ("krem" ++ "tuf") + ("sait" ++ "yhai") ; +lin n4 = mkEven20 "tiet" + ("krem" ++ "tiet") + ("ewok" ++ "mhai") ; +lin n5 = mk20Ten (variants {"mat" ; "temsau"}) + ("sau" ++ "muf") + ("ewok" ++ "mhai") ; +lin n6 = mkEven20 ("krem" ++ "sau") + ("sau" ++ "krem" ++ "sau") + ("tuf" ++ "mhai") ; +lin n7 = mk20Ten ("krem" ++ "ewok") + ("sau" ++ "krem" ++ "ewok") + ("tuf" ++ "mhai") ; +lin n8 = mkEven20 ("krem" ++ "tuf") + ("sau" ++ "krem" ++ "tuf") + ("tiet" ++ "mhai") ; +lin n9 = mk20Ten ("krem" ++ "tiet") + ("sau" ++ "krem" ++ "tiet") + ("tiet" ++ "mhai") ; + +lin pot01 = + {s = table {unit => "sau" ; unit2 => "krem" ++ "sau" ; twenty => "dummy" } ; + even20 = ten }; +lin pot0 d = d ; +lin pot110 = {s = "statem" } ; +lin pot111 = {s = "oo" ++ "krem" ++ "sau" } ; +lin pot1to19 d = {s = "oo" ++ d.s ! unit2 } ; +lin pot0as1 n = {s = n.s ! unit} ; +lin pot1 d = + {s = table {even => d.s ! twenty ; + ten => (d.s ! twenty) ++ "statem"} ! d.even20} ; +lin pot1plus d e = + {s = table {even => d.s ! twenty ++ e.s ! unit ; + ten => (d.s ! twenty) ++ (e.s ! unit2)} ! d.even20} ; + +lin pot1as2 n = n ; +lin pot2 d = na; +lin pot2plus d e = na; +lin pot2as3 n = n ; +lin pot3 n = na ; +lin pot3plus n m = na ; diff --git a/examples/numerals/miya.gf b/examples/numerals/miya.gf new file mode 100644 index 000000000..ae2ad4a62 --- /dev/null +++ b/examples/numerals/miya.gf @@ -0,0 +1,53 @@ +include numerals.Abs.gf ; + +param Size = sg | pl ; +param DForm = unit | acc ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO: Encoding + +oper mkNum : Str -> Str -> LinDigit = \mbili -> \lama -> + {s = table {unit => mbili ; acc => lama }; size = pl }; + +-- lin n1 = mkNum "wút`&" ; +lin n2 = mkNum "ts`&r" "ts'&r"; +lin n3 = mkNum "kìdi" "kídì" ; +lin n4 = mkNum "f`&d>&" "f'&d>&"; +lin n5 = mkNum "vàatl&" "vaatl&"; +lin n6 = mkNum "màaha" "máahà"; +lin n7 = mkNum "màats&r" "máats`&r"; +lin n8 = mkNum "f´&rf´&d>&" "f`&rf´&d>&" ; +lin n9 = mkNum "kùciya" "kúcìya"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; +oper behan = "bèh&n" ; +oper enaa = "'`&náa" ; + +lin pot01 = + {s = table {unit => "wút`&" ; acc => "wut'&"}; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "d'&rb>itim" ; +lin pot111 = ss (variants {behan ++ "wut'&";"d'&rb>itim" ++ behan ++ "wut'&"}); +lin pot1to19 d = ss (variants {behan ++ (d.s ! acc); "d'&rb>itim" ++ behan ++ d.s ! acc}) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size } ; +lin pot1 d = ss ("díb>i" ++ d.s ! unit) ; +lin pot1plus d e = ss ("díb>i" ++ d.s ! unit ++ behan ++ e.s ! acc) ; +lin pot1as2 n = n ; +lin pot2 d = ss ("d>àriy" ++ selsg d.size (d.s ! unit)); +lin pot2plus d e = ss ("d>àriy" ++ (selsg d.size (d.s ! unit)) ++ enaa ++ e.s); +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = "d'&bu" ++ (selsg n.size n.s)} ; +lin pot3plus n m = {s = "d'&bu" ++ (selsg n.size n.s) ++ enaa ++ m.s} ; + +oper selsg : Size -> Str -> Str = \sz -> \attr -> + table {pl => attr ; sg => variants {[] ; attr} } ! sz ; + diff --git a/examples/numerals/mkNumerals.gfs b/examples/numerals/mkNumerals.gfs new file mode 100644 index 000000000..4eb9ea44d --- /dev/null +++ b/examples/numerals/mkNumerals.gfs @@ -0,0 +1,94 @@ +i -old -abs=Numerals -cnc=af_tunni af_tunni.gf +i -old -abs=Numerals -cnc=albanian albanian.gf +i -old -abs=Numerals -cnc=amharic amharic.gf +i -old -abs=Numerals -cnc=arabic_modern arabic_modern.gf +i -old -abs=Numerals -cnc=basque basque.gf +i -old -abs=Numerals -cnc=bearlake_slave bearlake_slave.gf +i -old -abs=Numerals -cnc=biblical_hebrew biblical_hebrew.gf +i -old -abs=Numerals -cnc=bulgarian bulgarian.gf +i -old -abs=Numerals -cnc=catalan catalan.gf +i -old -abs=Numerals -cnc=chinese chinese.gf +i -old -abs=Numerals -cnc=classical_arabic classical_arabic.gf +i -old -abs=Numerals -cnc=classical_greek classical_greek.gf +i -old -abs=Numerals -cnc=croatian croatian.gf +i -old -abs=Numerals -cnc=czech czech.gf +i -old -abs=Numerals -cnc=dagur dagur.gf +i -old -abs=Numerals -cnc=danish danish.gf +i -old -abs=Numerals -cnc=decimal decimal.gf +i -old -abs=Numerals -cnc=dutch dutch.gf +i -old -abs=Numerals -cnc=english english.gf +i -old -abs=Numerals -cnc=files files +i -old -abs=Numerals -cnc=finnish finnish.gf +i -old -abs=Numerals -cnc=french french.gf +i -old -abs=Numerals -cnc=fulfulde fulfulde.gf +i -old -abs=Numerals -cnc=geez geez.gf +i -old -abs=Numerals -cnc=german german.gf +i -old -abs=Numerals -cnc=guahibo guahibo.gf +i -old -abs=Numerals -cnc=guarani guarani.gf +i -old -abs=Numerals -cnc=hindi hindi.gf +i -old -abs=Numerals -cnc=hungarian hungarian.gf +i -old -abs=Numerals -cnc=icelandic icelandic.gf +i -old -abs=Numerals -cnc=irish irish.gf +i -old -abs=Numerals -cnc=irula irula.gf +i -old -abs=Numerals -cnc=italian italian.gf +i -old -abs=Numerals -cnc=japanese japanese.gf +i -old -abs=Numerals -cnc=kabardian kabardian.gf +i -old -abs=Numerals -cnc=kambera kambera.gf +i -old -abs=Numerals -cnc=kawaiisu kawaiisu.gf +i -old -abs=Numerals -cnc=khmer khmer.gf +i -old -abs=Numerals -cnc=khowar khowar.gf +i -old -abs=Numerals -cnc=kodagu kodagu.gf +i -old -abs=Numerals -cnc=kolyma_yukaghir kolyma_yukaghir.gf +i -old -abs=Numerals -cnc=korean korean.gf +i -old -abs=Numerals -cnc=kulung kulung.gf +i -old -abs=Numerals -cnc=kwami kwami.gf +i -old -abs=Numerals -cnc=kwaza kwaza.gf +i -old -abs=Numerals -cnc=lalo lalo.gf +i -old -abs=Numerals -cnc=lamani lamani.gf +i -old -abs=Numerals -cnc=latvian latvian.gf +i -old -abs=Numerals -cnc=lithuanian lithuanian.gf +i -old -abs=Numerals -cnc=lotuxo lotuxo.gf +i -old -abs=Numerals -cnc=maale maale.gf +i -old -abs=Numerals -cnc=malay malay.gf +i -old -abs=Numerals -cnc=maltese maltese.gf +i -old -abs=Numerals -cnc=mapuche mapuche.gf +i -old -abs=Numerals -cnc=margi margi.gf +i -old -abs=Numerals -cnc=maybrat maybrat.gf +i -old -abs=Numerals -cnc=miya miya.gf +i -old -abs=Numerals -cnc=mkNumerals mkNumerals.gfs +i -old -abs=Numerals -cnc=MkScript MkScript.hs +i -old -abs=Numerals -cnc=MkScript MkScript.hs~ +i -old -abs=Numerals -cnc=modern_greek modern_greek.gf +i -old -abs=Numerals -cnc=mongolian mongolian.gf +i -old -abs=Numerals -cnc=nenets nenets.gf +i -old -abs=Numerals -cnc=norwegianBook norwegianBook.gf +i -old -abs=Numerals -cnc=old_church_slavonic old_church_slavonic.gf +i -old -abs=Numerals -cnc=oromo oromo.gf +i -old -abs=Numerals -cnc=pashto pashto.gf +i -old -abs=Numerals -cnc=polish polish.gf +i -old -abs=Numerals -cnc=portuguese portuguese.gf +i -old -abs=Numerals -cnc=quechua quechua.gf +i -old -abs=Numerals -cnc=romanian romanian.gf +i -old -abs=Numerals -cnc=russian russian.gf +i -old -abs=Numerals -cnc=sango sango.gf +i -old -abs=Numerals -cnc=sanskrit sanskrit.gf +i -old -abs=Numerals -cnc=slovak slovak.gf +i -old -abs=Numerals -cnc=sorani sorani.gf +i -old -abs=Numerals -cnc=spanish spanish.gf +i -old -abs=Numerals -cnc=stieng stieng.gf +i -old -abs=Numerals -cnc=swahili swahili.gf +i -old -abs=Numerals -cnc=swedish swedish.gf +i -old -abs=Numerals -cnc=swiss_french swiss_french.gf +i -old -abs=Numerals -cnc=tamil tamil.gf +i -old -abs=Numerals -cnc=tampere tampere.gf +i -old -abs=Numerals -cnc=tibetan tibetan.gf +i -old -abs=Numerals -cnc=totonac totonac.gf +i -old -abs=Numerals -cnc=tuda_daza tuda_daza.gf +i -old -abs=Numerals -cnc=tukang_besi tukang_besi.gf +i -old -abs=Numerals -cnc=turkish turkish.gf +i -old -abs=Numerals -cnc=votic votic.gf +i -old -abs=Numerals -cnc=welsh welsh.gf +i -old -abs=Numerals -cnc=yasin_burushaski yasin_burushaski.gf +i -old -abs=Numerals -cnc=zaiwa zaiwa.gf +s +pm | wf numerals.gfcm \ No newline at end of file diff --git a/examples/numerals/mongolian.gf b/examples/numerals/mongolian.gf new file mode 100644 index 000000000..54ff617b2 --- /dev/null +++ b/examples/numerals/mongolian.gf @@ -0,0 +1,59 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten ; +param Size = sg | pl | tenplus ; +param S100 = indep | tenpart | tenelfu | sihpart ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +oper LinSub100 = {s : S100 => Str ; size : Size} ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> Str -> LinDigit = \hulatt -> \haya -> + {s = table {unit => hulatt ; ten => haya} ; size = pl} ; + +lin num x0 = + {s = "/L" ++ x0.s ++ "L/"} ; +lin n2 = mkNum "qoyar" "qorin" ; +lin n3 = mkNum "Gurban" "guc^in" ; +lin n4 = mkNum "dörbän" "döc^in" ; +lin n5 = mkNum "tabun" "tabin" ; +lin n6 = mkNum "j^irGu'an" "j^irin" ; +lin n7 = mkNum "dolo'an" "dalan" ; +lin n8 = mkNum "naiman" "nayan" ; +lin n9 = mkNum "yisün" "j^arin" ; + +oper ss1 : Str -> Str -> Str -> LinSub100 = \assir -> \ten -> \unitpart -> + {s = table {indep => assir ; tenpart => ten ; tenelfu => [] ; sihpart => unitpart} ; size = tenplus } ; + +oper ss : Str -> Str -> Str -> LinSub100 = \assir -> \ten -> \unitpart -> + {s = table {indep => assir ; tenpart => ten ; tenelfu => ten ; sihpart => unitpart} ; size = tenplus } ; + +lin pot01 = + {s = table {unit => "nigän" ; ten => "arban" }; size = sg}; +lin pot0 d = d ; +lin pot110 = ss1 "arban" "nigän" [] ; +lin pot111 = ss1 ("arban" ++ "nigän") "nigän" "mingGan" ; +lin pot1to19 d = ss1 ("arban" ++ d.s ! unit) "nigän" (mkmingGan d.size (d.s ! unit)) ; +lin pot0as1 n = {s = table {indep => n.s ! unit ; sihpart => mkmingGan n.size (n.s ! unit) ; _ => [] } ; size = n.size} ; +lin pot1 d = ss (d.s ! ten) (d.s ! unit) [] ; +lin pot1plus d e = ss ((d.s ! ten) ++ (e.s ! unit)) + (d.s ! unit) + (mkmingGan e.size (e.s ! unit)); + +lin pot1as2 n = {s = n.s ! indep ; s2 = n.s ! tenelfu ++ "tümän" ++ n.s ! sihpart ; size = n.size} ; + +lin pot2 d = {s = (sel d.size [] (d.s ! unit)) ++ "j^a'un" ; + s2 = sel d.size "arban" (d.s ! ten) ; size = tenplus} ; +lin pot2plus d e = {s = (sel d.size [] (d.s ! unit)) ++ "j^a'un" ++ e.s ! indep ; s2 = d.s ! ten ++ e.s ! tenpart ++ "tümän" ++ e.s ! sihpart ; size = tenplus} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = table {pl => n.s ++ "mingGan" ; sg => "mingGan" ; tenplus => n.s2 } ! n.size} ; +lin pot3plus n m = {s = table {pl => n.s ++ "mingGan" ; sg => "mingGan" ; tenplus => n.s2 } ! n.size ++ m.s} ; + +oper mkmingGan : Size -> Str -> Str = \sz -> \attr -> (sel sz [] attr) ++ "mingGan" ; + +oper sel : Size -> Str -> Str -> Str = \sz -> \a -> \b -> table {sg => a ; _ => b} ! sz ; \ No newline at end of file diff --git a/examples/numerals/nenets.gf b/examples/numerals/nenets.gf new file mode 100644 index 000000000..6ab6cb44b --- /dev/null +++ b/examples/numerals/nenets.gf @@ -0,0 +1,67 @@ +include numerals.Abs.gf ; + +-- #n- +-- #t- +-- #l- +-- #s' with , ontop of s +-- #N for n with a thing on the right leg i.e IPA [ng] +-- #|~ a vertical tilde in thge top right corner + +param DForm = unit | teen ; +param Size = sg | nine | pl ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; +oper LinS100 = {s : Str ; size : Size} ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s } ; -- TODO Encoding + +oper mkNum : Str -> Str -> LinDigit = + \u -> \t -> {s = table {unit => u ; teen => t } ; size = pl} ; + +lin n2 = mkNum (variants {"side"; "sidea"}) "sidejaNan-â|~" ; +lin n3 = mkNum (variants {"n-ahar" ; "nâr"}) "n-aharaNan-â|~" ; +lin n4 = mkNum (variants {"t-êt" ; "t-iet" ; "tiet"}) "t-êtaNan-â|~" ; +lin n5 = mkNum (variants {"saml-aN" ; "sambl-aN" ; "sambel-ank" }) + "saml-an-aNan-â|~"; +lin n6 = mkNum "mat'" "mat-aNan-â|~"; +lin n7 = mkNum (variants {"siu" ; "s'eu"}) "siujaNan-â|~" ; +lin n8 = mkNum "sidend-êt" "sidend-êtaNan-â|~" ; +lin n9 = {s = table {unit => variants {"hâsawaju'" ; "habeiju'"} ; + teen => "hâsawajujaNan-â|~" } ; + size = nine} ; + +oper ss : Str -> LinS100 = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = table {unit => variants {"~ob" ; "~opoi" } ; _ => "dummy" }; size = sg}; +lin pot0 d = d ; +lin pot110 = ss (variants {"ju'" ; "lûcaju'" ; "lûsaju'" }) ; +lin pot111 = ss (variants {"~objaNan-â|~"; "~objaNn-â" ; "~objaNa"}) ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = ss (ifnine d.size (d.s ! unit)) ; +lin pot1plus d e = ss ((ifnine d.size (d.s ! unit)) ++ (e.s ! unit)) ; +lin pot1as2 n = n ; +lin pot2 d = ss (mkjur d.size (d.s ! unit)) ; +lin pot2plus d e = ss ((mkjur d.size (d.s ! unit)) ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = mkjuonar n.size n.s } ; +lin pot3plus n m = {s = (mkjuonar n.size n.s) ++ m.s } ; + +oper mkjuonar : Size -> Str -> Str = \sz -> \attr -> + table {nine => attr ++ "juonar" ; + sg => variants {"juonar" ; "jônar" ; "ju" ++ "jur"} ; + pl => attr ++ "juonar" } ! sz ; + +oper mkjur : Size -> Str -> Str = \sz -> \attr -> + table {sg => "jur" ; _ => attr ++ "jur" } ! sz ; + +oper ifnine : Size -> Str -> Str = \sz -> \attr -> + table {nine => "hâsawajur" ; _ => attr ++ "ju'" } ! sz ; \ No newline at end of file diff --git a/examples/numerals/norwegian_book.gf b/examples/numerals/norwegian_book.gf new file mode 100644 index 000000000..be67e94fe --- /dev/null +++ b/examples/numerals/norwegian_book.gf @@ -0,0 +1,45 @@ +-- norsk bokmol, by Herman R Jervell herman.jervell@ilf.uio.no, 6/3/2001 + +include numerals.Abs.gf ; + +param DForm = ental | ton | tiotal ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str} ; +lincat Sub10 = {s : DForm => Str} ; +lincat Sub100 = {s : Str} ; +lincat Sub1000 = {s : Str} ; +lincat Sub1000000 = {s : Str} ; + +oper mkTal : Str -> Str -> Str -> Lin Digit = + \två -> \tolv -> \tjugo -> + {s = table {ental => två ; ton => tolv ; tiotal => tjugo}} ; +oper regTal : Str -> Lin Digit = \fem -> mkTal fem (fem + "ten") (fem + "ti") ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; + +lin n2 = mkTal "to" "tolv" "tjue" ; +lin n3 = mkTal "tre" "tretten" "tretti" ; +lin n4 = mkTal "fire" "fjorten" "førti" ; +lin n5 = regTal "fem" ; +lin n6 = regTal "seks" ; +lin n7 = mkTal "sju" "sytten" "sytti" ; +lin n8 = mkTal "åtte" "atten" "åtti" ; +lin n9 = mkTal "ni" "nitten" "nitti" ; + +lin pot01 = {s = table {f => "et"}} ; +lin pot0 d = {s = table {f => d.s ! f}} ; +lin pot110 = ss "ti" ; +lin pot111 = ss "elve" ; +lin pot1to19 d = ss (d.s ! ton) ; +lin pot0as1 n = ss (n.s ! ental) ; +lin pot1 d = ss (d.s ! tiotal) ; +lin pot1plus d e = ss (d.s ! tiotal ++ e.s ! ental) ; +lin pot1as2 n = n ; +lin pot2 d = ss (d.s ! ental ++ "hundre") ; +lin pot2plus d e = ss (d.s ! ental ++ "hundre" ++ "og" ++ e.s) ; +lin pot2as3 n = n ; +lin pot3 n = ss (n.s ++ "tusen") ; +lin pot3plus n m = ss (n.s ++ "tusen" ++ "og" ++ m.s) ; + diff --git a/examples/numerals/numerals.Abs.gf b/examples/numerals/numerals.Abs.gf new file mode 100644 index 000000000..90aae3cb7 --- /dev/null +++ b/examples/numerals/numerals.Abs.gf @@ -0,0 +1,32 @@ +-- numerals from 1 to 999999 in decimal notation + +flags startcat=Numeral ; + +cat + Numeral ; -- 0.. + Digit ; -- 2..9 + Sub10 ; -- 1..9 + Sub100 ; -- 1..99 + Sub1000 ; -- 1..999 + Sub1000000 ; -- 1..999999 + +fun + num : Sub1000000 -> Numeral ; + + n2, n3, n4, n5, n6, n7, n8, n9 : Digit ; + + pot01 : Sub10 ; -- 1 + pot0 : Digit -> Sub10 ; -- d * 1 + pot110 : Sub100 ; -- 10 + pot111 : Sub100 ; -- 11 + pot1to19 : Digit -> Sub100 ; -- 10 + d + pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9 + pot1 : Digit -> Sub100 ; -- d * 10 + pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n + pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99 + pot2 : Sub10 -> Sub1000 ; -- m * 100 + pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n + pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999 + pot3 : Sub1000 -> Sub1000000 ; -- m * 1000 + pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n + diff --git a/examples/numerals/old_church_slavonic.gf b/examples/numerals/old_church_slavonic.gf new file mode 100644 index 000000000..ce6a0c032 --- /dev/null +++ b/examples/numerals/old_church_slavonic.gf @@ -0,0 +1,58 @@ +-- je, jo, ja for je, jo, ja etc +-- U, I yers +-- ä is jat' +-- q is [ch] +-- y for [bi] +-- e~, o~ +-- w for [sh] + +include numerals.Abs.gf ; + +param Size = sg | dual | threefour | fiveup ; + +lincat Digit = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub10 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; + +oper mkNum : Str -> Size -> {s : Str ; s2 : Str ; size : Size} = + \petI -> \sz -> { s = petI ; s2 = petI ; size = sz}; + +oper mkNum5 : Str -> {s : Str ; s2 : Str ; size : Size} = \s -> mkNum s fiveup ; + +lin num x = {s = "/C" ++ x.s ++ "C/"} ; -- the Old Church Slavonic Cyrillic script ; + +lin n2 = {s = "dUva" ; s2 = [] ; size = dual }; +lin n3 = mkNum (variants {"trije" ; "trIje" }) threefour ; +lin n4 = mkNum "qetyre" threefour ; +lin n5 = mkNum5 "pe~tI" ; +lin n6 = mkNum5 "westI" ; +lin n7 = mkNum5 "sedmI" ; +lin n8 = mkNum5 "osmI" ; +lin n9 = mkNum5 "deve~tI" ; + +lin pot01 = { s = "jedinU" ; s2 = [] ; size = sg }; +lin pot0 d = d ; +lin pot110 = mkNum5 "dese~tI" ; +lin pot111 = mkNum5 ("jedinU" ++ "na" ++ "dese~te") ; +lin pot1to19 d = mkNum5 (d.s ++ "na" ++ "dese~te") ; +lin pot0as1 n = n ; +lin pot1 d = {s = mkTen d.size d.s ; s2 = mkTen d.size d.s ; size = fiveup} ; +lin pot1plus d e = {s = mkTen d.size d.s ++ variants {"i" ; "ti"} ++ e.s ; s2 =mkTen d.size d.s ++ variants {"i" ; "ti"} ++ mkattr e.size e.s ; size = e.size} ; +lin pot1as2 n = n ; +lin pot2 d = {s = mkHund d.size d.s ; s2 = mkHund d.size d.s ; size = fiveup} ; +lin pot2plus d e = { s = mkHund d.size d.s ++ e.s ; s2 = mkHund d.size d.s ++ e.s2 ; size = e.size } ; +lin pot2as3 n = {s = n.s }; +lin pot3 n = {s = n.s2 ++ mkThou n.size} ; +lin pot3plus n m = {s = n.s2 ++ mkThou n.size ++ m.s} ; + +oper mkThou : Size -> Str = \sz -> + table {sg => (variants {"tysjo~wti" ; "tysje~wti"}) ; dual => ("dUvä" ++ "tysjo~wti") ; threefour => "tysjo~wte~" ; fiveup => "tysjo~wtI" } ! sz ; + +oper mkHund : Size -> Str -> Str = \sz -> \s -> + table {sg => "sUto" ; dual => "dUvä" ++ "sUtä" ; threefour => s ++ "sUta" ; fiveup => s ++ "sUtU" } ! sz ; + +oper mkTen : Size -> Str -> Str = \sz -> \s -> + table {sg => "dese~tI" ; dual => s ++ "dese~ti" ; threefour => s ++ "dese~te" ; fiveup => s ++ "dese~tU" } ! sz ; + +oper mkattr : Size -> Str -> Str = \sz -> \s -> table {dual => [] ; _ => s} ! sz; diff --git a/examples/numerals/oromo.gf b/examples/numerals/oromo.gf new file mode 100644 index 000000000..a8a43a581 --- /dev/null +++ b/examples/numerals/oromo.gf @@ -0,0 +1,52 @@ +include numerals.Abs.gf ; + +param Size = sg | pl ; +param DForm = unit | teen | ten | ten2 ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = {s = x0.s} ; + +oper mkNum : Str -> LinDigit = \u -> + {s = table {unit => u ; teen => "kudha" + u; ten => u + "tama" ; ten2 => u + "tamii"}; size = pl }; + +oper mkNum2 : Str -> Str -> LinDigit = \u -> \t -> + {s = table {unit => u ; teen => "kudha" + u; ten => t + "a" ; ten2 => t + "ii"}; size = pl }; + +-- lin n1 = mkNum "tokko" ; +lin n2 = mkNum2 "lama" "digdam"; +lin n3 = {s = table {unit => "sadii" ; teen => "kudhasadii" ; ten => "soddoma" ; ten2 => "soddomii"} ; size = pl}; +lin n4 = {s = table {unit => "afur" ; teen => variants {"kudha'afur" ; "kudhafur"} ; ten => "afur" + "tama" ; ten2 => "afur" + "tamii"} ; size = pl} ; +lin n5 = mkNum "shan" ; +lin n6 = mkNum2 (variants {"ja'a" ; "jaha"}) "jaatam" ; +lin n7 = mkNum2 "torba" "torbaatam"; +lin n8 = mkNum "saddeet" ; +lin n9 = mkNum "sagal" ; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = table {f => "tokko" }; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "kudhan" ; +lin pot111 = ss "kudhatokko" ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size } ; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = ss (d.s ! ten2 ++ e.s ! unit) ; +lin pot1as2 n = n ; +lin pot2 d = ss (selsg (d.s ! unit) "dhibba" ! d.size); +lin pot2plus d e = ss (selsg (d.s ! unit) "dhibba" ! d.size ++ "fi" ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = (selsg n.s "kuma") ! n.size} ; +lin pot3plus n m = {s = (selsg n.s "kuma") ! n.size ++ "fi" ++ m.s} ; + +oper selsg : Str -> Str -> Size => Str = \attr -> \i -> + table {pl => i ++ attr ; sg => variants {i ; i ++ attr }} ; diff --git a/examples/numerals/pashto.gf b/examples/numerals/pashto.gf new file mode 100644 index 000000000..3904c08b2 --- /dev/null +++ b/examples/numerals/pashto.gf @@ -0,0 +1,88 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten | teen | spctwo | twenties; +param Size = sg | two | less100 | more100 ; + +-- From Herbert Penzl's Pashto book. There's no standard orthography of +-- Pashto so minor deviations may occur +-- yaw can occur beforer zar and sal but usually doesn't +-- [e] is yaw with two vertical under +-- [$] is Ha with three dots above +-- [X] is Sin with one dot below and one above +-- [A] shouldnt have dots +-- [p] is be with three dots below like Persian +-- [G] is za/ra etc with one dot below and one above +-- [a] should not have a hamza +-- [P] is a Ha with a hamza above +-- [R] is an r with a ring below + +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; + +lin num x0 = + {s = "/A" ++ x0.s ++ "A/"} ; -- the Extented-Arabic environment + +oper mkNum : Str -> Str -> Str -> Lin Digit = + \dwA -> \cl -> \dwwls -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; spctwo => dwA ; twenties => dwA + "wict"} ; size = less100 } ; + +oper mkIrrNum : Str -> Str -> Str -> Str -> Str -> Lin Digit = + \dwA -> \cl -> \dwwls -> \dw -> \dr -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; spctwo => dw ; twenties +=> dr + "wict"} ; size = less100 } ; + +-- lin n1 mkNum "yw" "ls" ... ; +lin n2 = {s = table {unit => "dwA" ; ten => "cl" ; teen => "dwwls" ; + spctwo => "dw" ; twenties => "dwA" + "wict" } ; + size = two }; +lin n3 = mkIrrNum "dry" "derc" "dyarls" "dry" "dr" ; +lin n4 = mkIrrNum "$lwr" "$lweXt" "$wrls" "$lwr" "$ler"; +lin n5 = mkNum "pnPA" "pnPws" (variants { "pnPAls"; "pnPls"}) ; +lin n6 = mkNum "cpG" "cpetA" "spaRls" ; +lin n7 = mkNum "awA" "awya" (variants {"awAls"; "awls"}) ; +lin n8 = mkNum "atA" "atya" (variants {"atAls"; "atls"}) ; +lin n9 = mkNum "nA" "nwy" (variants {"nwls"; "nwns"}) ; + +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin pot01 = {s = table {unit => "yw" ; + spctwo => "yw" ; + twenties => "yw" + "wict" ; + _ => "dummy" } ; size = sg} ; +lin pot0 d = {s = table {f => d.s ! f} ; size = less100} ; +lin pot110 = {s = "ls" ; size = less100} ; +lin pot111 = {s = "ywwls" ; size = less100} ; +lin pot1to19 d = {s = d.s ! teen ; size = less100} ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; size = less100} ; +lin pot1plus d e = {s = table {two => e.s ! twenties ; + _ => e.s ! spctwo ++ (d.s ! ten) } ! d.size ; + size = less100} ; +lin pot1as2 n = {s = n.s ; s2 = "dummy" ; size = n.size } ; +lin pot2 d = {s = (mkswA (d.s ! unit)) ! d.size ; s2 = (mklk (d.s ! unit)) ! d.size ; size = more100} ; +lin pot2plus d e = + {s = (mkvarswA (d.s ! unit)) ! d.size ++ "aw" ++ e.s ; + s2 = (mklk (d.s ! unit)) ! d.size ++ e.s ++ (mkzrA ! e.size) ; + size = more100} ; + +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = table { sg => "zr" ; + two => n.s ++ "zrA" ; + less100 => n.s ++ "zrA" ; + more100 => n.s2 } ! n.size} ; +lin pot3plus n m = + {s = table { sg => variants {"zr" ; "yw" ++ "zr"} ; + two => n.s ++ "zrA" ; + less100 => n.s ++ "zrA" ; + more100 => n.s2 } ! n.size ++ maybeaw ! m.size ++ m.s} ; + + +oper mklk : Str -> Size => Str = \s -> table {sg => "lk" ; _ => s ++ "lk"} ; +oper maybeaw : Size => Str = table {more100 => [] ; _ => "aw"} ; +oper mkswA : Str -> Size => Str = \s -> table {sg => "sl" ; _ => s ++ "swA"} ; +oper mkvarswA : Str -> Size => Str = + \s -> table {sg => (variants {"sl" ; "yw" ++ "sl"}) ; _ => s ++ "swA"} ; +oper mkzrA : Size => Str = table {sg => "zr" ; _ => "zrA"} ; + diff --git a/examples/numerals/polish.gf b/examples/numerals/polish.gf new file mode 100644 index 000000000..8ecc3839a --- /dev/null +++ b/examples/numerals/polish.gf @@ -0,0 +1,94 @@ +-- numerals in Polish, author Wojciech Mostowski, 20/9/2002 + +include numerals.Abs.gf ; + +-- all different for unit digits, teens, tens and hundreds +param DForm = unit | teen | ten | hund ; + +-- cases for thousand in Polish +-- 1000 - jeden TYSIAC +-- 2000 - dwa TYSIACE +-- 3000 - trzy TYSIACE +-- 4000 - cztery TYSIACE +-- 5000 - piec TYSIECY +-- 104000 - sto cztery TYSIECE +-- 105000 - sto piec TYSIECY +-- 24000 - dwadziescia cztery TYSIACE +-- 25000 - dwadziescia piec TYSIACY +-- BUT e.g. +-- 21000 - dwadziescia jeden TYSIECY (not TYSIAC) +-- 11000 - jedenascie TYSIECY +-- (12..19)000 - TYSIECY + +param ThForm = onlyone | lastone | twoorthreeorfour | fiveup ; + +oper LinDigit = {s : DForm => Str; o : ThForm ; t : ThForm } ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str; o : ThForm ; t : ThForm } ; +lincat Sub100 = {s : Str; t : ThForm } ; +lincat Sub1000 = {s : Str; t : ThForm } ; + +oper mkNum : Str -> Str -> Str -> Str -> ThForm -> LinDigit = + \dwa -> \dwanascie -> \dwadziescia -> \dwiescie -> \thform -> + { s = table {unit => dwa ; teen => dwanascie ; ten => dwadziescia ; hund => +dwiescie }; + o = thform ; t = thform + }; + +oper mkRegNum1 : Str -> LinDigit = + \siedem -> + { s = table { unit => siedem ; teen => siedem + "nascie" ; + ten => siedem + "dziesiat" ; hund => siedem + "set" + }; + o = fiveup ; t = fiveup + }; +oper mkRegNum2 : Str -> LinDigit = + \pie -> + { s = table { unit => pie + "c" ; teen => pie + "tnascie" ; + ten => pie + "cdziesiat" ; hund => pie + "cset" + }; + o = fiveup ; t = fiveup + }; + +oper mkTh : ThForm => Str = + table { onlyone => "tysiac" ; lastone => "tysiecy" ; + twoorthreeorfour => "tysiace" ; fiveup => "tysiecy" + }; + +oper ss : Str -> ThForm -> {s : Str ; t : ThForm} = \str -> \th -> {s = str; t = th} +; + +lin num x = x ; + +lin n2 = mkNum "dwa" "dwanascie" "dwadziescia" "dwiescie" +twoorthreeorfour ; +lin n3 = mkNum "trzy" "trzynascie" "trzydziesci" "trzysta" +twoorthreeorfour ; +lin n4 = mkNum "cztery" "czternascie" "czterdziesci" "czterysta" +twoorthreeorfour ; +lin n5 = mkRegNum2 "pie" ; +lin n6 = mkNum "szesc" "szesnascie" "szescdziesiat" "szescset" fiveup; +lin n7 = mkRegNum1 "siedem" ; +lin n8 = mkRegNum1 "osiem" ; +lin n9 = mkRegNum2 "dziewie" ; + +lin pot01 = { s = table {hund => "sto"; f => "jeden" }; + o = onlyone ; t = lastone + }; +lin pot0 d = {s = table {f => d.s ! f} ; o = d.o ; t = d.t} ; +lin pot110 = ss "dziesiec" fiveup ; +lin pot111 = ss "jedenascie" fiveup ; +lin pot1to19 d = {s = d.s ! teen ; t = fiveup} ; +lin pot0as1 n = {s = n.s ! unit ; t = n.o} ; +lin pot1 d = {s = d.s ! ten ; t = fiveup} ; +lin pot1plus d e = {s = d.s ! ten ++ e.s ! unit; t = e.t} ; +lin pot1as2 n = n ; +lin pot2 d = {s = d.s ! hund ; t = fiveup} ; +lin pot2plus d e = { s = d.s ! hund ++ e.s ; + t = table { onlyone => lastone ; f => f } ! e.t + } ; + +lin pot2as3 n = n ; +lin pot3 n = {s = n.s ++ mkTh ! n.t} ; +lin pot3plus n m = {s = n.s ++ mkTh ! n.t ++ m.s} ; + diff --git a/examples/numerals/portuguese.gf b/examples/numerals/portuguese.gf new file mode 100644 index 000000000..bf3fb1b2e --- /dev/null +++ b/examples/numerals/portuguese.gf @@ -0,0 +1,58 @@ +include numerals.Abs.gf ; + +param DForm = unit | teen | ten | hundred ; +param Size = sg | less10 | pl ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size } ; +lincat Sub10 = {s : DForm => Str ; size : Size } ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> Str -> Str -> Str -> Lin Digit = + \dois -> \doze -> \vinte -> \duzentos -> + {s = table {unit => dois ; teen => doze ; ten => vinte ; hundred => duzentos} ; size = less10} ; + + +lin num x0 = + {s = x0.s} ; + +lin n2 = mkNum "dois" "doze" "vinte" "duzentos" ; +lin n3 = mkNum "três" "treze" "trinta" "trezentos" ; +lin n4 = mkNum "cuatro" (variants {"catorze" ; "quatorze"}) "quarenta" "cuatrocentos" ; +lin n5 = mkNum "cinco" "quinze" "cinqüenta" "quinhentos" ; +lin n6 = mkNum "seis" (variants {"dezasseis" ; "dezesseis"}) "sessenta" "seiscentos" ; +lin n7 = mkNum "sete" (variants {"dezassete" ; "dezessete"}) "setenta" "setecentos" ; +lin n8 = mkNum "oito" "dezoito" "oitenta" "oitocentos" ; +lin n9 = mkNum "nove" (variants {"dezanove" ; "dezenove"}) "noventa" "novecentos" ; + +lin pot01 = {s = table {unit => "um" ; hundred => "cem" ; _ => "dummy"} ; size = sg} ; +lin pot0 d = d ; +lin pot110 = + {s = "dez" ; size = pl} ; +lin pot111 = + {s = "onze" ; size = pl} ; +lin pot1to19 d = + {s = d.s ! teen ; size = pl} ; +lin pot0as1 n = + {s = n.s ! unit ; size = n.size } ; +lin pot1 d = + {s = d.s ! ten ; size = pl} ; +lin pot1plus d e = + {s = d.s ! ten ++ "e" ++ e.s ! unit ; size = pl} ; +lin pot1as2 n = + {s = n.s ; size = n.size} ; +lin pot2 d = + {s = d.s ! hundred ; size = pl} ; +lin pot2plus d e = + {s = table {sg => "cento" ; + _ => d.s ! hundred } ! d.size ++ (add e.s) ! e.size ; size = pl} ; +lin pot2as3 n = + {s = n.s} ; +lin pot3 n = + {s = table {sg => "mil" ; _ => n.s ++ "mil"} ! n.size} ; +lin pot3plus n m = + {s = table {sg => "mil" ; _ => n.s ++ "mil"} ! n.size ++ (add m.s) ! m.size } ; + +oper add : Str -> Size => Str = \s -> table {pl => s ; _ => "e" ++ s}; \ No newline at end of file diff --git a/examples/numerals/quechua.gf b/examples/numerals/quechua.gf new file mode 100644 index 000000000..768a5921a --- /dev/null +++ b/examples/numerals/quechua.gf @@ -0,0 +1,50 @@ +include numerals.Abs.gf ; + +param DForm = unit | havingunit ; +param Size = sg | pl ; + +-- Quechua har no standard orthography so there are numerous spelling variants +-- not considered here. + + +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size} ; + +oper mkRegNum1 : Str -> Lin Digit = + \juk -> + { s = table { unit => juk ; havingunit => juk + "niyuq" } ; size = pl}; + +oper mkRegNum2 : Str -> Lin Digit = + \kinsa -> + { s = table { unit => kinsa ; havingunit => kinsa + "yuq" } ; size = pl}; + +lin num x = x ; +-- lin n1 mkRegNum1 "juk"; +lin n2 = mkRegNum1 "iskay"; +lin n3 = mkRegNum2 "kinsa"; +lin n4 = mkRegNum2 "tawa"; +lin n5 = mkRegNum2 "pishq'a" ; +lin n6 = mkRegNum2 "suqta"; +lin n7 = mkRegNum1 "k'anchis" ; +lin n8 = mkRegNum1 "pusaq" ; +lin n9 = mkRegNum1 "isk'un" ; + +lin pot01 = {s = table { unit => "juk" ; havingunit => "juk" + "niyuq" } ; size = sg} ; +lin pot0 d = d ; +lin pot110 = {s = "chunka" ; size = pl } ; +lin pot111 = {s = "chunka" ++ "jukniyuq" ; size = pl } ; +lin pot1to19 d = {s = "chunka" ++ d.s ! havingunit ; size = pl } ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = {s = d.s ! unit ++ "chunka" ; size = pl} ; +lin pot1plus d e = {s = (d.s ! unit ++ "chunka") ++ e.s ! havingunit ; size = pl } ; +lin pot1as2 n = n ; +lin pot2 d = {s = (drop (d.s ! unit)) ! d.size ++ "pachak" ; size = pl} ; +lin pot2plus d e = {s = (drop (d.s ! unit)) ! d.size ++ "pachak" ++ e.s ; size = pl} ; + +lin pot2as3 n = n ; +lin pot3 n = {s = (drop n.s) ! n.size ++ "warank'a"} ; +lin pot3plus n m = {s = (drop n.s) ! n.size ++ "warank'a" ++ m.s} ; + +oper drop : Str -> Size => Str = \s -> table {sg => [] ; pl => s } ; \ No newline at end of file diff --git a/examples/numerals/romanian.gf b/examples/numerals/romanian.gf new file mode 100644 index 000000000..5e6937063 --- /dev/null +++ b/examples/numerals/romanian.gf @@ -0,0 +1,61 @@ +include numerals.Abs.gf ; + +-- Note [s,], [a%] for Romanian s, and a with up bow ontop (not â) + +param DForm = unit | teen | ten | attr ; +param MidForm = indep | det ; +param Size = sg | less20 | pl ; + +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : MidForm => Str ; size : Size} ; +lincat Sub1000 = {s : MidForm => Str ; size : Size} ; + +oper mkNum : Str -> Str -> Str -> Lin Digit = + \two -> \twelve -> \twenty -> mkNumSpc two twelve twenty two ; + +oper mkNumSpc : Str -> Str -> Str -> Str -> Lin Digit = + \two -> \twelve -> \twenty -> \doua -> + {s = table {unit => two ; teen => twelve ; ten => twenty ; attr => doua} ; size = less20} ; + +oper regNum : Str -> Lin Digit = + \trei -> mkNum trei (trei + variants { "sprezece" ; "s,pe" }) (trei + "zeci") ; + +oper ss : Str -> {s : MidForm => Str ; size : Size} = \st -> {s = table {_ => st} ; size = less20} ; + +lin num x = {s = "/L" ++ x.s ++ "L/" }; -- Latin A Supplement chars +lin n2 = mkNumSpc "doi" (variants { "doisprezece" ; "doua%sprezece" }) "doua%zeci" "doua%" ; +lin n3 = regNum "trei" ; +lin n4 = mkNum "patru" (variants{"paisprezece" ; "pais,pe"}) "patruzeci" ; +lin n5 = mkNumSpc "cinci" (variants{"cinsprezece" ; "cins,pe"}) "cinzeci" (variants { "cinci" ; "cin" }); +lin n6 = mkNum "s,ase" (variants{"s,aisprezece" ; "s,aispe"}) "s,aizeci" ; +lin n7 = mkNum "s,apte" (variants{"s,aptesprezece" ; "s,apspe"}) "s,aptezeci" ; +lin n8 = mkNum "opt" (variants{"optsprezece" ; "opspe"}) "optzeci" ; +lin n9 = regNum "noua%" ; + +lin pot01 = {s = table {attr => "o" ; f => "unu"} ; size = sg} ; +lin pot0 d = d ; +lin pot110 = ss "zece" ; +lin pot111 = ss (variants { "unsprezece" ; "uns,pe"}) ; +lin pot1to19 d = {s = table {_ => d.s ! teen } ; size = less20} ; +lin pot0as1 n = {s = table {indep => n.s ! unit ; det => n.s ! attr } ; size = n.size} ; +lin pot1 d = {s = table {_ => d.s ! ten } ; size = pl} ; +lin pot1plus d e = + {s = table {indep => d.s ! ten ++ "s,i" ++ e.s ! unit ; + det => d.s ! ten ++ "s,i" ++ e.s ! attr } ; + size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = table {_ => d.s ! attr ++ (mksute d.size) }; size = pl} ; +lin pot2plus d e = + {s = table {indep => d.s ! attr ++ (mksute d.size) ++ e.s ! indep; + det => d.s ! attr ++ (mksute d.size) ++ e.s ! det }; + size = pl} ; +lin pot2as3 n = {s = n.s ! indep }; +lin pot3 n = {s = (mkmie n.size (n.s ! det) (n.s ! indep))} ; +lin pot3plus n m = {s = (mkmie n.size (n.s ! det) (n.s ! indep)) ++ m.s ! indep} ; + +oper mksute : Size -> Str = \sz -> table {sg => "suta" ; _ => "sute" } ! sz ; +oper mkmie : Size -> Str -> Str -> Str = \sz -> \attr -> \indep -> + table {sg => "o" ++ "mie" ; + less20 => attr ++ "mii" ; + pl => indep ++ "de" ++ "mii"} ! sz ; diff --git a/examples/numerals/russian.gf b/examples/numerals/russian.gf new file mode 100644 index 000000000..7e08361fa --- /dev/null +++ b/examples/numerals/russian.gf @@ -0,0 +1,111 @@ +include numerals.Abs.gf ; + +-- Toiska, 13/8/2000, AR with Arto Mustajoki. + +param DForm = unit | teen | ten | hund ; +param Place = attr | indep ; +param Size = nom | sgg | plg ; +param Gen = masc | fem | neut ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Gen => Str ; size : Size} ; +lincat Sub10 = {s : Place => DForm => Gen => Str ; size : Size} ; +lincat Sub100 = {s : Place => Gen => Str ; size : Size} ; +lincat Sub1000 = {s : Place => Gen => Str ; size : Size} ; +lincat Sub1000000 = {s : Gen => Str} ; + +oper mille : Size => Str = table { + {nom} => "t1säqa" ; + {sgg} => "t1säqi" ; + _ => "t1säq"} ; + +oper gg : Str -> Gen => Str = \s -> table {_ => s} ; + +lin num x0 = + {s = "/_" ++ x0.s ! masc ++ "_/"} ; -- Russian environment + +lin n2 = + {s = table {{unit} => table {{fem} => "dve" ; _ => "dva"} ; + {teen} => gg "dvenadcat'" ; + {ten} => gg "dvadcat'" ; + {hund} => gg "dvesti"} ; + size = sgg} ; +lin n3 = + {s = table {{unit} => gg "tri" ; + {teen} => gg "trinadcat'" ; + {ten} => gg "tridcat'" ; + {hund} => gg "trista"} ; + size = sgg} ; +lin n4 = + {s = table {{unit} => gg "qet1re" ; + {teen} => gg "qet1rnadcat'" ; + {ten} => gg "sorok" ; + {hund} => gg "qet1resta"} ; + size = sgg} ; +lin n5 = + {s = table {{unit} => gg "pät'" ; + {teen} => gg "pätnadcat'" ; + {ten} => gg "pät'desät" ; + {hund} => gg "pät'sot"} ; + size = plg} ; +lin n6 = + {s = table {{unit} => gg "west'" ; + {teen} => gg "westnadcat'" ; + {ten} => gg "west'desät" ; + {hund} => gg "west'sot"} ; + size = plg} ; +lin n7 = + {s = table {{unit} => gg "sem'" ; + {teen} => gg "semnadcat'" ; + {ten} => gg "sem'desät" ; + {hund} => gg "sem'sot"} ; + size = plg} ; +lin n8 = + {s = table {{unit} => gg "vosem'" ; + {teen} => gg "vosemnadcat'" ; + {ten} => gg "vosem'desät" ; + {hund} => gg "vosem'sot"} ; + size = plg} ; +lin n9 = + {s = table {{unit} => gg "devät'" ; + {teen} => gg "devätnadcat'" ; + {ten} => gg "devänosto" ; + {hund} => gg "devät'sot"} ; + size = plg} ; + + +lin pot01 = + {s = table {{attr} => table {{hund} => gg "sto" ; _ => gg []} ; + _ => table {{hund} => gg "sto" ; + _ => table {{masc} => "odin" ; {fem} => "odna" ; _ => "odno"}}} ; + size = nom} ; +lin pot0 d = + {s = table {_ => d.s} ; size = d.size} ; +lin pot110 = + {s = table {_ => gg "desät'"} ; size = plg} ; +lin pot111 = + {s = table {_ => gg "odinnadcat'"} ; size = plg} ; --- 11 +lin pot1to19 d = + {s = table {_ => d.s ! teen} ; size = plg} ; +lin pot0as1 n = + {s = table {p => n.s ! p ! unit} ; size = n.size} ; +lin pot1 d = + {s = table {_ => d.s ! ten} ; size = plg} ; --- +lin pot1plus d e = + {s = table {_ => + table {g => d.s ! ten ! g ++ e.s ! indep ! unit ! g}} ; size = e.size} ; +lin pot1as2 n = + {s = n.s ; size = n.size} ; +lin pot2 d = + {s = table {p => d.s ! p ! hund} ; size = plg} ; +lin pot2plus d e = + {s = table {p => table {g => d.s ! p ! hund ! g ++ e.s ! indep ! g}} ; size = e.size} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = gg (n.s ! attr ! fem ++ mille ! n.size)} ; +lin pot3plus n m = + {s = table {g => n.s ! attr ! fem ++ mille ! n.size ++ m.s ! indep ! g}} ; + +--- TODO +--- raz/odin + diff --git a/examples/numerals/sango.gf b/examples/numerals/sango.gf new file mode 100644 index 000000000..f96874ede --- /dev/null +++ b/examples/numerals/sango.gf @@ -0,0 +1,63 @@ +include numerals.Abs.gf ; + +param Size = sg | pl | over10; + +oper Form = {s : Str ; size : Size } ; + +lincat Numeral = {s : Str} ; +lincat Digit = Form ; +lincat Sub10 = Form ; +lincat Sub100 = Form ; +lincat Sub1000 = Form ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; -- TODO: Encoding + +oper mkNum : Str -> Form = \mbili -> + {s = mbili ; size = pl }; + +-- O IPA for o in cod +-- Ó + +-- lin n1 = mkNum "ÓkO" ; +lin n2 = mkNum "óse" ; +lin n3 = mkNum "otá" ; +lin n4 = mkNum "osió" ; +lin n5 = mkNum "ukú" ; +lin n6 = mkNum "omaná" ; +lin n7 = mkNum "mbásámbárá" ; +lin n8 = mkNum "miombe" ; +lin n9 = mkNum "ngombáyá" ; + +oper nandoni : Str = ("na" ++ variants {"ndó" ++ "ní" ; []}) ; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = over10} ; + +lin pot01 = {s = "ÓkO" ; size = sg }; +lin pot0 d = d ; +lin pot110 = ss ("bale" ++ "ÓkO"); +lin pot111 = ss ("bale" ++ "ÓkO" ++ nandoni ++ "ÓkO"); +lin pot1to19 d = ss ("bale" ++ "ÓkO" ++ nandoni ++ d.s); +lin pot0as1 n = n ; +lin pot1 d = ss ("bale" ++ d.s ) ; +lin pot1plus d e = ss ("bale" ++ d.s ++ nandoni ++ e.s ) ; +lin pot1as2 n = n ; +lin pot2 d = ss (mkng d.size d.s) ; +lin pot2plus d e = ss ((mkng d.size d.s) ++ nandoni ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = mktau n.size n.s } ; +lin pot3plus n m = {s = mktau n.size (n.s ++ nandoni ++ m.s) } ; + +oper mkng : Size -> Str -> Str = \sz -> \attr -> + table {pl => "ngbangbu" ++ attr ; + over10 => "dummy" ; + sg => variants {"ngbangbu" ++ "ÓkO"; "ngbangbu" }} ! sz ; + +oper mktau : Size -> Str -> Str = \sz -> \attr -> + table {pl => "ngbangbu" ++ "bale" ++ attr ; + over10 => "N/A" ; + sg => variants {"ngbangbu" ++ "bale"; "kutu"} ++ attr} ! sz ; + + + + diff --git a/examples/numerals/sanskrit.gf b/examples/numerals/sanskrit.gf new file mode 100644 index 000000000..be092b3ee --- /dev/null +++ b/examples/numerals/sanskrit.gf @@ -0,0 +1,197 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten ; +param DSize = sg | r2 | r3 | r4 | r5 | r6 | r7 | r8 | r9 ; +param Size = sing | dual | less10 | more100 | more10 ; + + +oper + vowel : Strs = strs {"a" ; "e" ; "i" ; "u" ; "o"} ; + dental : Strs = strs {"n"; "t"; "d"} ; + labial : Strs = strs {"m"; "p"; "b"} ; + velar : Strs = strs {"G"; "k"; "g"} ; + affricate : Strs = strs {"ñ" ; "c"; "j" } ; + retroflex : Strs = strs {"N" ; "T" ; "D"; "S"} ; + sibilant : Strs = strs {"ç" ; "s"; "h"; "r"} ; -- r also + unvoiced : Strs = strs {"k"; "p"; "c"; "t"} ; + +oper + S : Str = pre {"S" ; "T" / unvoiced ; "D" / vowel } ; + as : Str = pre {"o" ; "as" / unvoiced ; "a;" / sibilant } ; + i : Str = pre {"i" ; "y" / vowel } ; + am : Str = "a" + (pre {"m" ; "n" / dental ; "G" / velar ; "ñ" / affricate ; "N" / retroflex ; "M" / sibilant}) ; + a_ : Str = pre { "a:" ; "a" / vowel } ; -- shortened if a follows (no other vowel occur initally) + r : Str = pre {"r" ; "s" / unvoiced ; "c" / affricate ; ";" / sibilant } ; + t : Str = pre {"t" ; "c" / affricate ; "T" / retroflex } ; + + +LinDigit = {s : DForm => Str ; size : DSize} ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str ; size : DSize} ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; + +lin num x0 = + {s = "/&" ++ x0.s ++ "&/"} ; -- the Devanagari environment + +oper mkNum : Str -> Str -> DSize -> LinDigit = + \u -> \t -> \sz -> + {s = table {unit => u ; ten => t } ; size = sz } ; + +-- lin n1 mkNum "eka" daca ... ; +lin n2 = mkNum "dva" viMcati r2 ; +lin n3 = mkNum ("tr" + i) triMcat r3 ; +lin n4 = mkNum ("catu" + r) catvariMcat r4 ; +lin n5 = mkNum "pañca" pancacat r5 ; +lin n6 = mkNum ("Sa" + S) SaSTi r6 ; +lin n7 = mkNum "sapta" saptati r7 ; +lin n8 = mkNum "aSTa" aciti r8; +lin n9 = mkNum "nava" navati r9 ; + +oper daca : Str = "daça" ; +oper viMcati : Str = "viMçat" + i; +oper triMcat : Str = "triMça" + t; +oper catvariMcat : Str = "catva:riMça" + t ; +oper pancacat : Str = "pañca:ça" + t; +oper SaSTi : Str = "SaST" + i; +oper saptati : Str = "saptat" + i ; +oper aciti : Str = "açi:t" + i ; +oper navati : Str = "navat" + i ; + +oper mkR1 : Str -> Str -> DSize => Str = \a1 -> \a2 -> table { + sg => a1 + daca ; + r2 => a2 + viMcati ; + r3 => a2 + triMcat ; + r4 => a2 + catvariMcat ; + r5 => a2 + pancacat ; + r6 => a2 + SaSTi ; + r7 => a2 + saptati ; + r8 => a2 + aciti ; + r9 => a2 + navati +} ; + +oper mkR : Str -> DSize => Str = \a1 -> table { + sg => a1 + daca ; + r2 => a1 + viMcati ; + r3 => a1 + triMcat ; + r4 => a1 + catvariMcat ; + r5 => a1 + pancacat ; + r6 => a1 + SaSTi ; + r7 => a1 + saptati ; + r8 => a1 + aciti ; + r9 => a1 + navati +} ; + +oper mkR9 : Str -> DSize => Str = \a1 -> table { + sg => variants {a1 + daca ; "u:na:" + viMcati} ; + r2 => variants {a1 + viMcati ; "u:na:" + triMcat } ; + r3 => variants {a1 + triMcat ; "u:na:" + catvariMcat } ; + r4 => variants {a1 + catvariMcat ; "u:na:" + pancacat } ; + r5 => variants {a1 + pancacat ; "u:na:" + SaSTi } ; + r6 => variants {a1 + SaSTi ; "u:na:" + saptati } ; + r7 => variants {a1 + saptati ; "u:na:" + aciti } ; + r8 => variants {a1 + aciti ; "u:na:" + navati } ; + r9 => variants {a1 + navati ; "u:na:" + cata } +} ; + +oper mkR3 : Str -> Str -> DSize => Str = \a1 -> \a2 -> table { + sg => a1 + daca ; + r2 => a1 + viMcati ; + r3 => a1 + triMcat ; + r4 => variants { a2 + catvariMcat ; a1 + catvariMcat } ; + r5 => variants { a2 + pancacat ; a1 + pancacat } ; + r6 => variants { a2 + SaSTi ; a1 + SaSTi } ; + r7 => variants { a2 + saptati ; a1 + saptati } ; + r8 => a2 + aciti ; + r9 => variants { a2 + navati ; a1 + navati } +} ; + +oper mkR6 : Str -> DSize => Str = \a1 -> table { + sg => "SoDaça" ; + r2 => a1 + viMcati ; + r3 => a1 + triMcat ; + r4 => a1 + catvariMcat ; + r5 => a1 + pancacat ; + r6 => a1 + SaSTi ; + r7 => a1 + saptati ; + r8 => a1 + aciti ; + r9 => "SoNNavat" + i +} ; + +oper rows : DSize => DSize => Str = table { + sg => mkR1 ("ek" + a_) eka ; + r2 => mkR3 ("dv" + a_) ("dv" + i) ; + r3 => mkR3 ("tray" + as) ("tr" + i) ; + r4 => mkR ("catu" + r) ; + r5 => mkR "pañca" ; + r6 => mkR6 ("Sa" + S) ; + r7 => mkR "sapta" ; + r8 => mkR3 ("aST" + a_) "aSTa" ; + r9 => mkR9 "nava" +} ; + +oper eka : Str = "eka" ; + +lin pot01 = {s = table {unit => eka ; ten => daca } ; size = sg} ; +lin pot0 d = d ; +lin pot110 = {s = daca ; s2 = variants { ayuta ; mksahasra2 more10 daca }; size = more10} ; +lin pot111 = {s = rows ! sg ! sg ; + s2 = mkayutamore eka sg eka sg ; + size = more10} ; +lin pot1to19 d = + {s = rows ! d.size ! sg ; + s2 = mkayutamore eka sg (d.s ! unit) d.size; + size = more10} ; +lin pot0as1 n = {s = n.s ! unit ; + s2 = mksahasra n.size (n.s ! unit) ; + size = table {sg => sing ; r2 => dual ; _ => less10} ! n.size }; +lin pot1 d = {s = d.s ! ten ; + s2 = variants {mkayuta d.size (d.s ! unit) ; mksahasra2 more10 (d.s ! ten) } ; + size = more10} ; +lin pot1plus d e = {s = rows ! e.size ! d.size ; + s2 = mkayutamore (d.s ! unit) d.size (e.s ! unit) e.size ; + size = more10} ; +lin pot1as2 n = {s = n.s ; s2 = n.s2 ; size = n.size } ; +lin pot2 d = + {s = mkcata d.size (d.s ! unit); + s2 = mklakh d.size (d.s ! unit) ; + size = more100} ; + +lin pot2plus d e = + {s = hundredplusunit (mkcata d.size (d.s ! unit)) e.s ; + s2 = lakhplus (mklakh d.size (d.s ! unit)) e.s2 ; + size = more100} ; + +lin pot2as3 n = {s = n.s } ; +lin pot3 n = + {s = table {more10 => n.s2 ; + _ => mksahasra2 n.size n.s } ! n.size} ; + +lin pot3plus n m = + {s = p3plus (table {more10 => n.s2 ; _ => mksahasra2 n.size n.s } ! n.size) n.size m.s m.size} ; + +oper mksahasra2 : Size -> Str -> Str = \sz -> \s -> table {sing => "sahasr" + am ; dual => "dve" ++ "sahasre" ; _ => s ++ ("sahasra:N" + i)} ! sz ; +oper mksahasra : DSize -> Str -> Str = \sz -> \s -> table {sg => "sahasr" + am ; r2 => "dve" ++ "sahasre" ; _ => s ++ ("sahasra:N" + i)} ! sz ; +oper mkcata : DSize -> Str -> Str = \sz -> \s -> table {sg => cata ; r2 => variants {"dve" ++ "çate" ; "dvi:" + cata }; _ => s ++ ("çata:n" + i)} ! sz ; +oper mklakh : DSize -> Str -> Str = \sz -> \s -> table {sg => "lakS" + am ; r2 => "dve" ++ "lakSe" ; _ => s ++ ("lakSa:N" + i) } ! sz ; +oper mklakh2 : Size -> Str -> Str = \sz -> \s -> table {sing => "lakS" + am ; dual => "dve" ++ "lakSe" ; _ => s ++ ("lakSa:N" + i) } ! sz ; + +oper mkayuta : DSize -> Str -> Str = \sz -> \s -> table {sg => "ayut" + am ; r2 => "dve" ++ "ayute" ; _ => s ++ ("ayuta:n" + i)} ! sz ; + +oper adhikam : Str = "adHik" + am ; +oper ca : Str = "ca" ; +oper ayuta : Str = "ayut" + am ; +oper cata : Str = "çat" + am ; + +oper hundredplusunit : Str -> Str -> Str = \hun -> \unit -> + variants {hun ++ unit ++ "ca" ; unit ++ adhikam ++ hun}; + +oper lakhplus : Str -> Str -> Str = \lakh -> \low -> lakh ++ low ++ ca ; + +oper p3plus : Str -> Size -> Str -> Size -> Str = \b -> \bs -> \s -> \ss -> table {more10 => table {more10 => b ++ ca ++ s ++ ca ; _ => s ++ adhikam ++ b} ! ss; + _ => table {more10 => b ++ s ++ ca ; _ => s ++ b} ! ss } ! bs; + +mkayutamore : Str -> DSize -> Str -> DSize -> Str = \d -> \ds -> \e -> \es -> + variants {(mkayuta ds d) ++ (mksahasra es e) ; + mklakh2 more10 (rows ! es ! ds) } ; + diff --git a/examples/numerals/slovak.gf b/examples/numerals/slovak.gf new file mode 100644 index 000000000..9e781429e --- /dev/null +++ b/examples/numerals/slovak.gf @@ -0,0 +1,60 @@ +include numerals.Abs.gf ; + +-- by Karol Ostrovsky, Chalmers +-- mechanically translated to new GF notation by AR + +param DForm = unit | teen | ten ; +param Place = indep | prae ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : {p1 : DForm ; p2 : Place} => Str} ; +lincat Sub10 = {s : {p1 : DForm ; p2 : Place} => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = table {{p1 = unit ; p2 = indep} => "dva" ; {p1 = unit ; p2 = prae} => "dve" ; {p1 = teen ; p2 = indep} => "dvanast" ; {p1 = teen ; p2 = prae} => "dvanast" ; {p1 = ten ; p2 = indep} => "dvadsat" ; {p1 = ten ; p2 = prae} => "dvadsat"}} ; +lin n3 = + {s = table {{p1 = unit ; p2 = indep} => "tri" ; {p1 = unit ; p2 = prae} => "tri" ; {p1 = teen ; p2 = indep} => "trinast" ; {p1 = teen ; p2 = prae} => "trinast" ; {p1 = ten ; p2 = indep} => "tridsat" ; {p1 = ten ; p2 = prae} => "tridsat"}} ; +lin n4 = + {s = table {{p1 = unit ; p2 = indep} => "styri" ; {p1 = unit ; p2 = prae} => "styri" ; {p1 = teen ; p2 = indep} => "strnast" ; {p1 = teen ; p2 = prae} => "strnast" ; {p1 = ten ; p2 = indep} => "styridsat" ; {p1 = ten ; p2 = prae} => "styridsat"}} ; +lin n5 = + {s = table {{p1 = unit ; p2 = indep} => "pat" ; {p1 = unit ; p2 = prae} => "pat" ; {p1 = teen ; p2 = indep} => "patnast" ; {p1 = teen ; p2 = prae} => "patnast" ; {p1 = ten ; p2 = indep} => "patdesiat" ; {p1 = ten ; p2 = prae} => "patdesiat"}} ; +lin n6 = + {s = table {{p1 = unit ; p2 = indep} => "sest" ; {p1 = unit ; p2 = prae} => "sest" ; {p1 = teen ; p2 = indep} => "sestnast" ; {p1 = teen ; p2 = prae} => "sestnast" ; {p1 = ten ; p2 = indep} => "sestdesiat" ; {p1 = ten ; p2 = prae} => "sestdesiat"}} ; +lin n7 = + {s = table {{p1 = unit ; p2 = indep} => "sedem" ; {p1 = unit ; p2 = prae} => "sedem" ; {p1 = teen ; p2 = indep} => "sedemnast" ; {p1 = teen ; p2 = prae} => "sedemnast" ; {p1 = ten ; p2 = indep} => "sedemdesiat" ; {p1 = ten ; p2 = prae} => "sedemdesiat"}} ; +lin n8 = + {s = table {{p1 = unit ; p2 = indep} => "osem" ; {p1 = unit ; p2 = prae} => "osem" ; {p1 = teen ; p2 = indep} => "osemnast" ; {p1 = teen ; p2 = prae} => "osemnast" ; {p1 = ten ; p2 = indep} => "osemdesiat" ; {p1 = ten ; p2 = prae} => "osemdesiat"}} ; +lin n9 = + {s = table {{p1 = unit ; p2 = indep} => "devat" ; {p1 = unit ; p2 = prae} => "devat" ; {p1 = teen ; p2 = indep} => "devatnast" ; {p1 = teen ; p2 = prae} => "devatnast" ; {p1 = ten ; p2 = indep} => "devatdesiat" ; {p1 = ten ; p2 = prae} => "devatdesiat"}} ; +lin pot01 = + {s = table {{p1 = unit ; p2 = indep} => "jedna" ; {p1 = unit ; p2 = prae} => [] ; {p1 = teen ; p2 = indep} => "jedna" ; {p1 = teen ; p2 = prae} => [] ; {p1 = ten ; p2 = indep} => "jedna" ; {p1 = ten ; p2 = prae} => []}} ; +lin pot0 d = + {s = table {{p1 = unit ; p2 = indep} => d.s ! {p1 = unit ; p2 = indep} ; {p1 = unit ; p2 = prae} => d.s ! {p1 = unit ; p2 = prae} ; {p1 = teen ; p2 = indep} => d.s ! {p1 = teen ; p2 = indep} ; {p1 = teen ; p2 = prae} => d.s ! {p1 = teen ; p2 = prae} ; {p1 = ten ; p2 = indep} => d.s ! {p1 = ten ; p2 = indep} ; {p1 = ten ; p2 = prae} => d.s ! {p1 = ten ; p2 = prae}}} ; +lin pot110 = + {s = table {indep => "desat" ; prae => "desat"}} ; +lin pot111 = + {s = table {indep => "jedenast" ; prae => "jedenast"}} ; +lin pot1to19 d = + {s = table {indep => d.s ! {p1 = teen ; p2 = indep} ; prae => d.s ! {p1 = teen ; p2 = prae}}} ; +lin pot0as1 n = + {s = table {indep => n.s ! {p1 = unit ; p2 = indep} ; prae => n.s ! {p1 = unit ; p2 = indep}}} ; +lin pot1 d = + {s = table {indep => d.s ! {p1 = ten ; p2 = indep} ; prae => d.s ! {p1 = ten ; p2 = prae}}} ; +lin pot1plus d e = + {s = table {indep => (d.s ! {p1 = ten ; p2 = indep}) ++ e.s ! {p1 = unit ; p2 = indep} ; prae => (d.s ! {p1 = ten ; p2 = prae}) ++ e.s ! {p1 = unit ; p2 = indep}}} ; +lin pot1as2 n = + {s = table {indep => n.s ! indep ; prae => n.s ! indep}} ; +lin pot2 d = + {s = table {indep => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto" ; prae => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto"}} ; +lin pot2plus d e = + {s = table {indep => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto" ++ e.s ! indep ; prae => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto" ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = (n.s ! prae) ++ "tisic"} ; +lin pot3plus n m = + {s = (n.s ! prae) ++ "tisic" ++ m.s ! indep} ; diff --git a/examples/numerals/sorani.gf b/examples/numerals/sorani.gf new file mode 100644 index 000000000..0b62c6039 --- /dev/null +++ b/examples/numerals/sorani.gf @@ -0,0 +1,90 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten | teen | hund | kilurrest | kilurresthAzar ; +param Size = sg | less500 | fiveup | more500 ; + +-- From Manuel de Kurde (dialecte Sorani). +-- +-- [W] is waw with a horizontal line above +-- [E] is a ye with a horizonytal line above +-- [A] shouldnt have dots (= ta marbuta; also inside a word) +-- [p] is be with three dots below like Persian +-- [j] is djim like normal, like arabic (not ye) +-- [O] is a waw with a hacek above +-- [F] is a fa with three dots above (i.e v) +-- [Z] is a zain with three dots above (i.e zh) +-- [I] is a ye with a horizontal line above +-- [C] is a djim with three dots below like Persian (i.e ch) +-- [c] is shin (i.e sh) +-- [H] is Arabic Ha (= djim without dots) + +-- [P] is a Ha with a hamza above +-- [R] is an r with a ring below + +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; + +lin num x0 = + {s = "/A" ++ x0.s ++ "A/"} ; -- the Arabic environment + +oper mkNum : Str -> Str -> Str -> Lin Digit = + \dwA -> \cl -> \dwwls -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; hund => dwA + "sAd" ; + kilurrest => "dummy" ; kilurresthAzar => "dummy" } ; size = less500}; + +oper mkNum6 : Str -> Str -> Str -> Str -> Str -> Lin Digit = + \dwA -> \cl -> \dwwls -> \pEn -> \rest -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; hund => pEn + "sAd" ; + kilurrest => rest + "sAd" ; kilurresthAzar => rest + "sAd" ++ "hAzar"} ; size = fiveup} ; + +-- lin n1 mkNum "yAk" "dA" variants { "yazdA" ; "yanzA"} [] ; +lin n2 = mkNum "dW" "bIst" (variants { "dwwazdA" ; "dwwanzA" }) ; +lin n3 = mkNum "sE" "sI" (variants { "sEzdA" ; "syanzA" }) ; +lin n4 = mkNum "Cwwar" "Pl" "CwwardA" ; +lin n5 = {s = table {unit => "pEnj" ; + ten => "pAnja" ; + teen => (variants { "pazdA" ; "panzA" }) ; + hund => "pEn" + "sAd"; + kilurrest => [] ; + kilurresthAzar => [] } ; + size = fiveup } ; + +lin n6 = mkNum6 "cAc" "cAst" (variants { "cazdA"; "canzA"}) "cAc" [] ; +lin n7 = mkNum6 "HAwt" "HAfta" "HAFdA" "HAw" "dW" ; +lin n8 = mkNum6 "hAct" "hActa" "hAZdA" "hAc" "sE" ; +lin n9 = mkNum6 "nO" "nAwAd" "nOzdA" "nO" "Cwwar" ; + +oper ss : Str -> {s : Str ; size : Size} = \s -> {s = s ; size = less500} ; + +lin pot01 = {s = table {unit => "yAk" ; hund => "sAd" ; _ => "dummy" } ; size = sg } ; +lin pot0 d = {s = table {f => d.s ! f} ; size = d.size} ; +lin pot110 = ss "dA" ; +lin pot111 = ss (variants { "yazdA" ; "yanzA"}); +lin pot1to19 d = {s = d.s ! teen ; size = less500 } ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; size = less500} ; +lin pot1plus d e = {s = (d.s ! ten) ++ "w" ++ (e.s ! unit); size = less500} ; +lin pot1as2 n = {s = n.s ; s2 = "dummy" ; size = n.size } ; +lin pot2 d = {s = d.s ! hund ; s2 = "klWr" ++ d.s ! kilurresthAzar ; size = isover500 d.size} ; +lin pot2plus d e = + {s = d.s ! hund ++ e.s ; + s2 = "klWr" ++ d.s ! kilurrest ++ (mkhAzar e.s "dummy") ! e.size ; + size = isover500 d.size} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = (mkhAzar n.s n.s2) ! n.size } ; +lin pot3plus n m = {s =(mkhAzar n.s n.s2) ! n.size ++ m.s} ; + +oper isover500 : Size -> Size = \sz -> + table {fiveup => more500 ; _ => less500} ! sz ; + +oper mkhAzar : Str -> Str -> Size => Str = \attr -> \kilur -> + table {sg => "hAzar" ; + fiveup => attr ++ "hAzar" ; + less500 => attr ++ "hAzar" ; + more500 => kilur} ; + + + + diff --git a/examples/numerals/spanish.gf b/examples/numerals/spanish.gf new file mode 100644 index 000000000..30d7e46a4 --- /dev/null +++ b/examples/numerals/spanish.gf @@ -0,0 +1,61 @@ +include numerals.Abs.gf ; + +-- by Carlos Gonzalia, Chalmers, 1999 +-- original source automatically translated to new GF by AR + +param DForm = unit | teen | ten | hundred ; +param Modif = mod | unmod | conj ; + +lincat Numeral = {s : Str} ; +lincat Digit = {inh : Modif ; s : {p1 : DForm ; p2 : Modif} => Str} ; +lincat Sub10 = {s : {p1 : DForm ; p2 : Modif} => Str} ; +lincat Sub100 = {s : Str} ; +lincat Sub1000 = {s : Str} ; +lincat Sub1000000 = {s : Str} ; + +lin num x0 = + {s = x0.s} ; +lin n2 = + {inh = mod ; s = table {{p1 = unit ; p2 = mod} => "dos" ; {p1 = unit ; p2 = unmod} => "dos" ; {p1 = unit ; p2 = conj} => "y" ++ "dos" ; {p1 = teen ; p2 = mod} => "doce" ; {p1 = teen ; p2 = unmod} => "doce" ; {p1 = teen ; p2 = conj} => "doce" ; {p1 = ten ; p2 = mod} => "veinti" ; {p1 = ten ; p2 = unmod} => "veinte" ; {p1 = ten ; p2 = conj} => "veinte" ; {p1 = hundred ; p2 = mod} => "doscientos" ; {p1 = hundred ; p2 = unmod} => "doscientos" ; {p1 = hundred ; p2 = conj} => "doscientos"}} ; +lin n3 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "tres" ; {p1 = unit ; p2 = unmod} => "tres" ; {p1 = unit ; p2 = conj} => "y" ++ "tres" ; {p1 = teen ; p2 = mod} => "trece" ; {p1 = teen ; p2 = unmod} => "trece" ; {p1 = teen ; p2 = conj} => "trece" ; {p1 = ten ; p2 = mod} => "treinta" ; {p1 = ten ; p2 = unmod} => "treinta" ; {p1 = ten ; p2 = conj} => "treinta" ; {p1 = hundred ; p2 = mod} => "trescientos" ; {p1 = hundred ; p2 = unmod} => "trescientos" ; {p1 = hundred ; p2 = conj} => "trescientos"}} ; +lin n4 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "cuatro" ; {p1 = unit ; p2 = unmod} => "cuatro" ; {p1 = unit ; p2 = conj} => "y" ++ "cuatro" ; {p1 = teen ; p2 = mod} => "catorce" ; {p1 = teen ; p2 = unmod} => "catorce" ; {p1 = teen ; p2 = conj} => "catorce" ; {p1 = ten ; p2 = mod} => "cuarenta" ; {p1 = ten ; p2 = unmod} => "cuarenta" ; {p1 = ten ; p2 = conj} => "cuarenta" ; {p1 = hundred ; p2 = mod} => "cuatrocientos" ; {p1 = hundred ; p2 = unmod} => "cuatrocientos" ; {p1 = hundred ; p2 = conj} => "cuatrocientos"}} ; +lin n5 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "cinco" ; {p1 = unit ; p2 = unmod} => "cinco" ; {p1 = unit ; p2 = conj} => "y" ++ "cinco" ; {p1 = teen ; p2 = mod} => "quince" ; {p1 = teen ; p2 = unmod} => "quince" ; {p1 = teen ; p2 = conj} => "quince" ; {p1 = ten ; p2 = mod} => "cincuenta" ; {p1 = ten ; p2 = unmod} => "cincuenta" ; {p1 = ten ; p2 = conj} => "cincuenta" ; {p1 = hundred ; p2 = mod} => "quinientos" ; {p1 = hundred ; p2 = unmod} => "quinientos" ; {p1 = hundred ; p2 = conj} => "quinientos"}} ; +lin n6 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "seis" ; {p1 = unit ; p2 = unmod} => "seis" ; {p1 = unit ; p2 = conj} => "y" ++ "seis" ; {p1 = teen ; p2 = mod} => "dieciseis" ; {p1 = teen ; p2 = unmod} => "dieciseis" ; {p1 = teen ; p2 = conj} => "dieciseis" ; {p1 = ten ; p2 = mod} => "sesenta" ; {p1 = ten ; p2 = unmod} => "sesenta" ; {p1 = ten ; p2 = conj} => "sesenta" ; {p1 = hundred ; p2 = mod} => "seiscientos" ; {p1 = hundred ; p2 = unmod} => "seiscientos" ; {p1 = hundred ; p2 = conj} => "seiscientos"}} ; +lin n7 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "siete" ; {p1 = unit ; p2 = unmod} => "siete" ; {p1 = unit ; p2 = conj} => "y" ++ "siete" ; {p1 = teen ; p2 = mod} => "diecisiete" ; {p1 = teen ; p2 = unmod} => "diecisiete" ; {p1 = teen ; p2 = conj} => "diecisiete" ; {p1 = ten ; p2 = mod} => "setenta" ; {p1 = ten ; p2 = unmod} => "setenta" ; {p1 = ten ; p2 = conj} => "setenta" ; {p1 = hundred ; p2 = mod} => "setecientos" ; {p1 = hundred ; p2 = unmod} => "setecientos" ; {p1 = hundred ; p2 = conj} => "setecientos"}} ; +lin n8 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "ocho" ; {p1 = unit ; p2 = unmod} => "ocho" ; {p1 = unit ; p2 = conj} => "y" ++ "ocho" ; {p1 = teen ; p2 = mod} => "dieciocho" ; {p1 = teen ; p2 = unmod} => "dieciocho" ; {p1 = teen ; p2 = conj} => "dieciocho" ; {p1 = ten ; p2 = mod} => "ochenta" ; {p1 = ten ; p2 = unmod} => "ochenta" ; {p1 = ten ; p2 = conj} => "ochenta" ; {p1 = hundred ; p2 = mod} => "ochocientos" ; {p1 = hundred ; p2 = unmod} => "ochocientos" ; {p1 = hundred ; p2 = conj} => "ochocientos"}} ; +lin n9 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "nueve" ; {p1 = unit ; p2 = unmod} => "nueve" ; {p1 = unit ; p2 = conj} => "y" ++ "nueve" ; {p1 = teen ; p2 = mod} => "diecinueve" ; {p1 = teen ; p2 = unmod} => "diecinueve" ; {p1 = teen ; p2 = conj} => "diecinueve" ; {p1 = ten ; p2 = mod} => "noventa" ; {p1 = ten ; p2 = unmod} => "noventa" ; {p1 = ten ; p2 = conj} => "noventa" ; {p1 = hundred ; p2 = mod} => "novecientos" ; {p1 = hundred ; p2 = unmod} => "novecientos" ; {p1 = hundred ; p2 = conj} => "novecientos"}} ; +lin pot01 = + {s = table {{p1 = unit ; p2 = mod} => "uno" ; {p1 = unit ; p2 = unmod} => "uno" ; {p1 = unit ; p2 = conj} => "y" ++ "uno" ; {p1 = teen ; p2 = mod} => "uno" ; {p1 = teen ; p2 = unmod} => "uno" ; {p1 = teen ; p2 = conj} => "y" ++ "uno" ; {p1 = ten ; p2 = mod} => "uno" ; {p1 = ten ; p2 = unmod} => "uno" ; {p1 = ten ; p2 = conj} => "y" ++ "uno" ; {p1 = hundred ; p2 = mod} => "ciento" ; {p1 = hundred ; p2 = unmod} => "cien" ; {p1 = hundred ; p2 = conj} => "y" ++ "uno"}} ; +lin pot0 d = + {s = table {{p1 = unit ; p2 = mod} => d.s ! {p1 = unit ; p2 = mod} ; {p1 = unit ; p2 = unmod} => d.s ! {p1 = unit ; p2 = unmod} ; {p1 = unit ; p2 = conj} => d.s ! {p1 = unit ; p2 = conj} ; {p1 = teen ; p2 = mod} => d.s ! {p1 = teen ; p2 = mod} ; {p1 = teen ; p2 = unmod} => d.s ! {p1 = teen ; p2 = unmod} ; {p1 = teen ; p2 = conj} => d.s ! {p1 = teen ; p2 = conj} ; {p1 = ten ; p2 = mod} => d.s ! {p1 = ten ; p2 = mod} ; {p1 = ten ; p2 = unmod} => d.s ! {p1 = ten ; p2 = unmod} ; {p1 = ten ; p2 = conj} => d.s ! {p1 = ten ; p2 = conj} ; {p1 = hundred ; p2 = mod} => d.s ! {p1 = hundred ; p2 = mod} ; {p1 = hundred ; p2 = unmod} => d.s ! {p1 = hundred ; p2 = unmod} ; {p1 = hundred ; p2 = conj} => d.s ! {p1 = hundred ; p2 = conj}}} ; +lin pot110 = + {s = "diez"} ; +lin pot111 = + {s = "once"} ; +lin pot1to19 d = + {s = d.s ! {p1 = teen ; p2 = unmod}} ; +lin pot0as1 n = + {s = n.s ! {p1 = unit ; p2 = unmod}} ; +lin pot1 d = + {s = d.s ! {p1 = ten ; p2 = unmod}} ; +lin pot1plus d e = + {s = (d.s ! {p1 = ten ; p2 = mod}) ++ e.s ! {p1 = unit ; p2 = d.inh}} ; +lin pot1as2 n = + {s = n.s} ; +lin pot2 d = + {s = d.s ! {p1 = hundred ; p2 = unmod}} ; +lin pot2plus d e = + {s = (d.s ! {p1 = hundred ; p2 = mod}) ++ e.s} ; +lin pot2as3 n = + {s = n.s} ; +lin pot3 n = + {s = n.s ++ "mil"} ; +lin pot3plus n m = + {s = n.s ++ "mil" ++ m.s} ; diff --git a/examples/numerals/stieng.gf b/examples/numerals/stieng.gf new file mode 100644 index 000000000..549e9bd3f --- /dev/null +++ b/examples/numerals/stieng.gf @@ -0,0 +1,54 @@ +include numerals.Abs.gf ; + +param Size = sg | belowten | moreten ; + +oper LinDigit = {s : Str ; size : Size} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; + +oper mkNum : Str -> LinDigit = \u -> {s = u ; size = belowten} ; + +lin n2 = mkNum "baar" ; +lin n3 = mkNum "pê" ; +lin n4 = mkNum "puôn" ; +lin n5 = mkNum "pram" ; +lin n6 = mkNum "prau" ; +lin n7 = mkNum "poh" ; +lin n8 = mkNum "phaam" ; +lin n9 = mkNum "sên" ; + +oper ban : Str = (variants {"ban" ; "rabu"} ) ; + +lin num x = x ; + +lin pot01 = {s = variants {"muôi" ; "du" ; "di"} ; size = sg } ; +lin pot0 d = d ; +lin pot110 = {s = "jo'mo't" ; s2 = variants {"mu'n" ; "jo'm'ot" ++ "ban"} ; size = moreten} ; +lin pot111 = {s = "jo'mo't" ++ "muôi" ; s2 = variants {"mu'n" ++ ban ; "jo'm'ot" ++ "muôi" ++ ban} ; size = moreten} ; +lin pot1to19 d = {s = "jo'mo't" ++ d.s ; s2 = variants {"mu'n" ++ d.s ++ "ban"; "jo'm'ot" ++ d.s ++ "ban"} ; size = moreten }; +lin pot0as1 n = {s = n.s ; s2 = xsg n.size ban (n.s ++ "ban") ; size = n.size} ; +lin pot1 d = {s = d.s ++ "jo't" ; s2 = variants {d.s ++ "mu'n" ; d.s ++ "jo't" ++ "ban"} ; size = moreten} ; +lin pot1plus d e = {s = d.s ++ "jo't" ++ e.s ; s2 = variants {d.s ++ "mu'n" ; d.s ++ "jo't" } ++ xsg e.size ban (e.s ++ "ban") ; size = moreten} ; +lin pot1as2 n = n ; +lin pot2 d = {s = xsg d.size (variants { "riêng" ; "rhiêng" }) (d.s ++ "riêng") ; + s2 = xsg d.size "seen" (d.s ++ "seen") ; + size = moreten} ; +lin pot2plus d e = {s = xsg d.size (variants { "riêng" ; "rhiêng" }) (d.s ++ "riêng") ++ maybeo e.size ++ e.s ; + s2 = xsg d.size "seen" (d.s ++ "seen") ++ e.s2 ; + size = moreten} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = table {sg => (variants {"ban" ; "rabu"}) ; + belowten => n.s ++ "ban" ; + tenover => n.s2} ! n.size } ; +lin pot3plus n m = {s = table {sg => (variants {"ban" ; "rabu"}) ; + belowten => n.s ++ "ban" ; + tenover => n.s2} ! n.size ++ maybeo m.size ++ m.s } ; + +oper maybeo : Size -> Str = \sz -> table {moreten => [] ; _ => "ô"} ! sz; +oper xsg : Size -> Str -> Str -> Str = \sz -> \s1 -> \s2 -> table {sg => s1 ; _ => s2} ! sz ; + + + diff --git a/examples/numerals/swahili.gf b/examples/numerals/swahili.gf new file mode 100644 index 000000000..e3613e986 --- /dev/null +++ b/examples/numerals/swahili.gf @@ -0,0 +1,54 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten ; +param Size = sg | pl | pl_end | more100; +param S1000 = reg | lakh ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size } ; +lincat Sub10 = {s : DForm => Str ; size : Size } ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : S1000 => Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; + +oper mkNum : Str -> Str -> Lin Digit = \mbili -> \ishirini -> + {s = table {unit => mbili ; ten => ishirini } ; size = pl_end }; + +-- lin n1 = mkNum "moja" ; +lin n2 = mkNum "mbili" "ishirini" ; +lin n3 = mkNum "tatu" "thelathini" ; +lin n4 = mkNum "nne" "arobaini" ; +lin n5 = mkNum "tano" "hamsini" ; +lin n6 = mkNum "sita" "sitini" ; +lin n7 = mkNum "saba" "sabini" ; +lin n8 = mkNum "nane" "themanini" ; +lin n9 = mkNum "tisa" "tisini" ; + +lin pot01 = + {s = table {unit => "moja" ; _ => "dummy" } ; size = sg }; +lin pot0 d = d ; +lin pot110 = {s = "kumi" ; size = pl_end} ; +lin pot111 = {s = "kumi" ++ "na" ++ "moja" ; size = pl} ; +lin pot1to19 d = {s = "kumi" ++ "na" ++ d.s ! unit ; size = pl} ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; size = pl_end} ; +lin pot1plus d e = {s = d.s ! ten ++ "na" ++ e.s ! unit ; size = pl} ; +lin pot1as2 n = {s = table {_ => n.s } ; size = n.size} ; +lin pot2 d = {s = table {reg => mkmia d.size (d.s ! unit) ; lakh => mklakh d.size (d.s ! unit) []} ; size = more100}; +lin pot2plus d e = + {s = table {lakh => mklakh d.size (d.s ! unit) ("elfu" ++ e.s) ; + reg => mkmia d.size (d.s ! unit) ++ maybena e.size ++ e.s } ; + size = more100} ; +lin pot2as3 n = {s = n.s ! reg } ; +lin pot3 n = {s = table {sg => variants {"elfu" ; "elfu" ++ "moja"} ; more100 => n.s ! lakh ; _ => n.s ! reg ++ "elfu"} ! n.size} ; -- invert order in 1 < x < 100 * 1000 if nothing follows the elfu +lin pot3plus n m = {s = table {more100 => n.s ! lakh ; _ => "elfu" ++ n.s ! reg} ! n.size ++ maybena m.size ++ m.s ! reg} ; + +oper lakhi : Str = (variants {"lakh" ; "lakhi" }) ; +oper mia : Str = (variants { "mia" ; "mia" ++ "moja" }) ; +oper maybena : Size -> Str = \sz -> table {sg => "na" ; pl_end => "na" ; _ => []} ! sz ; +oper mklakh : Size -> Str -> Str -> Str = \sz -> \attr -> \elfu -> + table {sg => lakhi ; _ => lakhi ++ attr} ! sz ++ elfu ; +oper mkmia : Size -> Str -> Str = \sz -> \attr -> + table {sg => mia; _ => "mia" ++ attr } ! sz ; diff --git a/examples/numerals/swedish.gf b/examples/numerals/swedish.gf new file mode 100644 index 000000000..41de7ab14 --- /dev/null +++ b/examples/numerals/swedish.gf @@ -0,0 +1,44 @@ +include numerals.Abs.gf ; + +param DForm = ental | ton | tiotal ; + +lincat + Digit = {s : DForm => Str} ; + Sub10 = {s : DForm => Str} ; + +oper + mkTal : Str -> Str -> Str -> Lin Digit = \två, tolv, tjugo -> + {s = table {ental => två ; ton => tolv ; tiotal => tjugo}} ; + + regTal : Str -> Lin Digit = \fem -> + mkTal fem (fem + "ton") (fem + "tio") ; + + ss : Str -> {s : Str} = \s -> {s = s} ; + +lin + num x = x ; + + n2 = mkTal "två" "tolv" "tjugo" ; + n3 = mkTal "tre" "tretton" "trettio" ; + n4 = mkTal "fyra" "fjorton" "fyrtio" ; + n5 = regTal "fem" ; + n6 = regTal "sex" ; + n7 = mkTal "sju" "sjutton" "sjuttio" ; + n8 = mkTal "åtta" "arton" "åttio" ; + n9 = mkTal "nio" "nitton" "nittio" ; + + pot01 = {s = table {f => "ett"}} ; + pot0 d = {s = table {f => d.s ! f}} ; + pot110 = ss "tio" ; + pot111 = ss "elva" ; + pot1to19 d = ss (d.s ! ton) ; + pot0as1 n = ss (n.s ! ental) ; + pot1 d = ss (d.s ! tiotal) ; + pot1plus d e = ss (d.s ! tiotal ++ e.s ! ental) ; + pot1as2 n = n ; + pot2 d = ss (d.s ! ental ++ "hundra") ; + pot2plus d e = ss (d.s ! ental ++ "hundra" ++ e.s) ; + pot2as3 n = n ; + pot3 n = ss (n.s ++ "tusen") ; + pot3plus n m = ss (n.s ++ "tusen" ++ m.s) ; + diff --git a/examples/numerals/tamil.gf b/examples/numerals/tamil.gf new file mode 100644 index 000000000..82a1a66c1 --- /dev/null +++ b/examples/numerals/tamil.gf @@ -0,0 +1,166 @@ +-- Tamil +-- Ad hoc transcr. +-- when there is something bigger maybe a:yiram should be preceded +-- by an o:ru + +-- c is sh/ch etc +-- s is sanskr. s' +-- S is sanskr. s. +-- G is velar n i.e [ng] +-- V regular n in e.g [na:ru] +-- n one ring n +-- N two ring n +-- ñ +-- l +-- L (like N but without the middle ring) +-- M is retroflex l with the char that looks a bit like m (e.g l in Tamil) + + +include numerals.Abs.gf ; + +oper + vowel : Strs = strs {"o" ; "e" ; "a" ; "i" ; "u"} ; + labial : Strs = strs {"m" ; "p"} ; + retroflex : Strs = strs {"N" ; "T"} ; + sandhi_u : Str = pre {"u" ; [] / vowel} ; + sandhi_n : Str = pre {"n" ; "m" / labial} ; + sandhi_spc_n : Str = pre {"n" ; "p" / labial} ; + -- sandhi_N : Str = post {"n" ; "N" / retroflex } ; + +param DForm = unit | attr1 | attr2 | teen ; +param Size = sg | four | five | eight | nine | more100 | less100 ; +param Place = attr | indep ; +param Sub1000Data = attrtwo | indeptwo | preceded | lakhs | lakhs2 ; + +lincat Numeral = {s : Str} ; +lincat Digit = {s : DForm => Str ; size : Size} ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Place => Str ; size : Size} ; +lincat Sub1000 = {s : Sub1000Data => Str ; size : Size} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = "/T" ++ x0.s ++ "T/"} ; -- the Tamil environment + +lin n2 = + {s = table {teen => "panniraNTu" ; + unit => "iraNT" + sandhi_u ; + attr1 => "iru" ; + attr2 => variants {"iraNT" + sandhi_u ; "i:r"} } ; size = less100} ; +lin n3 = + {s = table {teen => "patin" + "mu:nru" ; + unit => "mu:nr" + sandhi_u ; + attr1 => "mu" + sandhi_spc_n ; + attr2 => "mu:l"} ; size = less100} ; +lin n4 = + {s = table {teen => "pati" + variants { "Va:lu" ; "Va:nku" } ; + unit => variants { "Va:l" + sandhi_u ; "Va:nk" + sandhi_u } ; + attr1 => "Va:r" ; + attr2 => "Va:l"} ; size = four} ; +lin n5 = + {s = table {teen => "patin" + "aindu" ; + unit => "aint" + sandhi_u ; + attr1 => "ai" + sandhi_n ; + attr2 => "aiy"} ; size = five} ; +lin n6 = + {s = table {teen => "patin" + "a:ru" ; + unit => "a:r" + sandhi_u ; + attr1 => "aru" ; + attr2 => "a:r"} ; size = less100} ; +lin n7 = + {s = table {teen => "patin" + "e:Lu" ; + unit => "e:L" + sandhi_u ; + attr1 => "eLu" ; + attr2 => "eL"} ; size = less100} ; +lin n8 = + {s = table {teen => "patin" + "eTTu" ; + unit => "eTT" + sandhi_u ; + attr1 => "eN" ; + attr2 => "eNN"} ; size = eight} ; +lin n9 = + {s = table {teen => "patt" + "o:npatu" ; + unit => "o:npat" + sandhi_u ; + attr1 => "toN" ; + attr2 => "o:npatin"} ; size = nine} ; + +oper fiveh : Str = variants { "ainna:ru" ; "añña:ru"} ; +oper fiveh_sandhi : Str = variants { "ainna:r" + sandhi_u ; "añña:r" + sandhi_u } ; + +lin pot01 = + {s = table {unit => "o:nru"; teen => "patin" + "o:nru" ; attr1 => "o:r" + sandhi_u ; attr2 => []} ; size = sg} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "pattu"} ; size = less100} ; +lin pot111 = + {s = table {_ => "patin" + "o:nr" + sandhi_u} ; size = less100} ; +lin pot1to19 d = + {s = table {_ => d.s ! teen} ; size = less100} ; +lin pot0as1 n = + {s = table {attr => n.s ! attr2 ; indep => n.s ! unit} ; size = n.size} ; +lin pot1 d = + {s = table {_ => table {nine => "toNNa:r" + sandhi_u ; _ => d.s ! attr1 ++ "patu"} ! d.size} ; size = less100} ; +lin pot1plus d e = + {s = table {_ => table {nine => ("toNNa:r" + sandhi_u) ++ e.s ! unit; _ => d.s ! attr1 ++ "pat" + sandhi_u } ! d.size ++ e.s ! unit }; size = less100} ; +lin pot1as2 n = + {s = table {indeptwo => n.s ! indep ; attrtwo => n.s ! attr ; preceded => n.s ! indep ; _ => "dummy"}; size = n.size} ; +lin pot2 d = + {s = table {indeptwo => + table {nine => "toLLa:yiram" ; + eight => "eNNa:ru" ; + four => "Va:Va:ru" ; + five => fiveh ; + sg => "Va:ru" ; + _ => d.s ! attr1 ++ "Va:ru"} ! d.size ; + attrtwo => + table {nine => "toLLa:yiratt" + sandhi_u ; + eight => "eNNa:r" + sandhi_u ; + four => "Va:Va:r" + sandhi_u; + five => fiveh_sandhi ; + _ => d.s ! attr1 ++ "Va:r" + sandhi_u} ! d.size ; + preceded => + table {nine => "toLLa:yiram" ; + eight => "eNNa:ru" ; + four => "Va:Va:ru" ; + five => fiveh ; + _ => d.s ! attr1 ++ "Va:ru"} ! d.size ; + lakhs => d.s ! unit ++ "ilaTcam" ; + lakhs2 => d.s ! unit ++ "ilaTcattu" } ; + size = more100} ; +lin pot2plus d e = + {s = table {indeptwo => + table {nine => ("toLLa:yiratt" + sandhi_u) ; + eight => ("eNNa:r" + sandhi_u) ; + four => ("Va:Va:r" + sandhi_u) ; + five => fiveh_sandhi ; + sg => ("Va:r" + sandhi_u) ; + _ => d.s ! attr1 ++ ("Va:r" + sandhi_u) } ! d.size ++ e.s ! indep ; + attrtwo => + table {nine => ("toLLa:yiratt" + sandhi_u) ; + eight => ("eNNa:r" + sandhi_u) ; + four => ("Va:Va:r" + sandhi_u) ; + five => fiveh_sandhi ; + sg => ("Va:r" + sandhi_u) ; + _ => d.s ! attr1 ++ ("Va:r" + sandhi_u) } ! d.size ++ e.s ! indep ; + preceded => + table {nine => ("toLLa:yiratt" + sandhi_u) ; + eight => ("eNNa:r" + sandhi_u) ; + four => ("Va:Va:r" + sandhi_u) ; + five => fiveh_sandhi ; + _ => d.s ! attr1 ++ ("Va:r" + sandhi_u) } ! d.size ++ e.s ! indep ; + lakhs => d.s ! unit ++ ("ilaTcatt" + sandhi_u) ++ + table {sg => "a:yiram" ; _ => e.s ! attr ++ "a:yiram" } ! e.size ; + lakhs2 => d.s ! unit ++ ("ilaTcatt" + sandhi_u) ++ + table {sg => "a:yiratt" + sandhi_u ; _ => e.s ! attr ++ ("a:yiratt" + sandhi_u) } ! e.size} ; size = more100} ; + +lin pot2as3 n = + {s = n.s ! indeptwo} ; +lin pot3 n = + {s = table {sg => "a:yiram" ; + more100 => n.s ! lakhs ; + _ => n.s ! attrtwo ++ "a:yiram" } ! n.size } ; + +lin pot3plus n m = + {s = table {sg => "a:yiratt" + sandhi_u; + more100 => n.s ! lakhs2 ; + _ => n.s ! attrtwo ++ "a:yiratt" + sandhi_u } ! n.size ++ m.s ! preceded} ; + diff --git a/examples/numerals/tampere.gf b/examples/numerals/tampere.gf new file mode 100644 index 000000000..e9fff3524 --- /dev/null +++ b/examples/numerals/tampere.gf @@ -0,0 +1,60 @@ +include numerals.Abs.gf ; + +param Place = attr | indep ; +param Nm = sg | pl ; +oper sata : Nm => Str = + table {{sg} => "sata" ; {pl} => "sataa"} ; +oper tuhat : Nm => Str = + table {{sg} => "tuhat" ; {pl} => "tuhatta"} ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : Place => Str} ; +lincat Sub10 = {inh : Nm ; s : Place => Str} ; +lincat Sub100 = {inh : Nm ; s : Place => Str} ; +lincat Sub1000 = {inh : Nm ; s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = table {p => "kaks"}} ; +lin n3 = + {s = table {{attr} => "kol" ; {indep} => "kolme"}} ; +lin n4 = + {s = table {{attr} => "nel" ; {indep} => "neliä"}} ; +lin n5 = + {s = table {p => "viis"}} ; +lin n6 = + {s = table {p => "kuus"}} ; +lin n7 = + {s = table {{attr} => "seit" ; {indep} => "seittämän"}} ; +lin n8 = + {s = table {p => "kahreksan"}} ; +lin n9 = + {s = table {p => "yhreksän"}} ; +lin pot01 = + {inh = sg ; s = table {{attr} => [] ; {indep} => "yks"}} ; +lin pot0 d = + {inh = pl ; s = table {p => d.s ! indep}} ; +lin pot110 = + {inh = pl ; s = table {p => "kymmenen"}} ; +lin pot111 = + {inh = pl ; s = table {p => "yks"++"toista"}} ; +lin pot1to19 d = + {inh = pl ; s = table {p => (d.s ! indep) ++ "toista"}} ; +lin pot0as1 n = + {inh = n.inh ; s = table {p => n.s ! p}} ; +lin pot1 d = + {inh = pl ; s = table {p => (d.s ! attr) ++ "kytä"}} ; +lin pot1plus d e = + {inh = pl ; s = table {p => (d.s ! attr) ++ "kyt" ++ e.s ! indep}} ; +lin pot1as2 n = + {inh = n.inh ; s = table {p => n.s ! p}} ; +lin pot2 d = + {inh = pl ; s = table {p => (d.s ! attr) ++ sata ! (d.inh)}} ; +lin pot2plus d e = + {inh = pl ; s = table {p => (d.s ! attr) ++ (sata ! (d.inh)) ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = (n.s ! attr) ++ tuhat ! (n.inh)} ; +lin pot3plus n m = + {s = (n.s ! attr) ++ (tuhat ! (n.inh)) ++ m.s ! indep} ; diff --git a/examples/numerals/tibetan.gf b/examples/numerals/tibetan.gf new file mode 100644 index 000000000..b862108fc --- /dev/null +++ b/examples/numerals/tibetan.gf @@ -0,0 +1,65 @@ +include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \s1 -> \s2 -> s1 ++ s2; + +param DForm = unit | teen | bform | ten | hundred | agg ; + +-- Sorry no tibetan script but the adhoc transliteration should be phonematic +-- 21 has an extra variant namely nyerchi' + +oper LinDigit = {s : DForm => Str} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str} ; +lincat Sub1000 = {s : Str ; s2 : Str} ; + +oper mkNum : Str -> Str -> Str -> Str -> LinDigit = + \u -> \tn -> \b -> \t -> + {s = table {unit => u ; teen => tn ; bform => b + "chu" ; ten => t ; hundred => b + "g~ya" ; agg => "t.'a'" ++ u}} ; + +-- lin n1 mkNum "chi'" "chug/chi'" ; +lin n2 = +{s = table {unit => "n~yi:" ; teen => "chug/n~yi:" ; ten => "tsag/" ; + bform => "nyishu" ; hundred => (variants {"nyibg~ya"; "nyi:bg~ya"}) ; + agg => "t.'a'" ++ "n~yi:" } }; +lin n3 = mkNum "sum" "chug/sum" "sum" "sog/" ; +lin n4 = mkNum "z~hyi" "chubz~hyi" (variants {"z~hyib" ; "z~hib"}) "z/hye" ; +lin n5 = mkNum "n~ga" "chö:n~ga" "n~gab" "nga" ; +lin n6 = mkNum "d.u'" "chud.u'" "d.ug/" "re"; +lin n7 = mkNum "d~ün" "chubd~ün" "d~ün" "d/ön"; +lin n8 = mkNum "g~yä'" "chobg~yä'" "g~yä'" "g/ya"; +lin n9 = mkNum "g~u" "chug~u" "g~ub" "g/o"; + +oper dang : Str = "d/ang" ; +oper tampa : Str -> Str = \s -> (variants {s; s ++ "t'ampa"}); + +lin num x = {s = "/X" ++ x.s ++ "X/" }; -- extra diacritics translation + +lin pot01 = + {s = table {hundred => "g~ya" ; agg => (variants {[] ; "t'a'"}) ; _ => "chi'"}} ; +lin pot0 d = d ; +lin pot110 = {s = tampa "chu" ; s2 = variants {"t.'i" ; "t.'it.'a'"}} ; +lin pot111 = + {s = "chug/chi'" ; + s2 = variants {"t.'i" ; "t.'it.'a'"} ++ dang ++ variants {"t~ong'i" ; "t~ongt.'a'"}} ; +lin pot1to19 d = {s = d.s ! teen ; s2 = variants {"t.'i" ; "t.'it.'a'"} ++ mkagg (d.s ! agg) "t~ong"} ; +lin pot0as1 n = {s = n.s ! unit ; s2 = mkagg (n.s ! agg) "t~ong"} ; +lin pot1 d = {s = tampa (d.s ! bform) ; s2 = mkagg (d.s ! agg) "t.'i"} ; +lin pot1plus d e = + {s = variants { d.s ! bform ++ (bind (d.s ! ten) (e.s ! unit)) ; + (bind (d.s ! ten) (e.s ! unit))} ; + s2 = mkagg (d.s ! agg) "t.'i" ++ dang ++ mkagg (e.s ! agg) "t~ong"} ; +lin pot1as2 n = {s = n.s ; s2 = n.s2 } ; +lin pot2 d = {s = d.s ! hundred ; s2 = mkagg (d.s ! agg) "b~um" } ; +lin pot2plus d e = {s = d.s ! hundred ++ dang ++ e.s ; + s2 = mkagg (d.s ! agg) "b~um" ++ dang ++ e.s2} ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = n.s2 } ; +lin pot3plus n m = {s = n.s2 ++ dang ++ m.s} ; + +oper mkagg : Str -> Str -> Str = \attr -> \s -> bind s attr ; + + + + diff --git a/examples/numerals/totonac.gf b/examples/numerals/totonac.gf new file mode 100644 index 000000000..1b843b1db --- /dev/null +++ b/examples/numerals/totonac.gf @@ -0,0 +1,108 @@ +include numerals.Abs.gf ; + +oper mk20Ten : Str -> Str -> Str -> Size -> LinDigit = + \tri -> \fiche -> \ext -> \sz -> + { s = table {unit => tri ; maaunit => "maa" ++ tri ; twenty => fiche ; extra => ext } ; even20 = ten ; size = sz} ; + +oper mkEven20 : Str -> Str -> Str -> Size -> LinDigit = + \se -> \trifichid -> \ext -> \sz -> + { s = table {unit => se ; maaunit => "maa" ++ se ; twenty => trifichid ; extra => ext } ; even20 = even ; size = sz} ; + +param Even20 = ten | even ; +param DForm = unit | maaunit | extra | twenty ; +param Size = one | two | three | four | five | pl ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; even20 : Even20 ; size : Size} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; tenpsize : Size ; s2 : Str} ; +lincat Sub1000 = {s : Str } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = mkEven20 "t~u3" "pus^um" [] two; +lin n3 = mk20Ten "itun" ("pus^um" ++ "maa" ++ "kaawi") [] two; +lin n4 = mkEven20 "t~a~at" (variants {"pus^um" ++ "pus^um" ; "tiy~u~u" ++ "pus^um"}) [] three; +lin n5 = mk20Ten (variants {"kitis" ; "kic/is"}) + (variants {("paha" ++ "sye Str = table {sz => "maa" ++ "kaawi" ++ mk5twenty ! sz }; + +oper mk5twenty : Size => Str = table { + one => variants {("maa" ++ "kic/is") ; "kic/is"} ++ "pus^um"; + two => "c^aas^an" ++ "pus^um"; + three => "tuhun" ++ "pus^um"; + four => "c/iyan" ++ "pus^um"; + _ => "nahaac/a" ++ "pus^um" +} ; + +oper mktwenty : Str -> Str -> Str -> Str -> Str -> Size => Str = + \a1 -> \a2 -> \a3 -> \a4 -> \a5 -> table { + one => a1 ++ "pus^um" ; + two => a2 ++ "pus^um" ; + three => a3 ++ "pus^um" ; + four => a4 ++ "pus^um" ; + _ => a5 ++ "pus^um" +} ; + +oper get20 : Str -> Size -> Size -> Str = \df -> \sz1 -> \sz2 -> + table {one => mk5twenty ; + two => mktwenty ("maa" ++ "kaawi") + ("maa" ++ "kaawi" ++ "tun") + ("maa" ++ "kaawi" ++ "t~u3") + ("maa" ++ "kaawi" ++ "itun") + ("maa" ++ "kaawi" ++ "t~a~at") ; + three => addkaawi ; + _ => table {_ => df } } ! sz1 ! sz2 ; + +lin pot01 = + {s = table {unit => "tun" ; maaunit => "tun" ; tfive => "kic/is" ++ "pus^um" } ; even20 = ten ; size = one}; +lin pot0 d = + {s = d.s ; even20 = d.even20 ; size = one} ; +lin pot110 = + {s = "kaawi" ; tenpsize = one ; s2 = "tun"} ; +lin pot111 = + {s = "kaawi" ++ "tun" ; tenpsize = one ; s2 = "tun" } ; +lin pot1to19 d = + {s = "kaawi" ++ d.s ! unit ; tenpsize = one ; s2 = d.s ! unit } ; +lin pot0as1 n = + {s = n.s ! maaunit ; tenpsize = one ; s2 = n.s ! maaunit} ; +lin pot1 d = + {s = d.s ! twenty ; + tenpsize = d.size ; + s2 = [] } ; + +lin pot1plus d e = + {s = table {even => d.s ! twenty ++ d.s ! extra ++ e.s ! maaunit; + ten => d.s ! twenty ++ e.s ! unit} ! (d.even20) ; + tenpsize = d.size ; + s2 = table {even => e.s ! maaunit ; ten => e.s ! unit} ! d.even20} ; + +lin pot1as2 n = {s = n.s} ; + +lin pot2 d = + {s = variants {get20 (d.s ! maaunit ++ "sye Str ; s2 : Str ; size : Size} ; +oper LinS100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = {s : Str} ; + +oper mkNum : Str -> LinDigit = \kunun -> + {s = table {unit => kunun ; ten => "mOrta" ++ kunun } ; + s2 = "dubu" ++ kunun ; + size = sub10} ; + +lin num x0 = + {s = x0.s} ; -- TODO + +-- o. +-- O for IPA o in Eng. Cod + +lin n2 = {s = table {unit => "cu" ; ten => "digidem" } ; s2 = "dubu" ++ "cu"; size = sub10} ; +lin n3 = mkNum "ago.zo." ; +lin n4 = mkNum "tozo" ; +lin n5 = mkNum "fo"; +lin n6 = mkNum "dissi" ; +lin n7 = mkNum (variants {"tuduzu" ; "tudusu"}) ; +lin n8 = mkNum (variants {"osso" ; "yosso"}) ; +lin n9 = mkNum "issi"; + +oper olufu : Str = variants {"oluou" ; "olufu"} ; +oper ss : Str -> Str -> LinS100 = \a -> \b -> {s = a ; s2 = b ; size = pl} ; +oper ss2 : Str -> Str -> LinS100 = \a -> \b -> {s = a ; s2 = b ; size = e10} ; + +lin pot01 = {s = table {_ => "tro" }; s2 = "dubu" ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss2 "mOrdOm" []; +lin pot111 = ss2 ("mOrdOm" ++ "sao" ++ "tro") ("dubu"); +lin pot1to19 d = ss2 ("mOrdOm" ++ "sao" ++ d.s ! unit) ("dubu" ++ d.s ! unit); +lin pot0as1 n = {s = n.s ! unit ; s2 = n.s2 ; size = n.size} ; +lin pot1 d = ss (d.s ! ten) (d.s ! unit) ; +lin pot1plus d e = ss (d.s ! ten ++ "sao" ++ e.s ! unit) (d.s ! unit ++ e.s2) ; +lin pot1as2 n = {s = n.s ; s2 = ifsub10 n.s2 ! n.size ; size = n.size }; +lin pot2 d = ss (selsg "kidri" ("kidra" ++ d.s ! unit) ! d.size) + (olufu ++ d.s ! ten) ; +lin pot2plus d e = + ss (selsg "kidri" ("kidra" ++ d.s ! unit) ! d.size ++ "sao" ++ e.s) + (olufu ++ d.s ! ten ++ "sao" ++ ifs10 ! e.size ++ e.s2) ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = n.s2}; +lin pot3plus n m = {s = n.s2 ++ "sao" ++ m.s}; + +oper ifs10 : Size => Str = table {e10 => "tro" ; _ => []} ; +oper ifsub10 : Str -> Size => Str = \a -> + table {pl => olufu ++ a; e10 => olufu ++ a ; _ => a } ; +oper selsg : Str -> Str -> Size => Str = \a -> \b -> + table {sg => a ; _ => b} ; \ No newline at end of file diff --git a/examples/numerals/tukang_besi.gf b/examples/numerals/tukang_besi.gf new file mode 100644 index 000000000..f07bdce33 --- /dev/null +++ b/examples/numerals/tukang_besi.gf @@ -0,0 +1,41 @@ +include numerals.Abs.gf ; + +param DForm = u | v ; + +oper LinDigit = {s : DForm => Str } ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinDigit ; +lincat Sub1000 = LinDigit ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +oper mkNum : Str -> LinDigit = \a -> {s = table {_ => a}} ; +oper mkNum2 : Str -> Str -> LinDigit = \a -> \b -> {s = table {u => a ; v => b}} ; + +lin num x = x ; +-- lin n1 mkNum "sa'asa" ; +lin n2 = mkNum "dua" ; +lin n3 = mkNum "tolu" ; +lin n4 = mkNum2 "gana" "hato"; +lin n5 = mkNum "lima" ; +lin n6 = mkNum2 "no'o" "nomo" ; +lin n7 = mkNum2 "pitu" "hitu" ; +lin n8 = mkNum "alu" ; +lin n9 = mkNum "sia" ; + +lin pot01 = mkNum2 "sa'asa" "sa" ; +lin pot0 d = d ; +lin pot110 = {s = table {_ => "ompulu" }}; +lin pot111 = {s = table {u => "ompulu" ++ "sa'asa" ; v => "ompulu" ++ "sa"}} ; +lin pot1to19 d = {s = table {f => "ompulu" ++ d.s ! f}} ; +lin pot0as1 n = n ; +lin pot1 d = {s = table {_ => bind (d.s ! v) "hulu" }} ; +lin pot1plus d e = {s = table {f => (bind (d.s ! v) "hulu") ++ e.s ! f}} ; +lin pot1as2 n = n ; +lin pot2 d = {s = table {_ => bind (d.s ! v) "hatu" }} ; +lin pot2plus d e = {s = table {f => (bind (d.s ! v) "hatu") ++ e.s ! f}} ; +lin pot2as3 n = {s = n.s ! u}; +lin pot3 n = {s = bind (n.s ! v) "riwu" } ; +lin pot3plus n m = {s = (bind (n.s ! v) "riwu") ++ m.s ! u } ; diff --git a/examples/numerals/turkish.gf b/examples/numerals/turkish.gf new file mode 100644 index 000000000..49da296d0 --- /dev/null +++ b/examples/numerals/turkish.gf @@ -0,0 +1,56 @@ +include numerals.Abs.gf ; + +param DForm = unit | ten | teen ; +param Size = sg | pl ; + +-- ç is c with a cedille (obviously) +-- s, is s with a cedille +-- I is i without a dot +-- g% is yumus,ak ge (i.e a g with a breve) + +-- The hundreds and trheir qualif can be written together e.g ikiyüz +-- aswelll as ten + unit e.g yirmibir + +lincat Digit = {s : DForm => Str } ; +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size } ; +lincat Sub1000 = {s : Str ; size : Size } ; + +oper mkNum : Str -> Str -> Lin Digit = + \iki -> \yirmi -> + {s = table {unit => iki ; teen => (variants {"on" + iki ; "on" ++ iki}) ; ten => yirmi } } ; + +lin num x = {s = "/L" ++ x.s ++ "L/" } ; + +-- lin n1 mkNum "bir" "dA" ; +lin n2 = mkNum "iki" "yirmi" ; +lin n3 = mkNum "üç" "otuz" ; +lin n4 = mkNum "dört" "kIrk" ; +lin n5 = mkNum "bes," "elli" ; +lin n6 = mkNum "altI" "altmIs," ; +lin n7 = mkNum "yedi" "yetmis," ; +lin n8 = mkNum "sekiz" "seksen" ; +lin n9 = mkNum "dokuz" "doksan" ; + +oper ss : Str -> {s : Str ; size : Size} = \s -> {s = s ; size = pl} ; + +lin pot01 = {s = table {f => "bir"} ; size = sg} ; +lin pot0 d = {s = table {f => d.s ! f} ; size = pl} ; +lin pot110 = ss "on" ; +lin pot111 = ss (variants { "on" ++ "bir" ; "onbir"}); +lin pot1to19 d = {s = d.s ! teen ; size = pl} ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; size = pl} ; +lin pot1plus d e = {s = d.s ! ten ++ e.s ! unit; size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = table {sg => [] ; _ => d.s ! unit} ! d.size ++ "yüz" ; size = pl} ; +lin pot2plus d e = {s = table {sg => [] ; _ => d.s ! unit} ! d.size ++ "yüz" ++ e.s ; size = pl} ; + +lin pot2as3 n = n ; +lin pot3 n = {s = table {sg => [] ; _ => n.s } ! n.size ++ "bin"} ; +lin pot3plus n m = {s = table {sg => [] ; _ => n.s } ! n.size ++ "bin" ++ m.s} ; + + + + + diff --git a/examples/numerals/votic.gf b/examples/numerals/votic.gf new file mode 100644 index 000000000..362c465a6 --- /dev/null +++ b/examples/numerals/votic.gf @@ -0,0 +1,61 @@ +include numerals.Abs.gf ; + +param DForm = unit | attr | teen | ten | ten2 ; +param Size = sg | pl ; + +oper LinDigit = {s : DForm => Str ; size : Size }; +oper LinS100 = {s : Str ; size : Size} ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = {s = x0.s} ; -- TODO + +oper mkN2 : Str -> LinDigit = \u -> + mkN u u (u + "ts^ümmettä") (u + "ts^ümmet") ; + +oper mkN : Str -> Str -> Str -> Str -> LinDigit = \u -> \a -> \t -> \t2 -> + {s = table {unit => u ; attr => a + "sata:"; ten => t ; ten2 => t2 ; + teen => a + tess} ; size = pl} ; + +lin n2 = mkN "kahsi" "kahs" + (variants {"kahs^'t's^'ümmettä" ; "kahts^ümmettä"}) + (variants {"kahs^'t's^'ümmet" ; "kahts^ümmet"}); +lin n3 = mkN "keVLmeV" "keVm" "keVmts^ümmettä" "keVmts^ümmet"; +lin n4 = mkN2 "nellä" ; +lin n5 = mkN "vi:si" "vi:s" "vi:s^'t's^'ümmettä" "vi:s^'t's^'ümmet"; +lin n6 = mkN "ku:si" "ku:s" "ku:s^'t's^'ümmettä" "ku:s^'t's^'ümmet"; +lin n7 = mkN2 "seitse:" ; +lin n8 = mkN2 "kaheVsa:" ; +lin n9 = mkN2 "ühesä:" ; + +oper tess : Str = (variants {"teV*s^s^eVmeVtta" ; "teV*is^'t's^'ümmeD"} ) ; + +lin pot01 = {s = table {unit => "ühsi" ; attr => "sata" ; _ => "dummy" }; size = sg } ; + +oper ss : Str -> LinS100 = \s1 -> {s = s1 ; size = pl } ; + +lin pot0 d = d ; +lin pot110 = ss "ts^ümme:" ; +lin pot111 = ss ("ühs" + tess) ; +lin pot1to19 d = ss (d.s ! teen) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size } ; +lin pot1 d = ss (d.s ! ten) ; +lin pot1plus d e = ss ((d.s ! ten2) ++ (e.s ! unit)) ; +lin pot1as2 n = n ; +lin pot2 d = ss (d.s ! attr) ; +lin pot2plus d e = ss ((d.s ! attr) ++ e.s) ; +lin pot2as3 n = + {s = n.s } ; +lin pot3 n = + {s = selsg (variants {"tuhatta" ; "tuhaD" }) (bind n.s "tuhatta") ! n.size} ; +lin pot3plus n m = + {s = selsg (variants {"tuhatta" ; "tuhaD" }) (bind n.s "tuhatta") ! n.size ++ m.s }; + +oper selsg : Str -> Str -> Size => Str = \a -> \b -> + table {sg => a ; pl => b} ; \ No newline at end of file diff --git a/examples/numerals/welsh.gf b/examples/numerals/welsh.gf new file mode 100644 index 000000000..54a2ca640 --- /dev/null +++ b/examples/numerals/welsh.gf @@ -0,0 +1,71 @@ +include numerals.Abs.gf ; + +-- The neo-base-10 system dauddeg, trideg, pedwardeg, pumdeg/hanner cant, chwedeg, saithdeg, wythdeg, nawdeg is +-- implemented as the second variant as it should be + +oper LinDigit = {s : DForm => Str ; even20 : Even20 ; size : Size} ; +oper LinSub100 = {s : Str ; size : Size} ; + +oper mk20Ten : Str -> Str -> Str -> Str -> Size -> LinDigit = + \tri -> \trideg -> \fiche -> \triarddeg -> \sz -> + { s = table {unit => tri ; twenty => fiche ; teen => triarddeg ; ten => trideg} ; even20 = odd ; size = sz} ; + +oper mkEven20 : Str -> Str -> Str -> Str -> Size -> LinDigit = + \tri -> \trideg -> \fiche -> \triarddeg -> \sz -> + { s = table {unit => tri ; twenty => fiche ; teen => triarddeg ; ten => trideg} ; even20 = even ; size = sz} ; + +param Even20 = odd | even ; +param DForm = unit | ten | twenty | teen ; +param Size = sg | mutation | am | pl | five | overten; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = mkEven20 "dau" "dauddeg" "hugain" "deuddeg" mutation ; +lin n3 = mk20Ten "tri" "trideg" "hugain" ("tri" ++ "ar" ++ "deg") am ; +lin n4 = mkEven20 "pedwar" "pedwardeg" "deugain" ("pedwar" ++ "ar" ++ "ddeg") pl ; +lin n5 = mk20Ten ("pum" + p) "pumdeg" "deugain" "pymtheg" five ; +lin n6 = mkEven20 ("chwe" + ch) "chwedeg" "trigain" ("un" ++ "ar" ++ "bymtheg") am ; +lin n7 = mk20Ten "saith" "saithdeg" "trigain" ("dau" ++ "ar" ++ "bymtheg") pl ; +lin n8 = mkEven20 "wyth" "wythdeg" ("pedwar" ++ "ugain") "deunaw" pl ; +lin n9 = mk20Ten "naw" "nawdeg" ("pedwar" ++ "ugain") ("pedwar" ++ "ar" ++ "bymtheg") pl ; +oper AR : Str = pre {"ar" ; "a" / strs {"d"} } ; +oper AG : Str = pre {"a" ; "ag" / strs {"a" ; "u" ; "i" ; "e" ; "o" ; "w"} } ; -- before vowel +oper ng : Str = pre {"g" ; "ng" / strs {"m"} } ; +oper t : Str = pre {[] ; "t" / strs {[]}} ; +oper ch : Str = pre {[] ; "ch" / strs{[]}} ; +oper p : Str = pre {[] ; "p" / strs{[]}} ; + +oper mkR : Str -> LinSub100 = \s1 -> {s = s1 ; size = overten } ; +oper mkR2 : Str -> Size -> LinSub100 = \s1 -> \sz -> {s = s1 ; size = table {mutation => mutation ; am => am ; _ => overten} ! sz } ; + +lin pot01 = + {s = table {unit => "un" ; _ => "dummy"} ; even20 = odd ; size = sg}; +lin pot0 d = d ; +lin pot110 = {s = "de" + ng ; size = pl} ; +lin pot111 = mkR (variants {"un" ++ "ar" ++ "ddeg" ; "undeg" ++ "un"}) ; +lin pot1to19 d = mkR (variants {d.s ! teen ; "undeg" ++ d.s ! unit}) ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = table {mutation => mkR (variants {"ugain" ; "dauddeg" }) ; + five => mkR (variants {"hanner" ++ "cant" ; "deg" ++ "a" + "deugain" ; "pumdeg"}) ; + _ => mkR (variants { table {even => d.s ! twenty ; odd => "deg" ++ AR ++ d.s ! twenty} ! d.even20 ; d.s ! ten}) } ! d.size ; +lin pot1plus d e = mkR2 (variants { table {even => e.s ! unit ++ AR ++ d.s ! twenty ; odd => e.s ! teen ++ AR ++ d.s ! twenty} ! d.even20 ; d.s ! ten}) e.size ; -- hugain +lin pot1as2 n = n ; +lin pot2 d = mkR ((CANT (d.s ! unit)) ! d.size) ; +lin pot2plus d e = mkR2 (((CANT (d.s ! unit)) ! d.size) ++ (maybeAG ! e.size) ++ e.s) e.size; +lin pot2as3 n = + {s = n.s } ; +lin pot3 n = + {s = (MIL n.s) ! n.size } ; +lin pot3plus n m = + {s = (MIL n.s) ! n.size ++ m.s } ; + +oper maybeAG : Size => Str = (table {overten => [] ; _ => AG} ); +oper CANT : Str -> Size => Str = \s1 -> table {sg => "can" + t ; mutation => s1 ++ "gan" + t; am => s1 ++ "chan" + t ; _ => s1 ++ "can" + t} ; +oper MIL : Str -> Size => Str = \s1 -> table {sg => "mil" ; mutation => s1 ++ "fil" ; _ => s1 ++ "mil" } ; + diff --git a/examples/numerals/yasin_burushaski.gf b/examples/numerals/yasin_burushaski.gf new file mode 100644 index 000000000..53ec8967f --- /dev/null +++ b/examples/numerals/yasin_burushaski.gf @@ -0,0 +1,62 @@ +include numerals.Abs.gf ; + +oper LinDigit = {s : DForm => Str ; even20 : Even20 ; size : Size} ; + +oper mk20Ten : Str -> Str -> LinDigit = \tri -> \tw -> + {s = table {unit => tri ; teen => "turma-" + tri ; twenty => tw+"-áltar"} ; + even20 = ten ; size = pl} ; + +oper mkEven20 : Str -> Str -> LinDigit = \tri -> \tw -> + {s = table {unit => tri ; teen => "turma-" + tri ; twenty => tw+"-áltar"} ; + even20 = even ; size = pl} ; + +param Even20 = ten | even ; +param DForm = unit | teen | twenty ; +param Size = sg | pl ; + +lincat Numeral = {s : Str} ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size } ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = {s = table {unit => "altó" ; teen => "turma-" + "altó" ; twenty => "áltar" } ; even20 = even ; size = pl} ; +lin n3 = {s = table {unit => "iskí" ; teen => "turma-" + "iskí" ; twenty => "áltar" } ; even20 = ten ; size = pl} ; +lin n4 = mkEven20 "wálte" "altó"; +lin n5 = mk20Ten "cendí" "altó"; +lin n6 = mkEven20 "bis'índe" "iskí" ; +lin n7 = mk20Ten "thalé" "iskí"; +lin n8 = mkEven20 "altámbe" "wálte"; +lin n9 = mk20Ten "hutí" "wálte"; + +lin pot01 = + {s = table {unit => "hek" ; teen => "turma-" + "hék" ; twenty => []} ; even20 = ten ; size = sg}; +lin pot0 d = d ; +lin pot110 = {s = "tórum" ; size = pl} ; +lin pot111 = {s = "turma-" + "hék" ; size = pl} ; +lin pot1to19 d = {s = d.s ! teen ; size = pl} ; +lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; +lin pot1 d = + {s = table {even => d.s ! twenty ; + ten => d.s ! twenty ++ "tórum"} ! d.even20 ; + size = pl} ; +lin pot1plus d e = + {s = table {even => d.s ! twenty ++ e.s ! unit; + ten => d.s ! twenty ++ e.s ! teen} ! (d.even20) ; + size = pl} ; + +lin pot1as2 n = n ; +lin pot2 d = {s = (selsg d.size (d.s ! unit)) ++ "tha" ; size = pl} ; +lin pot2plus d e = + {s = (selsg d.size (d.s ! unit)) ++ "tha" ++ e.s ; size = pl} ; +lin pot2as3 n = + {s = n.s } ; +lin pot3 n = + {s = selsg n.size n.s ++ "hazár"} ; +lin pot3plus n m = + {s = selsg n.size n.s ++ "hazár" ++ m.s } ; + +oper selsg : Size -> Str -> Str = \sz -> \attr -> + table {sg => [] ; _ => attr} ! sz ; \ No newline at end of file diff --git a/examples/numerals/zaiwa.gf b/examples/numerals/zaiwa.gf new file mode 100644 index 000000000..005a7038f --- /dev/null +++ b/examples/numerals/zaiwa.gf @@ -0,0 +1,54 @@ +include numerals.Abs.gf ; + +param Size = sg | sub10 | pl ; + +oper LinDigit = {s : Str ; size : Size} ; + +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; + +oper mkNum : Str -> LinDigit = \u -> {s = u ; size = sub10} ; + +lin n2 = mkNum "i55" ; +lin n3 = mkNum "sum11" ; +lin n4 = mkNum "mi11" ; +lin n5 = mkNum "ngo11" ; +lin n6 = mkNum "kyuq5" ; +lin n7 = mkNum "ngit5" ; +lin n8 = mkNum "sit5" ; +lin n9 = mkNum "gau11" ; + +oper ten : Str = variants {"cue31" ; "sue31"}; +oper mun : Str = variants {"mun11" ; ("mun11" + "mo35")} ; +oper xmun : Size => Str = table {pl => [] ; _ => mun} ; + +lin num x = {s = x.s} ; -- TODO + +lin pot01 = {s = "ra11" ; size = sg } ; +lin pot0 d = d ; +lin pot110 = {s = "le1" ++ ten ; + s2 = "le1" ++ mun ; size = pl} ; +lin pot111 = {s = ("le1" ++ ten) ++ "ra11"; + s2 = ("le1" ++ mun) ++ ("le1" ++ "hing55"); size = pl} ; +lin pot1to19 d = {s = ("le1" ++ ten) ++ d.s ; + s2 = ("le1" ++ mun) ++ d.s ++ "hing55"; size = pl}; +lin pot0as1 n = {s = n.s ; s2 = ifsg n.s ! n.size ++ "hing55" ; size = n.size}; +lin pot1 d = {s = d.s ++ ten ; s2 = d.s ++ mun ; size = pl} ; +lin pot1plus d e = {s = d.s ++ ten ++ e.s ; s2 = d.s ++ mun ++ ifsg e.s ! e.size ++ "hing55" ; size = pl} ; +lin pot1as2 n = n ; +lin pot2 d = {s = ifsg d.s ! d.size ++ "syo31" ; + s2 = ifsg d.s ! d.size ++ ten ++ mun ; + size = pl } ; +lin pot2plus d e = {s = ifsg d.s ! d.size ++ "syo31" ++ e.s; + s2 = ifsg d.s ! d.size ++ ten ++ xmun ! e.size ++ e.s2 ; + size = pl} ; +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = n.s2 } ; +lin pot3plus n m = {s = n.s2 ++ m.s } ; + +oper ifsg : Str -> Size => Str = \attr -> table {sg => "le1" ; _ => attr} ; + + + diff --git a/grammars/numerals/old/hungarian.gf b/grammars/numerals/old/hungarian.gf index db5b88b6e..2489fb6ef 100644 --- a/grammars/numerals/old/hungarian.gf +++ b/grammars/numerals/old/hungarian.gf @@ -1,8 +1,6 @@ include numerals.Abs.gf ; -- by Patrik Jansson, Chalmers --- Small change by HH i.e --- ö in kettö should be ö with tilted long Hungarian dots ad-hoc written o% param DForm = ental | tiotal ; param Place = attr | indep ; @@ -13,9 +11,9 @@ lincat Sub100 = {s : Place => Str} ; lincat Sub1000 = {s : Place => Str} ; lincat Sub1000000 = {s : Str} ; lin num x0 = - {s = "/L" ++ x0.s ++ "L/"} ; -- the Latin-A-Supplement environment} ; + {s = x0.s} ; lin n2 = - {s = table { => "ketto%" ; + {s = table { => "kettö" ; => "húsz" ; => "két" ; => "huszon"}} ; @@ -40,24 +38,24 @@ lin pot0 d = lin pot110 = {s = table {p => "tíz"}} ; lin pot111 = - {s = table {p => "tizen" + "egy"}} ; + {s = table {p => "tizen" ++ "egy"}} ; lin pot1to19 d = - {s = table {p => "tizen" ++ d.s ! }} ; -- Glue! + {s = table {p => "tizen" ++ d.s ! }} ; lin pot0as1 n = {s = table {p => n.s ! }} ; lin pot1 d = {s = table {p => d.s ! }} ; lin pot1plus d e = - {s = table {p => (d.s ! ) ++ e.s ! }} ; -- Glue! + {s = table {p => (d.s ! ) ++ e.s ! }} ; lin pot1as2 n = {s = table {p => n.s ! p}} ; lin pot2 d = - {s = table {p => (d.s ! ) ++ "száz"}} ; -- Glue! + {s = table {p => (d.s ! ) ++ "száz"}} ; lin pot2plus d e = - {s = table {p => (d.s ! ) ++ "száz" ++ e.s ! indep}} ; -- Glue! + {s = table {p => (d.s ! ) ++ "száz" ++ e.s ! indep}} ; lin pot2as3 n = {s = n.s ! indep} ; lin pot3 n = - {s = n.s ! attr ++ "ezer"} ; -- Glue! + {s = n.s ! attr ++ "ezer"} ; lin pot3plus n m = - {s = n.s ! attr ++ "ezer" ++ m.s ! indep} ; -- Glue! + {s = n.s ! attr ++ "ezer" ++ m.s ! indep} ; diff --git a/grammars/numerals/old/italian.gf b/grammars/numerals/old/italian.gf index 4a453a6f6..29e15cd7b 100644 --- a/grammars/numerals/old/italian.gf +++ b/grammars/numerals/old/italian.gf @@ -1,39 +1,32 @@ include numerals.Abs.gf ; --- unit + hundreds | mille are written together more often that not. --- ten + unit are written together! - -param DForm = ental Pred | ton | tiotal | spctre; +param DForm = ental Pred | ton | tiotal ; param Num = sg | pl ; param Pred = pred | indip ; -oper LinDigit = {s : DForm => Str} ; - -lincat Digit = LinDigit ; +lincat Digit = {s : DForm => Str} ; lincat Sub10 = {s : DForm => Str ; n : Num} ; lincat Sub100 = {s : Str ; n : Num} ; lincat Sub1000 = {s : Str ; n : Num} ; lincat Sub1000000 = {s : Str} ; -oper vowel : Strs = strs {"u" ; "o"} ; -- uno e otto - -oper mkTal : Str -> Str -> Str -> LinDigit = +oper mkTal : Str -> Str -> Str -> Lin Digit = \två -> \tolv -> \tjugo -> - {s = table {ental _ => två ; ton => tolv ; tiotal => tjugo ; spctre => två}} ; + {s = table {ental _ => två ; ton => tolv ; tiotal => tjugo}} ; oper ss : Str -> {s : Str} = \s -> {s = s} ; oper spl : Str -> {s : Str ; n : Num} = \s -> {s = s ; n = pl} ; -oper mille : Str -> Num => Str = \s -> table {sg => "mille" ; pl => s ++ "mila"} ; -- Glue s + "mila"! +oper mille : Num => Str = table {sg => "mille" ; pl => "mila"} ; lin num x = x ; -lin n2 = mkTal "due" "dodici" ("vent" + pre {"i" ; [] / vowel}) ; -lin n3 = {s = table {ental _ => "tre" ; ton => "tredici" ; tiotal => ("trent" + pre {"a" ; [] / vowel}) ; spctre => "tré" } }; -lin n4 = mkTal "quattro" "quattordici" ("quarant" + pre {"a" ; [] / vowel}) ; -lin n5 = mkTal "cinque" "quindici" ("cinquant" + pre {"a" ; [] / vowel}) ; -lin n6 = mkTal "sei" "sedici" ("sessant" + pre {"a" ; [] / vowel}) ; -lin n7 = mkTal "sette" "diciassette" ("settant" + pre {"a" ; [] / vowel}) ; -lin n8 = mkTal "otto" "diciotto" ("ottant" + pre {"a" ; [] / vowel}) ; -lin n9 = mkTal "nove" "diciannove" ("novant" + pre {"a" ; [] / vowel}); +lin n2 = mkTal "due" "dodici" "venti" ; +lin n3 = mkTal "tre" "tredici" "trenta" ; +lin n4 = mkTal "quattro" "quattordici" "quaranta" ; +lin n5 = mkTal "cinque" "quindici" "cinquanta" ; +lin n6 = mkTal "sei" "sedici" "sessanta" ; +lin n7 = mkTal "sette" "diciassette" "settanta" ; +lin n8 = mkTal "otto" "diciotto" "ottanta" ; +lin n9 = mkTal "nove" "diciannove" "novanta" ; lin pot01 = {s = table {ental pred => [] ; _ => "uno"} ; n = sg} ; lin pot0 d = {s = table {f => d.s ! f} ; n = pl} ; @@ -42,11 +35,11 @@ lin pot111 = spl "undici" ; lin pot1to19 d = spl (d.s ! ton) ; lin pot0as1 n = {s = n.s ! ental indip ; n = n.n} ; lin pot1 d = spl (d.s ! tiotal) ; -lin pot1plus d e = spl (d.s ! tiotal ++ e.s ! spctre) ; -- Glue! +lin pot1plus d e = spl (d.s ! tiotal ++ e.s ! ental indip) ; lin pot1as2 n = {s = n.s ; n = n.n} ; -lin pot2 d = spl (d.s ! ental pred ++ "cento") ; -- Glue! -lin pot2plus d e = spl (d.s ! ental pred ++ "cento" ++ e.s) ; -- Glue! +lin pot2 d = spl (d.s ! ental pred ++ "cento") ; +lin pot2plus d e = spl (d.s ! ental pred ++ "cento" ++ e.s) ; lin pot2as3 n = {s = n.s ; n = n.n} ; -lin pot3 n = ss ((mille n.s) ! n.n) ; -lin pot3plus n m = ss ((mille n.s) ! n.n ++ m.s) ; +lin pot3 n = ss (n.s ++ mille ! n.n) ; +lin pot3plus n m = ss (n.s ++ mille ! n.n ++ m.s) ; diff --git a/grammars/numerals/old/polish.gf b/grammars/numerals/old/polish.gf index 379a4c36f..8ecc3839a 100644 --- a/grammars/numerals/old/polish.gf +++ b/grammars/numerals/old/polish.gf @@ -1,15 +1,5 @@ -- numerals in Polish, author Wojciech Mostowski, 20/9/2002 --- Did special Polish characters Harald Hammarstrom October 2003 --- e, for e, --- c' for c' --- s' for s' --- a, for a, --- l/ for l/ --- n' for n' --- z. for z. - - include numerals.Abs.gf ; -- all different for unit digits, teens, tens and hundreds @@ -47,47 +37,47 @@ dwiescie }; oper mkRegNum1 : Str -> LinDigit = \siedem -> - { s = table { unit => siedem ; teen => siedem + "nas'cie" ; - ten => siedem + "dziesia,t" ; hund => siedem + "set" + { s = table { unit => siedem ; teen => siedem + "nascie" ; + ten => siedem + "dziesiat" ; hund => siedem + "set" }; o = fiveup ; t = fiveup }; oper mkRegNum2 : Str -> LinDigit = \pie -> - { s = table { unit => pie + "c'" ; teen => pie + "tnas'cie" ; - ten => pie + "c'dziesia,t" ; hund => pie + "c'set" + { s = table { unit => pie + "c" ; teen => pie + "tnascie" ; + ten => pie + "cdziesiat" ; hund => pie + "cset" }; o = fiveup ; t = fiveup }; -oper mkTh : Str -> ThForm => Str = \s -> - table { onlyone => "tysia,c" ; lastone => s ++ "tysie,cy" ; - twoorthreeorfour => s ++ "tysia,ce" ; fiveup => s ++ "tysie,cy" +oper mkTh : ThForm => Str = + table { onlyone => "tysiac" ; lastone => "tysiecy" ; + twoorthreeorfour => "tysiace" ; fiveup => "tysiecy" }; oper ss : Str -> ThForm -> {s : Str ; t : ThForm} = \str -> \th -> {s = str; t = th} ; -lin num x = {s = "/L" ++ x.s ++ "L/"} ; -- the Polish in Latin A supplement ; +lin num x = x ; -lin n2 = mkNum "dwa" "dwanas'cie" "dwadzies'cia" "dwies'cie" +lin n2 = mkNum "dwa" "dwanascie" "dwadziescia" "dwiescie" twoorthreeorfour ; -lin n3 = mkNum "trzy" "trzynas'cie" "trzydzies'ci" "trzysta" +lin n3 = mkNum "trzy" "trzynascie" "trzydziesci" "trzysta" twoorthreeorfour ; -lin n4 = mkNum "cztery" "czternas'cie" (variants {"czterydzies'ci" ; "czterdzies'ci"}) "czterysta" +lin n4 = mkNum "cztery" "czternascie" "czterdziesci" "czterysta" twoorthreeorfour ; -lin n5 = mkRegNum2 "pie," ; -lin n6 = mkNum "szes'c'" "szesnas'cie" "szes'c'dziesia,t" "szes'c'set" fiveup; +lin n5 = mkRegNum2 "pie" ; +lin n6 = mkNum "szesc" "szesnascie" "szescdziesiat" "szescset" fiveup; lin n7 = mkRegNum1 "siedem" ; lin n8 = mkRegNum1 "osiem" ; -lin n9 = mkRegNum2 "dziewie," ; +lin n9 = mkRegNum2 "dziewie" ; lin pot01 = { s = table {hund => "sto"; f => "jeden" }; o = onlyone ; t = lastone }; lin pot0 d = {s = table {f => d.s ! f} ; o = d.o ; t = d.t} ; -lin pot110 = ss "dziesie,c'" fiveup ; -lin pot111 = ss "jedenas'cie" fiveup ; +lin pot110 = ss "dziesiec" fiveup ; +lin pot111 = ss "jedenascie" fiveup ; lin pot1to19 d = {s = d.s ! teen ; t = fiveup} ; lin pot0as1 n = {s = n.s ! unit ; t = n.o} ; lin pot1 d = {s = d.s ! ten ; t = fiveup} ; @@ -99,6 +89,6 @@ lin pot2plus d e = { s = d.s ! hund ++ e.s ; } ; lin pot2as3 n = n ; -lin pot3 n = {s = (mkTh n.s) ! n.t} ; -lin pot3plus n m = {s = (mkTh n.s) ! n.t ++ m.s} ; +lin pot3 n = {s = n.s ++ mkTh ! n.t} ; +lin pot3plus n m = {s = n.s ++ mkTh ! n.t ++ m.s} ; diff --git a/grammars/numerals/old/slovak.gf b/grammars/numerals/old/slovak.gf index 964f37689..9e781429e 100644 --- a/grammars/numerals/old/slovak.gf +++ b/grammars/numerals/old/slovak.gf @@ -1,56 +1,60 @@ include numerals.Abs.gf ; --- [c^], [s^], [c'] +-- by Karol Ostrovsky, Chalmers +-- mechanically translated to new GF notation by AR -param Size = sg | twothreefour | fiveup ; -param DForm = unit | teen | ten | hundred ; +param DForm = unit | teen | ten ; +param Place = indep | prae ; -lincat Digit = {s : DForm => Str ; size : Size} ; -lincat Sub10 = {s : DForm => Str ; size : Size} ; -lincat Sub100 = {s : Str; size : Size } ; -lincat Sub1000 = {s : Str; size : Size } ; - -oper mkNum : Str -> Str -> Str -> Size -> Lin Digit = - \dva -> \dvanast -> \dvadsat -> \sz -> - { s = table {unit => dva ; teen => dvanast ; ten => dvadsat ; hund => -dva + "sto" }; - size = sz - }; - -oper mkRegNum : Str -> Lin Digit = \unit -> - mkNum unit (unit + "nást'") (unit + "desiat") fiveup ; - -lin num x = {s = "/L" ++ x.s ++ "L/" } ; -- Latin A supplement encoding - -lin n2 = mkNum "dva" "dvanást'" "dvadsat'" twothreefour ; -lin n3 = mkNum "tri" "trinást'" "tridsat'" twothreefour ; -lin n4 = mkNum "s^tyri" "s^trnást'" "s^tyridsat'" twothreefour ; -lin n5 = mkNum "pät'" "pätnást'" "pädesiat" fiveup ; -lin n6 = mkNum "s^est'" "s^estnást'" "s^estdesiat" fiveup ; -lin n7 = mkRegNum "sedem" ; -lin n8 = mkRegNum "osem" ; -lin n9 = mkNum "devät'" "devätnást'" "devätdesiat" fiveup ; - -lin pot01 = {s = table {unit => "jeden" ; hundred => "sto" ; _ => "dummy" } ; - size = sg } ; -lin pot0 d = d ; -lin pot110 = {s = "desät'" ; size = fiveup } ; -lin pot111 = {s = "jedenást'" ; size = fiveup }; -lin pot1to19 d = {s = d.s ! teen ; size = fiveup} ; -lin pot0as1 n = {s = n.s ! unit ; size = n.size} ; -lin pot1 d = {s = d.s ! ten ; size = fiveup} ; -lin pot1plus d e = {s = variants { d.s ! ten ++ e.s ! unit ; e.s ! unit ++ "a" ++ d.s ! ten} ; size = tfSize e.size} ; -lin pot1as2 n = n ; -lin pot2 d = {s = d.s ! hundred ; size = fiveup} ; -lin pot2plus d e = {s = d.s ! hundred ++ e.s ; size = tfSize e.size} ; -lin pot2as3 n = {s = n.s } ; -lin pot3 n = {s = (mkTh n.s) ! n.size} ; -lin pot3plus n m = {s = (mkTh n.s) ! n.size ++ m.s} ; - -oper tfSize : Size -> Size = \sz -> - table {sg => fiveup ; other => other} ! sz ; - -oper mkTh : Str -> Size => Str = \attr -> - table {sg => "tisíc" ; - twothreefour => attr ++ "tisíce" ; - fiveup => attr ++ "tisíc" } ; +lincat Numeral = {s : Str} ; +lincat Digit = {s : {p1 : DForm ; p2 : Place} => Str} ; +lincat Sub10 = {s : {p1 : DForm ; p2 : Place} => Str} ; +lincat Sub100 = {s : Place => Str} ; +lincat Sub1000 = {s : Place => Str} ; +lincat Sub1000000 = {s : Str} ; +lin num x0 = + {s = x0.s} ; +lin n2 = + {s = table {{p1 = unit ; p2 = indep} => "dva" ; {p1 = unit ; p2 = prae} => "dve" ; {p1 = teen ; p2 = indep} => "dvanast" ; {p1 = teen ; p2 = prae} => "dvanast" ; {p1 = ten ; p2 = indep} => "dvadsat" ; {p1 = ten ; p2 = prae} => "dvadsat"}} ; +lin n3 = + {s = table {{p1 = unit ; p2 = indep} => "tri" ; {p1 = unit ; p2 = prae} => "tri" ; {p1 = teen ; p2 = indep} => "trinast" ; {p1 = teen ; p2 = prae} => "trinast" ; {p1 = ten ; p2 = indep} => "tridsat" ; {p1 = ten ; p2 = prae} => "tridsat"}} ; +lin n4 = + {s = table {{p1 = unit ; p2 = indep} => "styri" ; {p1 = unit ; p2 = prae} => "styri" ; {p1 = teen ; p2 = indep} => "strnast" ; {p1 = teen ; p2 = prae} => "strnast" ; {p1 = ten ; p2 = indep} => "styridsat" ; {p1 = ten ; p2 = prae} => "styridsat"}} ; +lin n5 = + {s = table {{p1 = unit ; p2 = indep} => "pat" ; {p1 = unit ; p2 = prae} => "pat" ; {p1 = teen ; p2 = indep} => "patnast" ; {p1 = teen ; p2 = prae} => "patnast" ; {p1 = ten ; p2 = indep} => "patdesiat" ; {p1 = ten ; p2 = prae} => "patdesiat"}} ; +lin n6 = + {s = table {{p1 = unit ; p2 = indep} => "sest" ; {p1 = unit ; p2 = prae} => "sest" ; {p1 = teen ; p2 = indep} => "sestnast" ; {p1 = teen ; p2 = prae} => "sestnast" ; {p1 = ten ; p2 = indep} => "sestdesiat" ; {p1 = ten ; p2 = prae} => "sestdesiat"}} ; +lin n7 = + {s = table {{p1 = unit ; p2 = indep} => "sedem" ; {p1 = unit ; p2 = prae} => "sedem" ; {p1 = teen ; p2 = indep} => "sedemnast" ; {p1 = teen ; p2 = prae} => "sedemnast" ; {p1 = ten ; p2 = indep} => "sedemdesiat" ; {p1 = ten ; p2 = prae} => "sedemdesiat"}} ; +lin n8 = + {s = table {{p1 = unit ; p2 = indep} => "osem" ; {p1 = unit ; p2 = prae} => "osem" ; {p1 = teen ; p2 = indep} => "osemnast" ; {p1 = teen ; p2 = prae} => "osemnast" ; {p1 = ten ; p2 = indep} => "osemdesiat" ; {p1 = ten ; p2 = prae} => "osemdesiat"}} ; +lin n9 = + {s = table {{p1 = unit ; p2 = indep} => "devat" ; {p1 = unit ; p2 = prae} => "devat" ; {p1 = teen ; p2 = indep} => "devatnast" ; {p1 = teen ; p2 = prae} => "devatnast" ; {p1 = ten ; p2 = indep} => "devatdesiat" ; {p1 = ten ; p2 = prae} => "devatdesiat"}} ; +lin pot01 = + {s = table {{p1 = unit ; p2 = indep} => "jedna" ; {p1 = unit ; p2 = prae} => [] ; {p1 = teen ; p2 = indep} => "jedna" ; {p1 = teen ; p2 = prae} => [] ; {p1 = ten ; p2 = indep} => "jedna" ; {p1 = ten ; p2 = prae} => []}} ; +lin pot0 d = + {s = table {{p1 = unit ; p2 = indep} => d.s ! {p1 = unit ; p2 = indep} ; {p1 = unit ; p2 = prae} => d.s ! {p1 = unit ; p2 = prae} ; {p1 = teen ; p2 = indep} => d.s ! {p1 = teen ; p2 = indep} ; {p1 = teen ; p2 = prae} => d.s ! {p1 = teen ; p2 = prae} ; {p1 = ten ; p2 = indep} => d.s ! {p1 = ten ; p2 = indep} ; {p1 = ten ; p2 = prae} => d.s ! {p1 = ten ; p2 = prae}}} ; +lin pot110 = + {s = table {indep => "desat" ; prae => "desat"}} ; +lin pot111 = + {s = table {indep => "jedenast" ; prae => "jedenast"}} ; +lin pot1to19 d = + {s = table {indep => d.s ! {p1 = teen ; p2 = indep} ; prae => d.s ! {p1 = teen ; p2 = prae}}} ; +lin pot0as1 n = + {s = table {indep => n.s ! {p1 = unit ; p2 = indep} ; prae => n.s ! {p1 = unit ; p2 = indep}}} ; +lin pot1 d = + {s = table {indep => d.s ! {p1 = ten ; p2 = indep} ; prae => d.s ! {p1 = ten ; p2 = prae}}} ; +lin pot1plus d e = + {s = table {indep => (d.s ! {p1 = ten ; p2 = indep}) ++ e.s ! {p1 = unit ; p2 = indep} ; prae => (d.s ! {p1 = ten ; p2 = prae}) ++ e.s ! {p1 = unit ; p2 = indep}}} ; +lin pot1as2 n = + {s = table {indep => n.s ! indep ; prae => n.s ! indep}} ; +lin pot2 d = + {s = table {indep => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto" ; prae => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto"}} ; +lin pot2plus d e = + {s = table {indep => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto" ++ e.s ! indep ; prae => (d.s ! {p1 = unit ; p2 = prae}) ++ "sto" ++ e.s ! indep}} ; +lin pot2as3 n = + {s = n.s ! indep} ; +lin pot3 n = + {s = (n.s ! prae) ++ "tisic"} ; +lin pot3plus n m = + {s = (n.s ! prae) ++ "tisic" ++ m.s ! indep} ; diff --git a/grammars/numerals/old/spanish.gf b/grammars/numerals/old/spanish.gf index 5cd4857c8..30d7e46a4 100644 --- a/grammars/numerals/old/spanish.gf +++ b/grammars/numerals/old/spanish.gf @@ -1,63 +1,61 @@ include numerals.Abs.gf ; -param DForm = unit | teen | ten | hundred | veinti ; -param Size = sg | two | pl ; -param Uso = indep | attr ; +-- by Carlos Gonzalia, Chalmers, 1999 +-- original source automatically translated to new GF by AR + +param DForm = unit | teen | ten | hundred ; +param Modif = mod | unmod | conj ; lincat Numeral = {s : Str} ; -lincat Digit = {s : DForm => Str ; size : Size } ; -lincat Sub10 = {s : DForm => Str ; size : Size } ; -lincat Sub100 = {s : Uso => Str ; size : Size} ; -lincat Sub1000 = {s : Uso => Str ; size : Size} ; +lincat Digit = {inh : Modif ; s : {p1 : DForm ; p2 : Modif} => Str} ; +lincat Sub10 = {s : {p1 : DForm ; p2 : Modif} => Str} ; +lincat Sub100 = {s : Str} ; +lincat Sub1000 = {s : Str} ; lincat Sub1000000 = {s : Str} ; -oper mkNum : Str -> Str -> Str -> Str -> Lin Digit = - \dois -> \doze -> \vinte -> \duzentos -> - {s = table {unit => dois ; teen => doze ; ten => vinte ; hundred => duzentos ;veinti => "veinti" + dois } ; size = pl} ; - - lin num x0 = {s = x0.s} ; - -lin n2 = {s = table {unit => "dos" ; teen => "doce" ; ten => "veinte" ; hundred => "doscientos" ; veinti => "veinti" + "dos" } ; size = two } ; -lin n3 = mkNum "tres" "trece" "treinta" "trescientos" ; -lin n4 = mkNum "cuatro" "catorce" "cuarenta" "cuatrocientos" ; -lin n5 = mkNum "cinco" "quince" "cincuenta" "quinientos" ; -lin n6 = {s = table {unit => "seis" ; teen => "dieciseís" ; ten => "sesenta" ; hundred => "seiscientos" ; veinti => "veinti" + "seís" } ; size = pl } ; -lin n7 = mkNum "siete" "diecisiete" "setenta" "setecientos" ; -lin n8 = mkNum "ocho" "dieciocho" "ochenta" "ochocientos" ; -lin n9 = mkNum "nueve" "diecinueve" "noventa" "novecientos" ; - -lin pot01 = {s = table {unit => "uno" ; hundred => "cien" ; veinti => "veinti" + "uno" ; _ => "dummy"} ; size = sg} ; -lin pot0 d = d ; -lin pot110 = - {s = table {_ => "diez" } ; size = pl} ; +lin n2 = + {inh = mod ; s = table {{p1 = unit ; p2 = mod} => "dos" ; {p1 = unit ; p2 = unmod} => "dos" ; {p1 = unit ; p2 = conj} => "y" ++ "dos" ; {p1 = teen ; p2 = mod} => "doce" ; {p1 = teen ; p2 = unmod} => "doce" ; {p1 = teen ; p2 = conj} => "doce" ; {p1 = ten ; p2 = mod} => "veinti" ; {p1 = ten ; p2 = unmod} => "veinte" ; {p1 = ten ; p2 = conj} => "veinte" ; {p1 = hundred ; p2 = mod} => "doscientos" ; {p1 = hundred ; p2 = unmod} => "doscientos" ; {p1 = hundred ; p2 = conj} => "doscientos"}} ; +lin n3 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "tres" ; {p1 = unit ; p2 = unmod} => "tres" ; {p1 = unit ; p2 = conj} => "y" ++ "tres" ; {p1 = teen ; p2 = mod} => "trece" ; {p1 = teen ; p2 = unmod} => "trece" ; {p1 = teen ; p2 = conj} => "trece" ; {p1 = ten ; p2 = mod} => "treinta" ; {p1 = ten ; p2 = unmod} => "treinta" ; {p1 = ten ; p2 = conj} => "treinta" ; {p1 = hundred ; p2 = mod} => "trescientos" ; {p1 = hundred ; p2 = unmod} => "trescientos" ; {p1 = hundred ; p2 = conj} => "trescientos"}} ; +lin n4 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "cuatro" ; {p1 = unit ; p2 = unmod} => "cuatro" ; {p1 = unit ; p2 = conj} => "y" ++ "cuatro" ; {p1 = teen ; p2 = mod} => "catorce" ; {p1 = teen ; p2 = unmod} => "catorce" ; {p1 = teen ; p2 = conj} => "catorce" ; {p1 = ten ; p2 = mod} => "cuarenta" ; {p1 = ten ; p2 = unmod} => "cuarenta" ; {p1 = ten ; p2 = conj} => "cuarenta" ; {p1 = hundred ; p2 = mod} => "cuatrocientos" ; {p1 = hundred ; p2 = unmod} => "cuatrocientos" ; {p1 = hundred ; p2 = conj} => "cuatrocientos"}} ; +lin n5 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "cinco" ; {p1 = unit ; p2 = unmod} => "cinco" ; {p1 = unit ; p2 = conj} => "y" ++ "cinco" ; {p1 = teen ; p2 = mod} => "quince" ; {p1 = teen ; p2 = unmod} => "quince" ; {p1 = teen ; p2 = conj} => "quince" ; {p1 = ten ; p2 = mod} => "cincuenta" ; {p1 = ten ; p2 = unmod} => "cincuenta" ; {p1 = ten ; p2 = conj} => "cincuenta" ; {p1 = hundred ; p2 = mod} => "quinientos" ; {p1 = hundred ; p2 = unmod} => "quinientos" ; {p1 = hundred ; p2 = conj} => "quinientos"}} ; +lin n6 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "seis" ; {p1 = unit ; p2 = unmod} => "seis" ; {p1 = unit ; p2 = conj} => "y" ++ "seis" ; {p1 = teen ; p2 = mod} => "dieciseis" ; {p1 = teen ; p2 = unmod} => "dieciseis" ; {p1 = teen ; p2 = conj} => "dieciseis" ; {p1 = ten ; p2 = mod} => "sesenta" ; {p1 = ten ; p2 = unmod} => "sesenta" ; {p1 = ten ; p2 = conj} => "sesenta" ; {p1 = hundred ; p2 = mod} => "seiscientos" ; {p1 = hundred ; p2 = unmod} => "seiscientos" ; {p1 = hundred ; p2 = conj} => "seiscientos"}} ; +lin n7 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "siete" ; {p1 = unit ; p2 = unmod} => "siete" ; {p1 = unit ; p2 = conj} => "y" ++ "siete" ; {p1 = teen ; p2 = mod} => "diecisiete" ; {p1 = teen ; p2 = unmod} => "diecisiete" ; {p1 = teen ; p2 = conj} => "diecisiete" ; {p1 = ten ; p2 = mod} => "setenta" ; {p1 = ten ; p2 = unmod} => "setenta" ; {p1 = ten ; p2 = conj} => "setenta" ; {p1 = hundred ; p2 = mod} => "setecientos" ; {p1 = hundred ; p2 = unmod} => "setecientos" ; {p1 = hundred ; p2 = conj} => "setecientos"}} ; +lin n8 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "ocho" ; {p1 = unit ; p2 = unmod} => "ocho" ; {p1 = unit ; p2 = conj} => "y" ++ "ocho" ; {p1 = teen ; p2 = mod} => "dieciocho" ; {p1 = teen ; p2 = unmod} => "dieciocho" ; {p1 = teen ; p2 = conj} => "dieciocho" ; {p1 = ten ; p2 = mod} => "ochenta" ; {p1 = ten ; p2 = unmod} => "ochenta" ; {p1 = ten ; p2 = conj} => "ochenta" ; {p1 = hundred ; p2 = mod} => "ochocientos" ; {p1 = hundred ; p2 = unmod} => "ochocientos" ; {p1 = hundred ; p2 = conj} => "ochocientos"}} ; +lin n9 = + {inh = conj ; s = table {{p1 = unit ; p2 = mod} => "nueve" ; {p1 = unit ; p2 = unmod} => "nueve" ; {p1 = unit ; p2 = conj} => "y" ++ "nueve" ; {p1 = teen ; p2 = mod} => "diecinueve" ; {p1 = teen ; p2 = unmod} => "diecinueve" ; {p1 = teen ; p2 = conj} => "diecinueve" ; {p1 = ten ; p2 = mod} => "noventa" ; {p1 = ten ; p2 = unmod} => "noventa" ; {p1 = ten ; p2 = conj} => "noventa" ; {p1 = hundred ; p2 = mod} => "novecientos" ; {p1 = hundred ; p2 = unmod} => "novecientos" ; {p1 = hundred ; p2 = conj} => "novecientos"}} ; +lin pot01 = + {s = table {{p1 = unit ; p2 = mod} => "uno" ; {p1 = unit ; p2 = unmod} => "uno" ; {p1 = unit ; p2 = conj} => "y" ++ "uno" ; {p1 = teen ; p2 = mod} => "uno" ; {p1 = teen ; p2 = unmod} => "uno" ; {p1 = teen ; p2 = conj} => "y" ++ "uno" ; {p1 = ten ; p2 = mod} => "uno" ; {p1 = ten ; p2 = unmod} => "uno" ; {p1 = ten ; p2 = conj} => "y" ++ "uno" ; {p1 = hundred ; p2 = mod} => "ciento" ; {p1 = hundred ; p2 = unmod} => "cien" ; {p1 = hundred ; p2 = conj} => "y" ++ "uno"}} ; +lin pot0 d = + {s = table {{p1 = unit ; p2 = mod} => d.s ! {p1 = unit ; p2 = mod} ; {p1 = unit ; p2 = unmod} => d.s ! {p1 = unit ; p2 = unmod} ; {p1 = unit ; p2 = conj} => d.s ! {p1 = unit ; p2 = conj} ; {p1 = teen ; p2 = mod} => d.s ! {p1 = teen ; p2 = mod} ; {p1 = teen ; p2 = unmod} => d.s ! {p1 = teen ; p2 = unmod} ; {p1 = teen ; p2 = conj} => d.s ! {p1 = teen ; p2 = conj} ; {p1 = ten ; p2 = mod} => d.s ! {p1 = ten ; p2 = mod} ; {p1 = ten ; p2 = unmod} => d.s ! {p1 = ten ; p2 = unmod} ; {p1 = ten ; p2 = conj} => d.s ! {p1 = ten ; p2 = conj} ; {p1 = hundred ; p2 = mod} => d.s ! {p1 = hundred ; p2 = mod} ; {p1 = hundred ; p2 = unmod} => d.s ! {p1 = hundred ; p2 = unmod} ; {p1 = hundred ; p2 = conj} => d.s ! {p1 = hundred ; p2 = conj}}} ; +lin pot110 = + {s = "diez"} ; lin pot111 = - {s = table {_ => "once" } ; size = pl} ; + {s = "once"} ; lin pot1to19 d = - {s = table {_ => d.s ! teen } ; size = pl} ; + {s = d.s ! {p1 = teen ; p2 = unmod}} ; lin pot0as1 n = - {s = table {indep => n.s ! unit ; attr => shorten (n.s ! unit) n.size }; size = n.size } ; + {s = n.s ! {p1 = unit ; p2 = unmod}} ; lin pot1 d = - {s = table {_ => d.s ! ten } ; size = pl} ; + {s = d.s ! {p1 = ten ; p2 = unmod}} ; lin pot1plus d e = - {s = table {indep => table {two => e.s ! veinti ; _ => d.s ! ten ++ "y" ++ e.s ! unit} ! d.size ; attr => table {two => accent (e.s ! veinti) e.size ; _ => d.s ! ten ++ "y" ++ (shorten (e.s ! unit) e.size)} ! d.size } ; size = pl} ; + {s = (d.s ! {p1 = ten ; p2 = mod}) ++ e.s ! {p1 = unit ; p2 = d.inh}} ; lin pot1as2 n = - {s = table {f => n.s ! f } ; size = n.size} ; + {s = n.s} ; lin pot2 d = - {s = table {_ => d.s ! hundred } ; size = pl} ; + {s = d.s ! {p1 = hundred ; p2 = unmod}} ; lin pot2plus d e = - {s = table {f => table {sg => "ciento" ; - _ => d.s ! hundred } ! d.size ++ e.s ! f} ; size = pl} ; + {s = (d.s ! {p1 = hundred ; p2 = mod}) ++ e.s} ; lin pot2as3 n = - {s = n.s ! indep } ; + {s = n.s} ; lin pot3 n = - {s = table {sg => "mil" ; _ => n.s ! attr ++ "mil"} ! n.size} ; + {s = n.s ++ "mil"} ; lin pot3plus n m = - {s = table {sg => "mil" ; _ => n.s ! attr ++ "mil"} ! n.size ++ m.s ! indep} ; - -oper accent : Str -> Size -> Str = \s -> \sz -> - table {sg => "veintiún" ; _ => s} ! sz ; - -oper shorten : Str -> Size -> Str = \s -> \sz -> - table {sg => "un" ; _ => s} ! sz ; \ No newline at end of file + {s = n.s ++ "mil" ++ m.s} ;