diff --git a/examples/numerals/Numerals.gf b/examples/numerals/Numerals.gf new file mode 100644 index 000000000..ee5ea8d52 --- /dev/null +++ b/examples/numerals/Numerals.gf @@ -0,0 +1,35 @@ +abstract Numerals = { + +-- 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/af_tunni.gf b/examples/numerals/af_tunni.gf new file mode 100644 index 000000000..0af735737 --- /dev/null +++ b/examples/numerals/af_tunni.gf @@ -0,0 +1,53 @@ +concrete af_tunni of Numerals = { +-- 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 "kw" ; +lin n2 = mkNum "lmma" "labaatn"; +lin n3 = mkNum "sddi?" "soddn" ; +lin n4 = mkNum "far" "afartn"; +lin n5 = mkNum "s^n" "kontn"; +lin n6 = mkNum "l?" "lihdn"; +lin n7 = mkNum "toddbo" "toddobtan"; +lin n8 = mkNum "siyed" "siyyetan" ; +lin n9 = mkNum "sagal" "sagas^an"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = table {f => "kw" }; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "tmon" ; +lin pot111 = ss ("tmon" ++ "i" ++ "kw") ; +lin pot1to19 d = ss ("tmon" ++ "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) ++ "boql" ); +lin pot2plus d e = ss ((selsg d.size (d.s ! unit)) ++ "boql" ++ e.s) ; +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = (selsg n.size n.s) ++ "kn"} ; +lin pot3plus n m = {s = (selsg n.size n.s) ++ "kn" ++ 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..223a3f04d --- /dev/null +++ b/examples/numerals/albanian.gf @@ -0,0 +1,50 @@ +concrete albanian of Numerals = { +-- 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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; +lincat Sub1000000 = { s : Str } ; + +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 => "njzet" }}; +lin n3 = mkNum "tre" ; +lin n4 = {s = table {unit => "katr" ; teen => "katr" + "mb" + "dhjet" ; ten => "dyzet" } }; +lin n5 = mkNum "pes" ; +lin n6 = mkNum "gjasht"; +lin n7 = mkNum "shtat"; +lin n8 = mkNum "tet"; +lin n9 = mkNum "nnt"; + +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..485e50089 --- /dev/null +++ b/examples/numerals/amharic.gf @@ -0,0 +1,86 @@ +concrete amharic of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=ethiopic ; + +-- 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" ዕ6ትህ ሮውእ +-- አ ኢስ ኣ" (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 = [] ++ x0.s ++ []} ; +lin n2 = mkNum "ሁለት" (variants {"ሃያ" ; "ሓያ" ; "ኃያ" ; "ካያ" }) ; +lin n3 = mkNum "ሦስት" "ሠላሳ" ; +lin n4 = mkNum "ኣራት" "ኣርባ" ; +lin n5 = mkNum "ኣምስት" (variants { "ኣምሳ" ; "ኃምሳ" }) ; +lin n6 = mkNum "ስድስት" (variants { "ስድሳ" ; "ስልሳ" }) ; +lin n7 = mkNum "ሰባት" "ሰባ" ; +lin n8 = mkNum "ስምንት" "ሰማንያ" ; +lin n9 = mkNum "ዘጠኝ" "ዘጠና" ; + +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 => "ኣንድ" ; ten => "ኣስራ" }; size = sg}; +lin pot0 d = d ; +lin pot110 = ss1 "ኣስር" "ኣንድ" [] ; +lin pot111 = ss1 (variants {"ኣስራንድ" ; "ኣስራ" ++ "ኣንድ" }) "ኣንድ" Sih ; +lin pot1to19 d = ss1 ("ኣስራ" ++ d.s ! unit) "ኣንድ" (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 ++ "እሌፍ" ++ n.s ! sihpart ; size = n.size} ; + +lin pot2 d = {s = (sel d.size [] (d.s ! unit)) ++ "መቶ" ; + s2 = sel d.size "ኣስር" (d.s ! ten) ; size = tenplus} ; +lin pot2plus d e = {s = (sel d.size [] (d.s ! unit)) ++ "መቶ" ++ e.s ! indep ; s2 = d.s ! ten ++ e.s ! tenpart ++ "እሌፍ" ++ 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 {"ሺህ" ; "ሺ"} ; + +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 ; + +} diff --git a/examples/numerals/arabic_classical.gf b/examples/numerals/arabic_classical.gf new file mode 100644 index 000000000..3420895bd --- /dev/null +++ b/examples/numerals/arabic_classical.gf @@ -0,0 +1,101 @@ +concrete arabic_classical of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=arabic0600 ; + +-- 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 = [] ++ x0.s ++ []} ; -- the Arabic0x0600 environment + +lin n2 = + {s = table {(unit attr) => [] ; + (unit indep) => "اثنان" ; + teen => "اثنا" ; + ten => "عشرون" ; + hund => "مائتان"} ; size = dual} ; +lin n3 = + {s = table {(unit _) => "ثلاثة" ; + teen => "ثلاثة" ; + ten => "ثلاثون" ; + hund => variants {"ثلاث" ++ "مائة" ; "ثلاثمائة"}} ; + size = pl} ; +lin n4 = + {s = table {(unit _) => "أربعة" ; + teen => "أربعة" ; + ten => "أربعون" ; + hund => variants {"أربع" ++ "مائة" ; "أربعمائة"}} ; + size = pl} ; +lin n5 = + {s = table {(unit _) => "خمسة" ; + teen => "خمسة" ; + ten => "خمسون" ; + hund => variants {"خمس" ++ "مائة" ; "خمسمائة"}} ; size = pl} ; +lin n6 = + {s = table {(unit _) => "ستة" ; + teen => "ستة" ; + ten => "ستون" ; + hund => variants {"ست" ++ "مائة" ; "ستمائة"}} ; size = pl} ; +lin n7 = + {s = table {(unit _) => "سبعة" ; + teen => "سبعة" ; + ten => "سبعون" ; + hund => variants {"سبع" ++ "مائة" ; "سبعمائة"}} ; size = pl} ; +lin n8 = + {s = table {(unit _) => "ثمانية" ; + teen => "ثمانية" ; + ten => "ثمانون" ; + hund => variants {"ثمان" ++ "مائة" ; "ثمانمائة"}} ; + size = pl} ; +lin n9 = + {s = table {(unit _) => "تسعة" ; + teen => "تسعة" ; + ten => "تسعون" ; + hund => variants {"تسع" ++ "مائة" ; "تسعمائة"}} ; + size = pl} ; + +lin pot01 = + {s = table {hund => (variants {"مائة" ; "م0ة"} ) ; (unit attr) => [] ; f => "واحد"} ; size = sg} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "عشرة"} ; size = pl} ; +lin pot111 = + {s = table {_ => "احد" ++ "عشر"} ; size = eleventonineteen} ; +lin pot1to19 d = + {s = table {_ => d.s ! teen ++ "عشر"} ; 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 ++ "و" ++ 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 ++ "و" ++ 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 ++ "و" ++ m.s ! indep} ; + +oper Alf : Size => Str = + table {{pl} => "آلاف" ; {dual} => "الفان" ; {eleventonineteen} => "الفا" ; sg => "الف"} ; + + +} diff --git a/examples/numerals/arabic_modern.gf b/examples/numerals/arabic_modern.gf new file mode 100644 index 000000000..658b6776b --- /dev/null +++ b/examples/numerals/arabic_modern.gf @@ -0,0 +1,94 @@ +concrete arabic_modern of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=arabic ; + +--- flags unlexer=reverse ; +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) => "ﺍﺛﻨﻴﻦ" ; + teen => "ﺍﺛﻨﻰ" ; + ten => "ﻋﺸﺮﻳﻦ" ; + hund => "ﻣﺎﺋﺘﻴﻦ"} ; size = dual} ; +lin n3 = + {s = table {(unit _) => "ﺛﻼﺛﺔ" ; + teen => "ﺛﻼﺛﺔ" ; + ten => "ﺛﻼﺛﻴﻦ" ; + hund => "ﺛﻼﺛﻤﺎﺋﺔ"} ; size = small} ; +lin n4 = + {s = table {(unit _) => "ﺃﺭﺑﻌﺔ" ; + teen => "ﺃﺭﺑﻌﺔ" ; + ten => "ﺃﺭﺑﻌﻴﻦ" ; + hund => "ﺃﺭﺑﻌﻤﺎﺋﺔ"} ; size = small} ; +lin n5 = + {s = table {(unit _) => "ﺧﻤﺴﺔ" ; + teen => "ﺧﻤﺴﺔ" ; + ten => "ﺧﻤﺴﻴﻦ" ; + hund => "ﺧﻤﺴﻤﺎﺋﺔ"} ; size = small} ; +lin n6 = + {s = table {(unit _) => "ﺳﺘﺔ" ; + teen => "ﺳﺘﺔ" ; + ten => "ﺳﺘﻴﻦ" ; + hund => "ﺳﺘﻤﺎﺋﺔ"} ; size = small} ; +lin n7 = + {s = table {(unit _) => "ﺳﺒﻌﺔ" ; + teen => "ﺳﺒﻌﺔ" ; + ten => "ﺳﺒﻌﻴﻦ" ; + hund => "ﺳﺒﻌﻤﺎﺋﺔ"} ; size = small} ; +lin n8 = + {s = table {(unit _) => "ﺛﻤﺎﻧﻴﺔ" ; + teen => "ﺛﻤﺎﻧﻴﺔ" ; + ten => "ﺛﻤﺎﻧﻴﻦ" ; + hund => "ﺛﻤﺎﻧﻤﺎﺋﺔ"} ; size = small} ; +lin n9 = + {s = table {(unit _) => "ﺗﺴﻌﺔ" ; + teen => "ﺗﺴﻌﺔ" ; + ten => "ﺗﺴﻌﻴﻦ" ; + hund => "ﺗﺴﻌﻤﺎﺋﺔ"} ; size = small} ; + +lin pot01 = + {s = table {hund => "ﻣﺎﺋﺔ"; (unit attr) => [] ; f => "ﻭﺍﺣﺪ"} ; size = large} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "ﻋﺸﺮﺓ"} ; size = small} ; +lin pot111 = + {s = table {_ => "ﺍﺣﺪ" ++ "ﻋﺸﺮ"} ; size = large} ; +lin pot1to19 d = + {s = table {_ => d.s ! teen ++ "ﻋﺸﺮ"} ; 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 ++ "ﻭ" ++ 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 ++ "ﻭ" ++ 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 ++ "ﻭ" ++ m.s ! indep} ; + +oper Alf : Size => Str = + table {{small} => "ﺁﻻﻑ" ; {dual} => "ﺍﻟﻔﻴﻦ" ; _ => "ﺍﻟﻒ"} ; + + +} diff --git a/examples/numerals/basque.gf b/examples/numerals/basque.gf new file mode 100644 index 000000000..9b0dc0e93 --- /dev/null +++ b/examples/numerals/basque.gf @@ -0,0 +1,62 @@ +concrete basque of Numerals = { +-- 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..a56abd18f --- /dev/null +++ b/examples/numerals/bearlake_slave.gf @@ -0,0 +1,49 @@ +concrete bearlake_slave of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | hundred ; + +oper LinDigit = {s : Str } ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> LinDigit = \two -> + {s = two } ; + +-- TODO: Transl. + +lin num x = x ; +-- lin n1 mkNum "l-e" ; +lin n2 = mkNum "nkee" ; +lin n3 = mkNum "tai" ; +lin n4 = mkNum "di,i," ; +lin n5 = mkNum "so,li" ; +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 {"honno," ; "hno" }} ; +lin pot111 = {s = variants {"honno," ; "hno" } ++ o ++ "l-e" } ; +lin pot1to19 d = {s = (variants {"honno," ; "hno" }) ++ o ++ d.s } ; +lin pot0as1 n = n ; +lin pot1 d = {s = d.s ++ (variants {"honno," ; "no,"})} ; +lin pot1plus d e = {s = d.s ++ (variants {"honno," ; "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 ++ "laml"} ; +lin pot3plus n m = {s = n.s ++ "laml" ++ m.s } ; + + +} diff --git a/examples/numerals/bulgarian.gf b/examples/numerals/bulgarian.gf new file mode 100644 index 000000000..7f74a5555 --- /dev/null +++ b/examples/numerals/bulgarian.gf @@ -0,0 +1,58 @@ +concrete bulgarian of Numerals = { +flags coding = utf8 ; +-- ä is ya +-- q is [ch] +-- w for [sh] +-- j for i kratkoe i.e i with a thing + +-- include numerals.Abs.gf ; +-- flags coding=russian ; + +param Size = sg | below10 | tenover ; +param DForm = unit | teen | ten | hundred ; + +oper LinDigit = {s : DForm => Str ; size : Size } ; + +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 } ; + +oper mkNum : Str -> Str -> Str -> LinDigit = \tri -> \trijset -> \trista -> + { s = table {unit => tri ; teen => variants {tri + "надесет" ; tri + "найсет" }; ten => trijset ; hund => trista} ; size = below10}; + +lin num x = {s = [] ++ x.s ++ []} ; -- the (Russian) Cyrillic ad-hoc translation + +lin n2 = {s = table {unit => "две" ; teen => variants {"дванадесет" ; "дванайсет"}; ten => "двайсет" ; hund => "двеста" } ; size = below10 } ; +lin n3 = mkNum "три" (variants {"трийсет"; "тридесет"}) "триста" ; +lin n4 = mkNum "четири" (variants {"четирисет" ; "четирийсет" ; "четиридесет"}) "четиристотин" ; +lin n5 = mkNum "пет" "петдесет" "петстотин" ; +lin n6 = mkNum "шест" (variants {"шестдесет" ; "шейсет"}) "шестстотин" ; +lin n7 = mkNum "седем" "седемдесет" "седемстотин" ; +lin n8 = mkNum "осем" "осемдесет" "осемстотин" ; +lin n9 = mkNum "девет" "деветдесет" "деветстотин" ; + +lin pot01 = { s = table {unit => "едно" ; hundred => "сот" ; _ => "думмю" } ; size = sg }; +lin pot0 d = d ; +lin pot110 = {s = "десет" ; size = below10}; +lin pot111 = {s = variants {"единадесет" ; "единайсет" }; 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 ++ "и" ++ 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 => "жиляда" ; _ => attr ++ "жиляди" } ! sz ; + +oper maybei : Size -> Str = \sz -> table {tenover => [] ; _ => "и"} ! sz ; + + +} diff --git a/examples/numerals/catalan.gf b/examples/numerals/catalan.gf new file mode 100644 index 000000000..2076a0918 --- /dev/null +++ b/examples/numerals/catalan.gf @@ -0,0 +1,63 @@ +concrete catalan of Numerals = { +-- include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \s1 -> \s2 -> s1 ++ s2 ; + +param DForm = unit | teen | ten | hundred | vint | null ; +param Size = sg | two | pl ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size } ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \dois -> \doze -> \vinte -> + {s = table {unit => dois ; teen => doze ; ten => vinte ; hundred => dois + "-" + "cents" ; vint => "vint-i-" + dois ; null => [] } ; 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" ; null => []} ; 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 ++ d.s ! null ; _ => bind (bind (d.s ! ten) "-") (e.s ! unit) } ! d.size ; size = pl} ; +--{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..72cf910ce --- /dev/null +++ b/examples/numerals/chinese.gf @@ -0,0 +1,115 @@ +concrete chinese of Numerals = { +-- 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..4a7552feb --- /dev/null +++ b/examples/numerals/croatian.gf @@ -0,0 +1,77 @@ +concrete croatian of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str; o : ThForm ; t : ThForm } ; +lincat Sub100 = {s : Str; t : ThForm } ; +lincat Sub1000 = {s : Str; t : ThForm } ; +lincat Sub1000000 = { s : Str } ; + +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" ; "tisuć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 = [] ++ x.s ++ []} ; -- 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 "četiri" "četrnaest" "četrdeset" ("četiri" ++ "stotine") twoorthreeorfour ; +lin n5 = mkNum "pet" "petnaest" "pedeset" ("pet" ++ "stotina") fiveup ; +lin n6 = mkNum "šest" "šesnaest" "šezdeset" ("š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..abbe16134 --- /dev/null +++ b/examples/numerals/czech.gf @@ -0,0 +1,67 @@ +concrete czech of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; + +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 -> Size -> LinDigit = + \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 -> LinDigit = \unit -> \teenbase -> \tenbase -> \hundred -> + mkNum unit teenbase (tenbase + "cet") hundred twothreefour ; + +oper mk5Num : Str -> Str -> Str -> LinDigit = \unit -> \teenbase -> \tenbase -> + mkNum unit teenbase (tenbase + "desát") (unit ++ "set") fiveup ; + +lin num x = {s = [] ++ x.s ++ [] } ; -- 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 "čtyr^i" "čtr" "čtyr^i" ("čtyr^i" ++ "sta") ; +lin n5 = mk5Num "pe^t" "pat" "pa" ; +lin n6 = mk5Num "šest" "šest" "š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..c5ba6d2e0 --- /dev/null +++ b/examples/numerals/dagur.gf @@ -0,0 +1,62 @@ +concrete dagur of Numerals = { +-- 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 ; + +} diff --git a/examples/numerals/danish.gf b/examples/numerals/danish.gf new file mode 100644 index 000000000..3889081ab --- /dev/null +++ b/examples/numerals/danish.gf @@ -0,0 +1,49 @@ +concrete danish of Numerals = { +-- 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} ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str} ; +lincat Sub100 = {s : Str} ; +lincat Sub1000 = {s : Str} ; +lincat Sub1000000 = {s : Str} ; + +oper mkTal : Str -> Str -> Str -> LinDigit = + \to, tolv, tyve -> + {s = table {ental => to ; ton => tolv ; tiotal => tyve}} ; +oper regTal : Str -> LinDigit = \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..4fa496e68 --- /dev/null +++ b/examples/numerals/decimal.gf @@ -0,0 +1,49 @@ +concrete decimal of Numerals = { +-- include numerals.Abs.gf ; + +-- flags lexer=chars ; unlexer=concat ; + +param Zeros = noz | zz ; + +lincat Numeral = { s : Str } ; +lincat Digit = { s : Str } ; +lincat Sub10 = { s : Str } ; +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..39a133628 --- /dev/null +++ b/examples/numerals/dutch.gf @@ -0,0 +1,53 @@ +concrete dutch of Numerals = { +-- 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} ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \tv -> \tolv -> \tjugo -> + {s = table {unit => tv ; teen => tolv ; ten => tjugo}} ; +oper regGetal : Str -> LinDigit = + \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..f1a589734 --- /dev/null +++ b/examples/numerals/english.gf @@ -0,0 +1,48 @@ +concrete english of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; + +lincat Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str} ; +lincat Sub100 = { s : Str } ; +lincat Sub1000 = { s : Str } ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> Str -> Str -> LinDigit = + \two -> \twelve -> \twenty -> + {s = table {unit => two ; teen => twelve ; ten => twenty}} ; +oper regNum : Str -> LinDigit = + \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..a2be74d2c --- /dev/null +++ b/examples/numerals/finnish.gf @@ -0,0 +1,63 @@ +concrete finnish of Numerals = { +-- include numerals.Abs.gf ; + +param Place = indep | attr ; +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 = "seitsemn"} ; +lin n8 = + {s = "kahdeksan"} ; +lin n9 = + {s = "yhdeksn"} ; +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..b64cb1d35 --- /dev/null +++ b/examples/numerals/french.gf @@ -0,0 +1,63 @@ +concrete french of Numerals = { +-- 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_belgian.gf b/examples/numerals/french_belgian.gf new file mode 100644 index 000000000..13a503308 --- /dev/null +++ b/examples/numerals/french_belgian.gf @@ -0,0 +1,94 @@ +concrete french_belgian of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; +param Nm = sg | pl ; +param Place + = indep -- stands by itself; as "cents" in "deux cents" + | attr ; -- as in "deux cent trois" + +lincat Numeral = {s : Str} ; +lincat Digit = {inh1 : Nm; -- Nm = pl => quarante et un + -- Nm = sg => quatre-vingt-un + -- (governs whether "et" is required between tens and units) + s : DForm => Str} ; +lincat Sub10 = {inh : Nm ; s : {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 = + {inh1 = sg ; s = table {unit => "deux" ; teen => "douze" ; ten => "vingt" }} ; +lin n3 = + {inh1 = sg ; s = table {unit => "trois" ; teen => "treize" ; ten => "trente" }} ; +lin n4 = + {inh1 = sg ; s = table {unit => "quatre" ; teen => "quatorze" ; ten => "quarante" }} ; +lin n5 = + {inh1 = sg ; s = table {unit => "cinq" ; teen => "quinze" ; ten => "cinquante" }} ; +lin n6 = + {inh1 = sg ; s = table {unit => "six" ; teen => "seize" ; ten => "soixante" }} ; +lin n7 = + {inh1 = sg ; s = table {unit => "sept" ; teen => "dix" ++ "-" ++ "sept" ; ten => "septante" }} ; +lin n8 = + {inh1 = pl ; s = table {unit => "huit" ; teen => "dix" ++ "-" ++ "huit" ; ten => "quatre-vingt" }} ; +lin n9 = + {inh1 = sg ; s = table {unit => "neuf" ; teen => "dix" ++ "-" ++ "neuf" ; ten => "nonante" }} ; +lin pot01 = + {inh = sg ; + s = table {{p2 = indep} => "un" ; + {p2 = attr} => [] }}; + +lin pot0 d = + {inh = pl ; + s = table {{p2 = indep} => d.s ! unit ; + {p2 = attr} => d.s ! unit }} ; + +oper pluralMark = table {sg => ""; pl => "s"}; + +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) ++ (pluralMark ! d.inh1); 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 ! {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 ! {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..0aa26d3b2 --- /dev/null +++ b/examples/numerals/french_swiss.gf @@ -0,0 +1,91 @@ +concrete french_swiss of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; +param Nm = sg | pl ; +param Place + = indep -- stands by itself; as "cents" in "deux cents" + | attr ; -- as in "deux cent trois" + +lincat Numeral = {s : Str} ; +lincat Digit = {inh1 : Nm; -- Nm = pl => quarante et un + -- Nm = sg => quatre-vingt-un + -- (governs whether "et" is required between tens and units) + s : DForm => Str} ; +lincat Sub10 = {inh : Nm ; s : {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 = + {inh1 = sg ; s = table {unit => "deux" ; teen => "douze" ; ten => "vingt" }} ; +lin n3 = + {inh1 = sg ; s = table {unit => "trois" ; teen => "treize" ; ten => "trente" }} ; +lin n4 = + {inh1 = sg ; s = table {unit => "quatre" ; teen => "quatorze" ; ten => "quarante" }} ; +lin n5 = + {inh1 = sg ; s = table {unit => "cinq" ; teen => "quinze" ; ten => "cinquante" }} ; +lin n6 = + {inh1 = sg ; s = table {unit => "six" ; teen => "seize" ; ten => "soixante" }} ; +lin n7 = + {inh1 = sg ; s = table {unit => "sept" ; teen => "dix" ++ "-" ++ "sept" ; ten => "septante" }} ; +lin n8 = + {inh1 = pl ; s = table {unit => "huit" ; teen => "dix" ++ "-" ++ "huit" ; ten => "huitante" }} ; +lin n9 = + {inh1 = pl ; s = table {unit => "neuf" ; teen => "dix" ++ "-" ++ "neuf" ; ten => "nonante" }} ; +lin pot01 = + {inh = sg ; + s = table {{p2 = indep} => "un" ; + {p2 = attr} => [] }}; + +lin pot0 d = + {inh = pl ; + s = table {{p2 = indep} => d.s ! unit ; + {p2 = attr} => d.s ! unit }} ; + +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 ! {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 ! {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..ff694a36b --- /dev/null +++ b/examples/numerals/fulfulde.gf @@ -0,0 +1,53 @@ +concrete fulfulde of Numerals = { +-- 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..bcd418731 --- /dev/null +++ b/examples/numerals/geez.gf @@ -0,0 +1,126 @@ +concrete geez of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=ethiopic ; + +-- 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 = [] ++ x0.s ++ []} ; -- The Ethiopic script environment +lin n2 = mkNum "ክልኤቱ" "ዕሽራ" ; +lin n3 = mkNum "ሠላስቱ" "ሠላሳ" ; +lin n4 = mkNum "አርባዕቱ" "አርብዓ" ; +lin n5 = mkNum "ኀምስቱ" "ኀምሳ" ; +lin n6 = mkNum "ስድስቱ" "ስስሳ" ; +lin n7 = mkNum (variants { "ሰብዐቱ" ; "ሰብዓቱ" }) "ሰብዓ" ; +lin n8 = mkNum (variants { "ሰማንቱ" ; "ሰማኒቱ" }) "ሰማንያ" ; +lin n9 = mkNum (variants { "ትስዐቱ" ; "ተስዐቱ" ; "ተሳዕቱ" }) (variants {"ተስዓ" ; "ትስዓ"}) ; + +oper mkNum : Str -> Str -> LinDigit = \tva -> \tjugo -> + {s = table {unit => tva ; ten => tjugo} ; size = less100 } ; + +lin pot01 = + {s = table {unit => "አሐዱ" ; ten => "ዐሸርቱ" } ; size = sg}; +lin pot0 d = d ; +lin pot110 = {s = "ዐሸርቱ" ; + s2 = table {tenp => "ወ" ++ "አሐዱ" ; + tenpalf => "እልፍ" ; + unitp => [] } ; + unitp_ending = zero ; + size = less100} ; +lin pot111 = {s = "ዐሸርቱ" ++ "ወ" ++ "አሐዱ" ; + s2 = table {tenp => "ወ" ++ "አሐዱ" ; + tenpalf => "እልፍ" ; + unitp => "ዐሸርቱ" } ; + unitp_ending = nonzero ; + size = less100} ; +lin pot1to19 d = + {s = "ዐሸርቱ" ++ "ወ" ++ d.s ! unit ; + s2 = table {tenp => "ወ" ++ "አሐዱ" ; + tenpalf => "እልፍ" ; + 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 => "ወ" ++ d.s ! unit ; + tenpalf => d.s ! unit ++ "እልፍ" ; + unitp => [] } ; + unitp_ending = tenzero ; + size = less100} ; +lin pot1plus d e = + {s = d.s ! ten ++ "ወ" ++ e.s ! unit ; + s2 = table {tenp => "ወ" ++ d.s ! unit ; + tenpalf => d.s ! unit ++ "እልፍ" ; + 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 => "ምእት" ; _ => d.s ! unit ++ "ምእት" } ! d.size ; + tenm => "ዱምምይ" ; + alf => d.s ! ten ++ "እልፍ" ; + tailform => d.s ! unit ++ "ምእት" } ; + size = more100 ; + ending = zero} ; +lin pot2plus d e = + {s = table {indep => table {sg => "ምእት" ; _ => d.s ! unit ++ "ምእት" } ! d.size ++ e.s ; + tenm => "ዱምምይ"; + alf => d.s ! ten ++ e.s2 ! tenp ++ "እልፍ" ++ e.s2 ! unitp ; + tailform => d.s ! unit ++ "ምእት" ++ 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 ++ "ምእት"} ! 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 => "ወ" ++ m.s ! tailform } ! n.ending; + _ => table {more100 => mkmit n.ending (n.s ! alf) ; + less100 => n.s ! alf ++ table {nonzero => "ምእት" ; _ => []} ! n.ending ; + _ => n.s ! tenm ++ "ምእት"} ! n.size ++ m.s ! indep} ! m.size } ; + +oper mkmit : Ending -> Str -> Str = \e -> \s -> table {zero => [] ; _ => s ++"ምእት" } ! e; + +} diff --git a/examples/numerals/german.gf b/examples/numerals/german.gf new file mode 100644 index 000000000..95927126f --- /dev/null +++ b/examples/numerals/german.gf @@ -0,0 +1,52 @@ +concrete german of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | teen | ten ; +param Place = indep | prae | attr ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \tv -> \tolv -> \tjugo -> + {s = table {unit => tv ; teen => tolv ; ten => tjugo}} ; +oper regZahl : Str -> LinDigit = + \vier -> mkZahl vier (vier + "zehn") (vier + "zig") ; +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; + +lin n2 = mkZahl "zwei" "zwlf" "zwanzig" ; +lin n3 = mkZahl "drei" "dreizehn" "dreissig" ; +lin n4 = regZahl "vier" ; +lin n5 = regZahl "fnf" ; +lin n6 = mkZahl "sechs" "sechzehn" "sechzig" ; +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..3b34e3529 --- /dev/null +++ b/examples/numerals/greek_classical.gf @@ -0,0 +1,204 @@ +concrete greek_classical of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=greek ; + +-- 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 Numeral = { s : Str } ; +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 + "μύριοι" ; + teen => dwdeka ; + ten => eikosi ; + hund => diakosioi ; + kisxil => dis + "χίλιοι" ; + kismyr => dis + "μύριοι" ; + tenkis => eikosakis ; + tenkismyr => eikosakis + "μύριοι"} }; + +lin n2 = mkNum + "δύο" + "δισ" + "δωδεκακισ" + "δώδεκα" + "εἴκοσι" + "διακόσιοι" + "εἰκοσάκισ" ; + +lin n3 = mkNum + "τρεῖς" + "τρισ" + "τρεισκαιδεκακισ" + (variants {"τρεῖς" ++ "καὶ" ++ "δέκα" ; "τρεισκαίδεκα"} ) + "τριάκοντα" + "τριακόσιοι" + "τριακοντάκισ" ; + +lin n4 = mkNum + "τέτταρες" + "τετρακισ" + "τετταρεσκαιδεκακισ" + (variants {"τέτταρες" ++ "καὶ" ++ "δέκα" ; "τετταρεσκαίδεκα"}) + "τετταράκοντα" + "τετρακόσιοι" + "τετταρακοντάκισ" ; + +lin n5 = mkNum + "πέντε" + "πεντακισ" + "πεντεκαιδεκακισ" + "πεντεκαίδεκα" + "πεντήκοντα" + "πεντακόσιοι" + "πεντηκοντάκισ" ; + +lin n6 = mkNum + "ἕξ" + "ἑξακισ" + "ἑκκαιδεκακισ" + "ἑκκαίδεκα" + "ἑξήκοντα" + "ἑξακόσιοι" + "ἑξηκοντάκισ" ; + +lin n7 = mkNum + "ἑπτά" + "ἑπτακισ" + "ἑπτακαιδεκακισ" + "ἑπτακαίδεκα" + "ἑβδομήκοντα" + "ἑπτακόσιοι" + "ἑβδομηκοντάκισ" ; + +lin n8 = mkNum + "ὀκτώ" + "ὀκτακισ" + "ὀκτωκαιδεκακισ" + "ὀκτωκαίδεκα" + "ὀγδοήκοντα" + "ὀκτακόσιοι" + "ὀγδοηκοντάκισ" ; + +lin n9 = mkNum + "ἐννέα" + "ἐνακισ" + "ἐννεακαιδεκακισ" + "ἐννεακαίδεκα" + "ἐνενήκοντα" + "ἐνακόσιοι" + "ἐνενηκοντάκισ" ; + +lin pot01 = + {s = table {hund => "ἑκατόν" ; + kisxil => "χίλιοι" ; + kismyr => "ἅπαξ" + "μύριοι" ; + _ => "εἵς" } ; + size = sg} ; +lin pot0 d = + {s = d.s ; size = pl} ; +lin pot110 = + {s = table {xiliad => "δψμμυ" ; + (myriad _) => "μύριοι" ; + (indep _) => "δέκα" }; + s1 = table {kis1 => "ἅπαξ" + "μύριοι" ; tkis1 => "ἑνδεκάκισ" + "μύριοι"} ; + s2 = [] ; + size = tenoverpl} ; +lin pot111 = + {s = table {xiliad => "δψμμυ" ; + (myriad des) => "μύριοι" ++ "χίλιοι" ; + (myriad asc) => "χίλιοι" ++ "καὶ" ++ "μύριοι" ; + (indep _) => "ἕνδεκα" } ; + s1 = table {kis1 => "ἅπαξ" + "μύριοι" ; tkis1 => "ἑνδεκάκισ" + "μύριοι"} ; + s2 = "χίλιοι" ; + size = tenoverpl} ; +lin pot1to19 d = + {s = table {xiliad => "δψμμυ" ; + (myriad des) => "μύριοι" ++ d.s ! kisxil ; + (myriad asc) => d.s ! kisxil ++ "καὶ" ++ "μύριοι" ; + (indep _) => d.s ! teen } ; + s1 = table {kis1 => "ἅπαξ" + "μύριοι" ; tkis1 => "ἑνδεκάκισ" + "μύριοι" } ; + s2 = d.s ! kisxil ; + size = tenoverpl} ; +lin pot0as1 n = + {s = table {xiliad => n.s ! kisxil ; + (indep _) => n.s ! unit ; + (myriad _) => "δψμμυ" } ; + s1 = table {_ => []} ; + s2 = n.s ! kisxil ; + size = n.size} ; +lin pot1 d = + {s = table {xiliad => "δψμμυ" ; + (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 => "δψμμυ" ; + (myriad des) => d.s ! kismyr ++ e.s ! kisxil ; + (myriad asc) => e.s ! kisxil ++ "καὶ" ++ d.s ! kismyr ; + (indep des) => d.s ! ten ++ e.s ! unit ; + (indep asc) => e.s ! unit ++ "καὶ" ++ 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 => "δψμμυ"} ; + size = tenoverpl} ; +lin pot2plus d e = + {s = table {(myriad _) => table {sg => e.s1 ! tkis1 ; + pl => d.s ! tenkis ++ e.s1 ! kis1 ; + tenoverpl => "δψμμυ" } ! d.size ++ e.s2 ; + (indep des) => d.s ! hund ++ e.s ! indep des ; + (indep asc) => (e.s ! indep asc) ++ "καὶ" ++ d.s ! hund ; + xiliad => "δψμμυ" } ; + 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 ++ "καὶ" ++ (Myr n asc) ! n.size }} ; + +oper Myr : LinSub1000 -> Order -> Size => Str = \n -> \order -> + table {sg => "χίλιοι" ; + 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..e7f4a9bfa --- /dev/null +++ b/examples/numerals/greek_modern.gf @@ -0,0 +1,76 @@ +concrete greek_modern of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=greek ; + +-- Free variation on accents on m'ia and d'yo + +oper vowel : Strs = strs {"ε" ; "ο" ; "α" ; "έ" ; "ό" ; "ά"} ; + +param DForm = unit | fem | femteen | teen | ten | hundredneut | hundredfem ; +param Use = indep | femattr ; +param Size = sg | pl ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str } ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \dyo -> \dwdeka -> \eikosi -> \diakosi -> \dyofem -> \dwdekafem -> + {s = table {unit => dyo ; teen => dwdeka ; ten => eikosi ; + hundredneut => diakosi + "α" ; hundredfem => diakosi + "ες" ; + fem => dyofem ; femteen => dwdekafem}} ; + +oper mkIndeclNum : Str -> Str -> Str -> Str -> LinDigit = + \dyo -> \dwdeka -> \eikosi -> \diakosi -> + {s = table {unit => dyo ; teen => dwdeka ; ten => eikosi ; + hundredneut => diakosi + "α" ; hundredfem => diakosi + "ες" ; + fem => dyo ; femteen => dwdeka}} ; + +lin n2 = mkIndeclNum "δύο" "δώδεκα" "είκοσι" "διακόσι" ; +lin n3 = mkNum "τρία" "δεκατρία" "τριάντα" "τριακόσι" "τρείς" "δεκατρείσ" ; +lin n4 = mkNum "τέσσερα" "δεκατέσσερα" "σαράντα" "τετρακόσι" "τέσσερις" "δεκατέσσερις" ; +lin n5 = mkIndeclNum "πέντε" "δεκαπέντε" "πενήντα" "πεντακόσι" ; +lin n6 = mkIndeclNum "έξι" (variants { "δεκαέξι" ; "δεκαέξι" }) "εξήντα" "εξακόσι" ; +lin n7 = mkIndeclNum (variants {"επτά" ; "εφτά" }) "δεκαεφτά" "εβδομήντα" "εφτακόσι" ; +lin n8 = mkIndeclNum "οχτώ" "δεκαοχτώ" "ογδόντα" "οχτακόσι" ; +lin n9 = mkIndeclNum (variants {"εννέα" ; "εννία" }) "δεκαεννέα" "ενενήντα" "εννιακόσι" ; +lin pot01 = + {s = table {unit => "ένα" ; fem => "μία" ; _ => "εκατό" + pre {[] ; "ν" / vowel}} ; size = sg} ; +lin pot0 d = + {s = d.s ; size = pl} ; +lin pot110 = + {s = table {indep => "δέκα" ; femattr => "δέκα"} ; size = pl} ; +lin pot111 = + {s = table {indep => "έντεκα" ; femattr => "έντεκα" } ; 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 => "χίλια" ; pl => s ++ "χιλιάδες" } ; + +} diff --git a/examples/numerals/guahibo.gf b/examples/numerals/guahibo.gf new file mode 100644 index 000000000..a345069e4 --- /dev/null +++ b/examples/numerals/guahibo.gf @@ -0,0 +1,50 @@ +concrete guahibo of Numerals = { +-- include numerals.Abs.gf ; + +oper bind : Str -> Str -> Str = \a -> \b -> a ++ b ; + +param Size = sg | pl ; + +oper All = {s : Str ; size : Size}; + +lincat Numeral = { s : Str } ; +lincat Digit = All ; +lincat Sub10 = All ; +lincat Sub100 = All ; +lincat Sub1000 = All ; +lincat Sub1000000 = { s : Str } ; + +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 } ; + +} diff --git a/examples/numerals/guarani.gf b/examples/numerals/guarani.gf new file mode 100644 index 000000000..00e2287a0 --- /dev/null +++ b/examples/numerals/guarani.gf @@ -0,0 +1,53 @@ +concrete guarani of Numerals = { +-- 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 Numeral = { s : Str } ; +lincat Digit = All ; +lincat Sub10 = All ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +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 } ; + +} diff --git a/examples/numerals/hebrew_biblical.gf b/examples/numerals/hebrew_biblical.gf new file mode 100644 index 000000000..2510a21d1 --- /dev/null +++ b/examples/numerals/hebrew_biblical.gf @@ -0,0 +1,93 @@ +concrete hebrew_biblical of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=hebrew ; + +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) => "שנים" ; + cons => "שני" ; + ten => "עשרים" ; + hund => "מאתים"} ; size = dual} ; +lin n3 = + {s = table {(unit _) => "שלשה" ; + cons => "שלשת" ; + ten => "שלשים" ; + hund => "שלש" ++ "מאות"} ; size = small} ; +lin n4 = + {s = table {(unit _) => "ארבעה" ; + cons => "ארבעת" ; + ten => "ארבעים" ; + hund => "ארבע" ++ "מאות"} ; size = small} ; +lin n5 = + {s = table {(unit _) => "חמשה" ; + cons => "חמשת" ; + ten => "חמשים" ; + hund => "חמש" ++ "מאות"} ; size = small} ; +lin n6 = + {s = table {(unit _) => "ששה" ; + cons => "ששת" ; + ten => "ששים" ; + hund => "שש" ++ "מאות"} ; size = small} ; +lin n7 = + {s = table {(unit _) => "שבעה" ; + cons => "שבעת" ; + ten => "שבעים" ; + hund => "שבע" ++ "מאות"} ; size = small} ; +lin n8 = + {s = table {(unit _) => "שמנה" ; + cons => "שמנת" ; + ten => "שמנים" ; + hund => "שמנה" ++ "מאות"} ; size = small} ; +lin n9 = + {s = table {(unit _) => "תשעה" ; + cons => "תשעת" ; + ten => "תשעים" ; + hund => "תשע" ++ "מאות"} ; size = small} ; + +lin pot01 = + {s = table {hund => "מאה"; (unit attr) => [] ; f => "אחד"} ; size = large} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "עשר"} ; size = small} ; +lin pot111 = + {s = table {_ => variants {"אחד" ++ "עשר" ; "עשתי" ++ "עשר"} } ; size = large} ; +lin pot1to19 d = + {s = table {_ => d.s ! unit indep ++ "עשר"} ; 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 ++ "ו" ++ 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 ++ "ו" ++ 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 ++ "ו" ++ m.s ! indep} ; + +oper Alf : Size => Str = + table {{small} => "אלפים" ; {dual} => "אלפים" ; _ => "אלף"} ; + + +} diff --git a/examples/numerals/hindi.gf b/examples/numerals/hindi.gf new file mode 100644 index 000000000..347fe1085 --- /dev/null +++ b/examples/numerals/hindi.gf @@ -0,0 +1,107 @@ +concrete hindi of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=devanagari ; + +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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str ; size : DSize} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000000 = { s : Str } ; + +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 "एक" "ग्यारह" "दस" +lin n2 = mkNum "दो" "बीस" r2 ; +lin n3 = mkNum "तीन" "तीस" r3 ; +lin n4 = mkNum "चार" "चालीस" r4 ; +lin n5 = mkNum "पाँ्न्च" "पचास" r5 ; +lin n6 = mkNum (variants {"छह" ; "छः" ; "छै"}) "साठ" r6 ; +lin n7 = mkNum "सात" "सत्तर" r7; +lin n8 = mkNum "आठ" "अस्सी" r8; +lin n9 = mkNum "नौ" (variants {"नव्वे" ; "नब्बे" }) 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 + "अह" ; + r2 => a2 + "ईस" ; + r3 => a3 + "तीस" ; + r4 => a4 + "आलीस" ; + r5 => a5 + "अन" ; + r6 => a6 + "सठ" ; + r7 => a7 + "हत्तर" ; + r8 => a8 + "आसी" ; + r9 => a9 + "आनवे" +} ; + +oper rows : DSize => DSize => Str = table { + sg => mkR "ग्यार" "इक्क" "इकत" "एक्त" "इक्याव" "इक" "इक" "इक्य" "इक्य" ; + r2 => mkR "बार" "बा" "बत" "बय" "बाव" "बा" "ब" "बय" "ब" ; + r3 => mkR "तेर" "ते" "तैं" "तैंत" "तिर्प" "तिर" "ति" "तिर" "तिर" ; + r4 => mkR "चौद" "चौब" "चौं" "चव" "चौप" "चौं" "चौ" "चौर" "चौर" ; + r5 => mkR "पंद्र" "पच्च" "पैं" "पैंत" "पच्प" "पैं" "पच" "पच" "पच" ; + r6 => mkR "सोल" "छब्ब" "छत" "छिय" "छप्प" "छिया" "छि" "छिय" "छिय" ; + r7 => mkR (variants { "सत्त्र" ; "सत्र"}) "सत्ताव" "सैं" "सैंत" "सत्ता" "सर" "सत" (variants {"सत्त" ; "सत" }) "सत्त" ; + r8 => mkR "अठार" "अट्ठा" "अR" "अR्त" "अट्ठाव" "अR" "अठ" (variants { "अट्ठ" ; "अठ" }) "अट्ठ" ; + r9 => table {sg => "उन्नीस" ; r2 => "उनतीस" ; r3 => "उनतालीस" ; + r4 => "उनचास" ; r5 => "उनसठ" ; r6 => "उनहत्तर" ; + r7 => (variants{"उन्नासी" ; "उन्यासी"}) ; + r8 => "नवासी" ; r9 => "निन्यानवे" } +} ; + +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin pot01 = {s = table {unit => "एक" ; _ => "दुम्म्य" } ; size = sg} ; +lin pot0 d = d ; +lin pot110 = {s = "दस" ; 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 = "दुम्म्य" ; size = n.size } ; +lin pot2 d = {s = (mksau (d.s ! unit) d.size) ; + s2 = d.s ! unit ++ "लाख" ; size = more100} ; +lin pot2plus d e = + {s = (mksau (d.s ! unit) d.size) ++ e.s ; + s2 = (d.s ! unit) ++ "लाख" ++ (mkhazar e.s e.size) ; + size = more100} ; + +lin pot2as3 n = {s = n.s } ; +lin pot3 n = {s = table { sing => ekhazar ; + less100 => n.s ++ "हज़ार" ; + more100 => n.s2 } ! n.size} ; +lin pot3plus n m = + {s = table {sing => ekhazar ; + less100 => n.s ++ "हज़ार" ; + more100 => n.s2 } ! n.size ++ m.s} ; + + +oper ekhazar : Str = variants {"हज़ार" ; "एक" ++ "हज़ार"} ; +oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {sing => ekhazar ; _ => s ++ "हज़ार"} ! sz ; +oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "सौ" ; _ => s ++ "सौ"} ! sz ; + +} diff --git a/examples/numerals/hungarian.gf b/examples/numerals/hungarian.gf new file mode 100644 index 000000000..db00bc50e --- /dev/null +++ b/examples/numerals/hungarian.gf @@ -0,0 +1,64 @@ +concrete hungarian of Numerals = { +-- 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" ; + => "hsz" ; + => "kt" ; + => "huszon"}} ; +lin n3 = + {s = table { => "hrom" ; => "harminc"}} ; +lin n4 = + {s = table { => "ngy" ; => "negyven"}} ; +lin n5 = + {s = table { => "t" ; => "tven"}} ; +lin n6 = + {s = table { => "hat" ; => "hatvan"}} ; +lin n7 = + {s = table { => "ht" ; => "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 => "tz"}} ; +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 ! ) ++ "szz"}} ; +lin pot2plus d e = + {s = table {p => (d.s ! ) ++ "szz" ++ 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..54ce2b76c --- /dev/null +++ b/examples/numerals/icelandic.gf @@ -0,0 +1,56 @@ +concrete icelandic of Numerals = { +-- 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 Numeral = { s : 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} ; +lincat Sub1000000 = { s : Str } ; + +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 + "tn") (fimm + "tu") fimm; + +oper ss : Str -> {s : Gen => Str ; size : Size} = \s -> {s = table {_ => s } ; size = pl}; + +lin num x = x ; +lin n2 = mkNum "tveir" "tlf" "tuttugu" "tv" ; +lin n3 = mkNum "rr" "rttn" "rjtu" "rj" ; +lin n4 = mkNum "fjrir" "fjrtn" "fjrutu" "fjgur"; +lin n5 = regNum "fimm" ; +lin n6 = regNum "sex" ; +lin n7 = mkNum "sj" "sautjn" "sjtu" "sj" ; +lin n8 = mkNum "tta" "tjn" "ttu" "tta" ; +lin n9 = mkNum "nu" "ntjn" "nutu" "nu" ; + +lin pot01 = {s = table {f => "einn"} ; size = sg } ; +lin pot0 d = {s = d.s ; size = less10 } ; +lin pot110 = ss "tu" ; +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 ; + +} diff --git a/examples/numerals/interlingua.gf b/examples/numerals/interlingua.gf new file mode 100644 index 000000000..1eb69328d --- /dev/null +++ b/examples/numerals/interlingua.gf @@ -0,0 +1,61 @@ +concrete interlingua of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | ten ; + +lincat Numeral = { s : Str } ; +oper LinDigit = { s : DForm => Str } ; +lincat Digit = LinDigit ; + +lincat Sub10 = { s : DForm => Str } ; +lincat Sub100 = { s : Str } ; +lincat Sub1000 = { s : Str } ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> Str -> LinDigit = + \duo-> \vinti-> + {s = table {unit => duo ; ten => vinti}} ; + +oper regNum : Str -> LinDigit = + \cinque -> + case cinque of { + nov + "em"=> mkNum cinque (nov + "anta"); + cinqu + "e" => mkNum cinque (cinqu + "anta"); + cinqu + "o" => mkNum cinque (cinqu + "anta"); + sex => mkNum sex (sex + "anta") + }; + +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin num x = x ; +lin n2 = mkNum "duo" "vinti"; +lin n3 = mkNum "tres" "trenta"; +lin n4 = mkNum "quatro" "quaranta"; +lin n5 = regNum "cinque"; +lin n6 = regNum "sex" ; +lin n7 = regNum "septe" ; +lin n8 = regNum "octo" ; +lin n9 = regNum "novem" ; + +lin pot01 = {s = table {f => "un"}} ; +lin pot0 d = {s = table {f => d.s ! f}} ; +lin pot110 = ss "dece" ; +lin pot111 = ss ("dece" ++ "-" ++ "un"); +lin pot1to19 d = {s = "dece" ++ "-" ++ d.s ! unit} ; +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 ++ "cento"} ; +lin pot2plus d e = {s = d.s ! unit ++ "cento" ++ e.s} ; + +lin pot2as3 n = n ; + +lin pot3 n = {s = n.s ++ "mille"} ; +lin pot3plus n m = {s = n.s ++ "mille" ++ m.s} ; + + +} diff --git a/examples/numerals/irish.gf b/examples/numerals/irish.gf new file mode 100644 index 000000000..adcff1c95 --- /dev/null +++ b/examples/numerals/irish.gf @@ -0,0 +1,82 @@ +concrete irish of Numerals = { +-- include numerals.Abs.gf ; + +-- Not the archaic base-10 system fiche, triocha, daichead, caoga, seasca, seacht, ocht, ncha +-- scr 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 ++ "dag" ; attrib => tri} ; even20 = ten ; size = thesize} ; + +oper mkEven20 : Str -> Str -> Size -> LinDigit = + \se -> \trifichid -> \thesize -> + { s = table {unit => se ; twenty => trifichid ; teen => se ++ "dag" ; 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" ++ "dhag" } ; even20 = even ; size = onetosix } ; +lin n3 = mk20Ten "tr" "fiche" onetosix ; +lin n4 = + {s = table {unit => "ceathair" ; twenty => "dh" ++ "fhichead" ; teen => "d" ++ "dhag" ; attrib => "ceithre" } ; even20 = even ; size = onetosix} ; +lin n5 = mk20Ten "cig" ("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" ++ "dag" ; indep => "a" ++ "haon" ++ "dag"} ; 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 => "dag" ; _ => []} ! (d.even20) ; + indep => (d.s ! twenty) ++ "a" ++ e.s ! unit ++ + table {ten => "dag" ; _ => []} ! (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 => "gcad" ; _ => "cad" } ; +oper LeniteMile : Size => Str = table {onetosix => "mhle" ; _ => "mle" } ; + + +} diff --git a/examples/numerals/italian.gf b/examples/numerals/italian.gf new file mode 100644 index 000000000..77db6a9b3 --- /dev/null +++ b/examples/numerals/italian.gf @@ -0,0 +1,51 @@ +concrete italian of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = ental Pred | ton | tiotal ; +param Num = sg | pl ; +param Pred = pred | indip ; + +lincat Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \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..972a03439 --- /dev/null +++ b/examples/numerals/japanese.gf @@ -0,0 +1,64 @@ +concrete japanese of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=japanese ; + +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 = [] ++ x0.s ++ []} ; + +oper mkNum : Str -> LinDigit = \base -> + {s = table {unit => base ; attr => base ; ten => base + "ぢゅう" ; hundred => base + "ひゃく" ; thousand => base + "せん" } ; size = pl} ; + +oper mkNum4 : Str -> Str -> Str -> Str -> LinDigit = \ni -> \base -> \nihyaku -> \nisen -> + {s = table {unit => ni ; attr => base ; ten => base + "ぢゅう" ; hundred => nihyaku ; thousand => nisen } ; size = pl} ; + +oper mkNum2 : Str -> Str -> LinDigit = \yon -> \base -> + {s = table {unit => yon ; attr => base ; ten => base + "ぢゅう" ; hundred => base + "ひゃく" ; thousand => base + "せん" } ; size = pl} ; + +-- lin n1 = mkNum "いち" ; +lin n2 = mkNum "に" ; +lin n3 = mkNum4 "さん" "さん" "さんびゃく" "さんぜん" ; +lin n4 = mkNum2 (variants { "し" ; "よん" }) "よん" ; +lin n5 = mkNum "ご" ; +lin n6 = mkNum4 "ろく" "ろく" "ろっぴゃく" "ろくせん" ; +lin n7 = mkNum2 (variants {"なな" ; "しち" }) "なな" ; +lin n8 = mkNum4 "はち" "はち" "はっぴゃく" "はっせん" ; +lin n9 = mkNum2 (variants {"きゅう" ; "く" }) "きゅう" ; + +lin pot01 = + {s = table {unit => "いち" ; attr => [] ; ten => "ぢゅう" ; hundred => "ひゃく" ; thousand => "せん"} ; size = sg }; +lin pot0 d = d ; +lin pot110 = {s = "ぢゅう" ; s2 = table {tenp => "いち" + "まん" ; senp => []} ; size = more10} ; +lin pot111 = {s = "ぢゅう" + "いち" ; s2 = table {tenp => "いち" + "まん" ; senp => "せん"} ; size = more10} ; +lin pot1to19 d = {s = "ぢゅう" ++ d.s ! unit ; s2 = table {tenp => "いち" + "まん" ; 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 ++ "まん" ; senp => []} ; size = more10} ; +lin pot1plus d e = + {s = d.s ! ten ++ e.s ! unit ; + s2 = table {tenp => d.s ! unit ++ "まん" ; 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 ++ "まん" ; sen => "uっmy"} ; 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 => "uっmy" } ; 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..ade6a75ed --- /dev/null +++ b/examples/numerals/kabardian.gf @@ -0,0 +1,85 @@ +concrete kabardian of Numerals = { +-- 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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinS100 ; +lincat Sub1000 = LinS100 ; +lincat Sub1000000 = { s : Str } ; + +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..e2173143a --- /dev/null +++ b/examples/numerals/kambera.gf @@ -0,0 +1,52 @@ +concrete kambera of Numerals = { +-- include numerals.Abs.gf ; + +param Size = sg | two | 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 } ; + +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..200eaca2a --- /dev/null +++ b/examples/numerals/kawaiisu.gf @@ -0,0 +1,44 @@ +concrete kawaiisu of Numerals = { +-- 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..b2c73b006 --- /dev/null +++ b/examples/numerals/khmer.gf @@ -0,0 +1,57 @@ +concrete khmer of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=extradiacritics ; + +param DForm = unit | ten ; +param Size = sg | pl ; + +oper LinDigit = {s : DForm => Str ; size : Size} ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> Str -> LinDigit = \u -> \t -> {s = table {unit => u ; ten => t} ; size = pl} ; + +lin n2 = mkNum "bīra" "mbhai" ; +lin n3 = mkNum "pī" ("sāma" ++ "sipa") ; +lin n4 = mkNum "pwna" ("sē" ++ "sipa") ; +lin n5 = mkNum "prāṃ" ("hā" ++ "sipa") ; +lin n6 = mkNum ("prāṃ" ++ "mwya") ("huka" ++ "sipa") ; +lin n7 = mkNum ("prāṃ" ++ "bīra") ("cita" ++ "sipa") ; +lin n8 = mkNum ("prāṃ" ++ "pī") ("pēta" ++ "sipa") ; +lin n9 = mkNum ("prāṃ" ++ "pwna") ("kau" ++ "sipa") ; + +oper bana : Str = variants {"mwya" ++ "bā'na" ; "mpā'na"} ; + +lin num x = {s = [] ++ x.s ++ []} ; -- for the diacritics + +lin pot01 = {s = table { _ => "mwya" } ; size = sg } ; +lin pot0 d = d ; +lin pot110 = {s = "ṭa'pa" ; s2 = "hmɨna" ; size = pl} ; +lin pot111 = {s = "mwya" ++ "ṭaṇta'pa" ; s2 = "hmɨna" ++ bana; size = pl} ; +lin pot1to19 d = {s = (d.s ! unit) ++ "ṭaṇta'pa" ; s2 = "hmɨna" ++ (d.s ! unit) ++ "bā'na" ; size = pl } ; +lin pot0as1 n = {s = n.s ! unit ; s2 = xsg n.size bana (n.s ! unit ++ "bā'na") ; size = n.size} ; +lin pot1 d = {s = d.s ! ten ; s2 = d.s ! unit ++ "hmɨna" ; size = pl} ; +lin pot1plus d e = {s = d.s ! ten ++ e.s ! unit ; s2 = d.s ! unit ++ "hmɨna" ++ xsg e.size bana (e.s ! unit ++ "bā'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) ++ "sēna" ; + size = pl } ; +lin pot2plus d e = {s = xsg d.size (variants {"raya" ; "mraya"}) (d.s ! unit ++ "raya") ++ e.s ; + s2 = (d.s ! unit) ++ "sē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..7c2d7c0f8 --- /dev/null +++ b/examples/numerals/khowar.gf @@ -0,0 +1,62 @@ +concrete khowar of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +-- 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 = [] ++ x0.s ++ []} ; -- Latin A Supplement + +oper mkNum : Str -> Str -> Par20 -> LinDigit = \s -> \tw -> \p20 -> + {s = table {unit => s ; teen => "jọsh" + "-" + s ; ten _ => tw ++ "bîsher"} ; size = pl ; par20 = p20} ; + +-- lin n1 = mkNum variants {"î" ; "îwáloo"} ; +lin n2 = + {s = table {unit => "joo" ; teen => "jọsh" + "-" + "joo" ; ten attr => "bîsher" ; ten preceded => "î" ++ "bîsher" } ; size = pl ; par20 = even }; +lin n3 = + {s = table {unit => "troi" ; teen => "jọsh" + "-" + "troi" ; ten attr => "bîsher" ; ten preceded => "î" ++ "bîsher" } ; size = pl ; par20 = odd }; +lin n4 = mkNum "chọr" "joo" even ; +lin n5 = mkNum "pọnj" "joo" odd ; +lin n6 = mkNum "chöi" "troi" even ; +lin n7 = mkNum "sọt" "troi" odd ; +lin n8 = mkNum "ọ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 {_ => "jọsh" } ; size = pl} ; +lin pot111 = {s = table {_ => "jọ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 ++ "jọ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 => "shọr" ; _ => d.s ! unit ++ "shọ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 => "shọr" ; _ => d.s ! unit ++ "shọ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/kolyma_yukaghir.gf b/examples/numerals/kolyma_yukaghir.gf new file mode 100644 index 000000000..3b7d1750b --- /dev/null +++ b/examples/numerals/kolyma_yukaghir.gf @@ -0,0 +1,50 @@ +concrete kolyma_yukaghir of Numerals = { +-- include numerals.Abs.gf ; + +oper na = {s = "N/A" }; + +param DForm = u | teen ; + +oper LinDigit = {s : DForm => Str } ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str } ; +lincat Sub1000 = {s : Str } ; +lincat Sub1000000 = { 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..2e155ac94 --- /dev/null +++ b/examples/numerals/korean.gf @@ -0,0 +1,116 @@ +concrete korean of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +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} ; + +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 num x0 = + {s = [] ++ x0.s ++ [] } ; -- just makes colons into length bar ontop of char + +-- lin n1 = mkNum variants{"hana" ; "han"} ; variants {"yelhana" ;"yelhan"} + +lin n2 = mkNumq (variants {"twūl" ; "twu" }) + (variants {"yelqtwul" ; "yelqtwu" }) + (variants {"sumul" ; "sumu" }) + "ī" ; +lin n3 = mkNum (variants {"sēys" ; "sēy" ; "sēk" ; "sē" }) + (variants {"yelqseys" ; "yelqsey" ; "yelqsek" ; "yelqse" }) + (variants {"seun" ; "sehun" }) + "sam" ; +lin n4 = mkNum (variants {"nēys" ; "nēy" ; "nēk" ; "nē" }) + (variants {"yelneys" ; "yelney" ; "yelnek" ; "yelne" }) + "mahun" "sā" ; +lin n5 = mkNum "tases" "yelqtases" "swīn" "ō"; +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 {"mā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..e0542831c --- /dev/null +++ b/examples/numerals/kulung.gf @@ -0,0 +1,62 @@ +concrete kulung of Numerals = { +-- 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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Scale => Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> Str -> Str -> Str -> LinDigit = + \two -> \two2 -> \twenty -> \twenty2 -> + {s = table {basic => two ; belowtenform => two2 ; tenindep => twenty ; ten => twenty2}} ; + +oper mkRegNum : Str -> LinDigit = + \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 ; + +} diff --git a/examples/numerals/kwami.gf b/examples/numerals/kwami.gf new file mode 100644 index 000000000..1200e2063 --- /dev/null +++ b/examples/numerals/kwami.gf @@ -0,0 +1,55 @@ +concrete kwami of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +-- D^ is from implosive d IPA symbol +-- N Num + +param Size = sg | two | three | other ; + +oper LinDigit = {s : Str ; size : Size} ; + +lincat Numeral = {s : Str} ; +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 = [] ++ x0.s ++ []} ; -- 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} ; + +} diff --git a/examples/numerals/kwaza.gf b/examples/numerals/kwaza.gf new file mode 100644 index 000000000..adf14e312 --- /dev/null +++ b/examples/numerals/kwaza.gf @@ -0,0 +1,40 @@ +concrete kwaza of Numerals = { +-- 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..697b28aa4 --- /dev/null +++ b/examples/numerals/lalo.gf @@ -0,0 +1,45 @@ +concrete lalo of Numerals = { +-- 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 ; +lincat Sub1000000 = { s : Str } ; + +-- 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 = "khq" } ; +lin n7 = {s = "x`&" } ; +lin n8 = {s = "hq" } ; +lin n9 = {s = "kw" } ; +lin pot01 = {s = "tjh`&"} ; +lin pot0 d = d ; +lin pot110 = ss "tjh" ; +lin pot111 = ss "tjht" ; +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..26c88440b --- /dev/null +++ b/examples/numerals/lamani.gf @@ -0,0 +1,100 @@ +concrete lamani of Numerals = { +-- 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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = {s : Str ; s2 : Str } ; +lincat Sub1000000 = { s : 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..0d2f70f92 --- /dev/null +++ b/examples/numerals/latvian.gf @@ -0,0 +1,56 @@ +concrete latvian of Numerals = { +flags coding = utf8 ; +-- c^ +-- s^ +-- n, is n with a comma under +-- u^ with line over + +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +param DForm = unit | teen | ten | hundred ; + +oper LinDigit = {s : DForm => Str ; s2 : Str }; +oper LinSub100 = {s : Str ; s2 : Str } ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; +lincat Sub1000000 = { s : Str } ; + +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^kstoš" }; + +lin num x = {s = [] ++ x.s ++ []} ; -- Latin A Supplement diacritics ; + +lin n2 = mkNum "divi" "div" ; +lin n3 = mkNum "trīs" "trīs" ; +lin n4 = mkNum "četri" "četr" ; +lin n5 = mkNum "pieci" "piec" ; +lin n6 = mkNum "seši" "seš" ; +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^kstoš" } ; + +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..d0ac03811 --- /dev/null +++ b/examples/numerals/lithuanian.gf @@ -0,0 +1,61 @@ +concrete lithuanian of Numerals = { +-- 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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinSub100 ; +lincat Sub1000 = LinSub100 ; +lincat Sub1000000 = { s : Str } ; + +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" "dvlika" "dv" ; +lin n3 = mkNum "try:s" "trlika" "trs" ; +lin n4 = mkNum "ketur" "keturilika" "ke:turias" ; +lin n5 = mkNum "penk" "penkilika" "pen~kias" ; +lin n6 = mkNum "s^es^" "s^es^ilika" "s^e:s^ias" ; +lin n7 = mkNum "septyn" "septynilika" "septnias" ; +lin n8 = mkNum "as^tuon" "as^tuonilika" "as^tonias" ; +lin n9 = mkNum "devyn" "devynilika" "devnias" ; + +oper mkR : Str -> LinSub100 = \n -> {s = n ; size = pl } ; + +lin pot01 = { s = table {_ => "venas" } ; size = sg }; +lin pot0 d = d ; +lin pot110 = mkR (variants {"de:s^imt"; "des^imts" }); +lin pot111 = mkR "vienolika" ; +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..bd96817e7 --- /dev/null +++ b/examples/numerals/lotuxo.gf @@ -0,0 +1,64 @@ +concrete lotuxo of Numerals = { +-- 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..b23d0fec3 --- /dev/null +++ b/examples/numerals/maale.gf @@ -0,0 +1,58 @@ +concrete maale of Numerals = { +-- 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 + "-tmmi" }; size = pl }; + +-- b> is b with right bend +-- ? without dot +-- $ IPA [sh] + +-- lin n1 = mkNum "ptte" ; +lin n2 = mkNum "lam?" "lam"; +lin n3 = mkNum "haits" "hayts" ; +lin n4 = mkNum "?oid" "?oyd"; +lin n5 = mkNum "dngo" "dngi"; +lin n6 = mkNum "lhh" "lhhi"; +lin n7 = mkNum "lnkayi" "lnkayi"; +lin n8 = mkNum "slli" "slli" ; +lin n9 = mkNum "tsub>a" "tzub>i"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; + +lin pot01 = + {s = table {f => "ptte" }; size = sg }; +lin pot0 d = d ; +lin pot110 = ss "tb>b>" ; +lin pot111 = ss ("tb>b>" ++ "ptte") ; +lin pot1to19 d = ss ("tb>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..1044fc87d --- /dev/null +++ b/examples/numerals/malay.gf @@ -0,0 +1,74 @@ +concrete malay of Numerals = { +-- 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..481d9b870 --- /dev/null +++ b/examples/numerals/maltese.gf @@ -0,0 +1,62 @@ +concrete maltese of Numerals = { +-- 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..9334301ab --- /dev/null +++ b/examples/numerals/mapuche.gf @@ -0,0 +1,48 @@ +concrete mapuche of Numerals = { +-- include numerals.Abs.gf ; + +param Size = sg | pl ; + +oper All = {s : Str ; size : Size}; + +lincat Numeral = { s : Str } ; +lincat Digit = All ; +lincat Sub10 = All ; +lincat Sub100 = All ; +lincat Sub1000 = All ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> All = \tri -> + { s = tri ; size = pl}; + +lin num x = {s = x.s } ; + +lin n2 = mkNum "epu" ; +lin n3 = mkNum "kl" ; +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 = "kie" ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss "mari" ; +lin pot111 = ss ("mari" ++ "kie") ; +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 } ; + +} diff --git a/examples/numerals/margi.gf b/examples/numerals/margi.gf new file mode 100644 index 000000000..1378d2475 --- /dev/null +++ b/examples/numerals/margi.gf @@ -0,0 +1,56 @@ +concrete margi of Numerals = { +-- 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 Numeral = { s : Str } ; +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 + "km" ; oxy => o} ; size = pl} ; + +oper mkNum2 : Str -> Str -> LinDigit = \u -> \t -> + {s = table {unit => u ; ten => t + "km" ; oxy => u} ; size = pl} ; + +lin num x0 = {s = x0.s } ; -- TODO + +lin n2 = mkNum "s`&d>N" "m'&tl*" "m'&tl" ; +lin n3 = mkNum2 "mk`&r" "mr" ; +lin n4 = mkNum (variants {"fd>*" ; "fwd>*"}) "fd>*" (variants {"fd>" ;"fd>"}) ; +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 {"ntss*" ; "ncs*"}) "ntss*" "ntss" ; +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 => "tN" ; oxy => "ptl*" ; ten => "dummy" } ; size = sg}; +lin pot0 d = d ; +lin pot110 = ss (variants { "km*" ; "km*" }); +lin pot111 = ss ("km" ++ "g" ++ (variants {"s'&r" ; "s'&rny"}) ++ "tN") ; +lin pot1to19 d = ss ("km" ++ "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 "ghr" (d.s ! unit)) ! d.size) ; +lin pot2plus d e = ss ((selsg "ghr" (d.s ! unit) ! d.size) ++ "ag" ++ e.s2); +lin pot2as3 n = {s = n.s} ; +lin pot3 n = {s = selsg "db" n.s ! n.size }; +lin pot3plus n m = {s = ((selsg "db" n.s) ! n.size) ++ m.s2 }; + +} diff --git a/examples/numerals/maybrat.gf b/examples/numerals/maybrat.gf new file mode 100644 index 000000000..f8a8da91b --- /dev/null +++ b/examples/numerals/maybrat.gf @@ -0,0 +1,74 @@ +concrete maybrat of Numerals = { +-- 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..0919dc3dc --- /dev/null +++ b/examples/numerals/miya.gf @@ -0,0 +1,56 @@ +concrete miya of Numerals = { +-- 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 "wt`&" ; +lin n2 = mkNum "ts`&r" "ts'&r"; +lin n3 = mkNum "kdi" "kd" ; +lin n4 = mkNum "f`&d>&" "f'&d>&"; +lin n5 = mkNum "vatl&" "vaatl&"; +lin n6 = mkNum "maha" "mah"; +lin n7 = mkNum "mats&r" "mats`&r"; +lin n8 = mkNum "f&rf&d>&" "f`&rf&d>&" ; +lin n9 = mkNum "kciya" "kcya"; + +oper ss : Str -> Form = \s1 -> {s = s1 ; size = pl} ; +oper behan = "bh&n" ; +oper enaa = "'`&na" ; + +lin pot01 = + {s = table {unit => "wt`&" ; 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 ("db>i" ++ d.s ! unit) ; +lin pot1plus d e = ss ("db>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/mongolian.gf b/examples/numerals/mongolian.gf new file mode 100644 index 000000000..9f0751b52 --- /dev/null +++ b/examples/numerals/mongolian.gf @@ -0,0 +1,64 @@ +concrete mongolian of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +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 "qoyar" "qorin" ; +lin n3 = mkNum "Gurban" "gučin" ; +lin n4 = mkNum "dörbän" "döčin" ; +lin n5 = mkNum "tabun" "tabin" ; +lin n6 = mkNum "ĵirGu'an" "ĵirin" ; +lin n7 = mkNum "dolo'an" "dalan" ; +lin n8 = mkNum "naiman" "nayan" ; +lin n9 = mkNum "yisün" "ĵ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)) ++ "ĵa'un" ; + s2 = sel d.size "arban" (d.s ! ten) ; size = tenplus} ; +lin pot2plus d e = {s = (sel d.size [] (d.s ! unit)) ++ "ĵ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 ; + +} diff --git a/examples/numerals/nenets.gf b/examples/numerals/nenets.gf new file mode 100644 index 000000000..1f3ab1fb1 --- /dev/null +++ b/examples/numerals/nenets.gf @@ -0,0 +1,70 @@ +concrete nenets of Numerals = { +-- 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" ; "nr"}) "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 {"hsawaju'" ; "habeiju'"} ; + teen => "hsawajujaNan-|~" } ; + 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'" ; "lcaju'" ; "lsaju'" }) ; +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" ; "jnar" ; "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 => "hsawajur" ; _ => attr ++ "ju'" } ! sz ; + +} diff --git a/examples/numerals/norwegian_book.gf b/examples/numerals/norwegian_book.gf new file mode 100644 index 000000000..93e1e2316 --- /dev/null +++ b/examples/numerals/norwegian_book.gf @@ -0,0 +1,50 @@ +concrete norwegian_book of Numerals = { +-- 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} ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str} ; +lincat Sub100 = {s : Str} ; +lincat Sub1000 = {s : Str} ; +lincat Sub1000000 = {s : Str} ; + +oper mkTal : Str -> Str -> Str -> LinDigit = + \tv -> \tolv -> \tjugo -> + {s = table {ental => tv ; ton => tolv ; tiotal => tjugo}} ; +oper regTal : Str -> LinDigit = \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" "frti" ; +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 => "ett"}} ; +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 (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" ++ m.s) ; + + +} diff --git a/examples/numerals/old_church_slavonic.gf b/examples/numerals/old_church_slavonic.gf new file mode 100644 index 000000000..772907340 --- /dev/null +++ b/examples/numerals/old_church_slavonic.gf @@ -0,0 +1,65 @@ +concrete old_church_slavonic of Numerals = { +flags coding = utf8 ; +-- 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 ; +-- flags coding=OCScyrillic ; + +param Size = sg | dual | threefour | fiveup ; + +lincat Numeral = { s : Str } ; +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 } ; +lincat Sub1000000 = { s : Str } ; + +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 = [] ++ x.s ++ []} ; -- the Old Church Slavonic Cyrillic script ; + +lin n2 = {s = "дъва" ; s2 = [] ; size = dual }; +lin n3 = mkNum (variants {"триѥ" ; "трьѥ" }) threefour ; +lin n4 = mkNum "четыре" threefour ; +lin n5 = mkNum5 "пѧть" ; +lin n6 = mkNum5 "шесть" ; +lin n7 = mkNum5 "седмь" ; +lin n8 = mkNum5 "осмь" ; +lin n9 = mkNum5 "девѧть" ; + +lin pot01 = { s = "ѥдинъ" ; s2 = [] ; size = sg }; +lin pot0 d = d ; +lin pot110 = mkNum5 "десѧть" ; +lin pot111 = mkNum5 ("ѥдинъ" ++ "на" ++ "десѧте") ; +lin pot1to19 d = mkNum5 (d.s ++ "на" ++ "десѧте") ; +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 {"и" ; "ти"} ++ e.s ; s2 =mkTen d.size d.s ++ variants {"и" ; "ти"} ++ 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 {"тысѭшти" ; "тысѩшти"}) ; dual => ("дъвѣ" ++ "тысѭшти") ; threefour => "тысѭштѧ" ; fiveup => "тысѭшть" } ! sz ; + +oper mkHund : Size -> Str -> Str = \sz -> \s -> + table {sg => "съто" ; dual => "дъвѣ" ++ "сътѣ" ; threefour => s ++ "съта" ; fiveup => s ++ "сътъ" } ! sz ; + +oper mkTen : Size -> Str -> Str = \sz -> \s -> + table {sg => "десѧть" ; dual => s ++ "десѧти" ; threefour => s ++ "десѧте" ; fiveup => s ++ "десѧтъ" } ! 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..94e9240b6 --- /dev/null +++ b/examples/numerals/oromo.gf @@ -0,0 +1,55 @@ +concrete oromo of Numerals = { +-- 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..787ea9c30 --- /dev/null +++ b/examples/numerals/pashto.gf @@ -0,0 +1,97 @@ +concrete pashto of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=extendedarabic ; + +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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; +lincat Sub1000000 = { s : Str } ; + +lin num x0 = + {s = [] ++ x0.s ++ []} ; -- the Extented-Arabic environment + +oper mkNum : Str -> Str -> Str -> LinDigit = + \dwA -> \cl -> \dwwls -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; spctwo => dwA ; twenties => dwA + "وىشت"} ; size = less100 } ; + +oper mkIrrNum : Str -> Str -> Str -> Str -> Str -> LinDigit = + \dwA -> \cl -> \dwwls -> \dw -> \dr -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; spctwo => dw ; twenties +=> dr + "وىشت"} ; size = less100 } ; + +-- lin n1 mkNum "يو" "لس" ... ; +lin n2 = {s = table {unit => "دوه" ; ten => "شل" ; teen => "دوولس" ; + spctwo => "دو" ; twenties => "دوه" + "وىشت" } ; + size = two }; +lin n3 = mkIrrNum "دري" "دۍرش" "ديارلس" "دري" "در" ; +lin n4 = mkIrrNum "څلور" "څلوۍښت" "څورلس" "څلور" "څلۍر"; +lin n5 = mkNum "پنځه" "پنځوس" (variants { "پنځهلس"; "پنځلس"}) ; +lin n6 = mkNum "شپږ" "شپۍته" "سپاړلس" ; +lin n7 = mkNum "اوه" "اويا" (variants {"اوهلس"; "اولس"}) ; +lin n8 = mkNum "اته" "اتيا" (variants {"اتهلس"; "اتلس"}) ; +lin n9 = mkNum "نه" "نوي" (variants {"نولس"; "نونس"}) ; + +oper ss : Str -> {s : Str} = \s -> {s = s} ; + +lin pot01 = {s = table {unit => "يو" ; + spctwo => "يو" ; + twenties => "يو" + "وىشت" ; + _ => "دuممي" } ; size = sg} ; +lin pot0 d = {s = table {f => d.s ! f} ; size = less100} ; +lin pot110 = {s = "لس" ; size = less100} ; +lin pot111 = {s = "يوولس" ; 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 = "دuممي" ; 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 ++ "او" ++ 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 => "زر" ; + two => n.s ++ "زره" ; + less100 => n.s ++ "زره" ; + more100 => n.s2 } ! n.size} ; +lin pot3plus n m = + {s = table { sg => variants {"زر" ; "يو" ++ "زر"} ; + two => n.s ++ "زره" ; + less100 => n.s ++ "زره" ; + more100 => n.s2 } ! n.size ++ maybeaw ! m.size ++ m.s} ; + + +oper mklk : Str -> Size => Str = \s -> table {sg => "لك" ; _ => s ++ "لك"} ; +oper maybeaw : Size => Str = table {more100 => [] ; _ => "او"} ; +oper mkswA : Str -> Size => Str = \s -> table {sg => "سل" ; _ => s ++ "سوه"} ; +oper mkvarswA : Str -> Size => Str = + \s -> table {sg => (variants {"سل" ; "يو" ++ "سل"}) ; _ => s ++ "سوه"} ; +oper mkzrA : Size => Str = table {sg => "زر" ; _ => "زره"} ; + + +} diff --git a/examples/numerals/polish.gf b/examples/numerals/polish.gf new file mode 100644 index 000000000..2d461c019 --- /dev/null +++ b/examples/numerals/polish.gf @@ -0,0 +1,100 @@ +concrete polish of Numerals = { +-- 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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = {s : DForm => Str; o : ThForm ; t : ThForm } ; +lincat Sub100 = {s : Str; t : ThForm } ; +lincat Sub1000 = {s : Str; t : ThForm } ; +lincat Sub1000000 = { s : Str } ; + +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..49f11632e --- /dev/null +++ b/examples/numerals/portuguese.gf @@ -0,0 +1,63 @@ +concrete portuguese of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | teen | ten | hundred ; +param Size = sg | less10 | pl ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size } ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \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 "trs" "treze" "trinta" "trezentos" ; +lin n4 = mkNum "cuatro" (variants {"catorze" ; "quatorze"}) "quarenta" "cuatrocentos" ; +lin n5 = mkNum "cinco" "quinze" "cinqenta" "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}; + +} diff --git a/examples/numerals/quechua.gf b/examples/numerals/quechua.gf new file mode 100644 index 000000000..fbc7617e4 --- /dev/null +++ b/examples/numerals/quechua.gf @@ -0,0 +1,56 @@ +concrete quechua of Numerals = { +-- 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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +oper mkRegNum1 : Str -> LinDigit = + \juk -> + { s = table { unit => juk ; havingunit => juk + "niyuq" } ; size = pl}; + +oper mkRegNum2 : Str -> LinDigit = + \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 } ; + +} diff --git a/examples/numerals/romanian.gf b/examples/numerals/romanian.gf new file mode 100644 index 000000000..4dfaaceac --- /dev/null +++ b/examples/numerals/romanian.gf @@ -0,0 +1,70 @@ +concrete romanian of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +-- 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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : MidForm => Str ; size : Size} ; +lincat Sub1000 = {s : MidForm => Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> Str -> Str -> LinDigit = + \two -> \twelve -> \twenty -> mkNumSpc two twelve twenty two ; + +oper mkNumSpc : Str -> Str -> Str -> Str -> LinDigit = + \two -> \twelve -> \twenty -> \doua -> + {s = table {unit => two ; teen => twelve ; ten => twenty ; attr => doua} ; size = less20} ; + +oper regNum : Str -> LinDigit = + \trei -> mkNum trei (trei + variants { "sprezece" ; "şpe" }) (trei + "zeci") ; + +oper ss : Str -> {s : MidForm => Str ; size : Size} = \st -> {s = table {_ => st} ; size = less20} ; + +lin num x = {s = [] ++ x.s ++ [] }; -- Latin A Supplement chars +lin n2 = mkNumSpc "doi" (variants { "doisprezece" ; "douăsprezece" }) "douăzeci" "două" ; +lin n3 = regNum "trei" ; +lin n4 = mkNum "patru" (variants{"paisprezece" ; "paişpe"}) "patruzeci" ; +lin n5 = mkNumSpc "cinci" (variants{"cinsprezece" ; "cinşpe"}) "cinzeci" (variants { "cinci" ; "cin" }); +lin n6 = mkNum "şase" (variants{"şaisprezece" ; "şaispe"}) "şaizeci" ; +lin n7 = mkNum "şapte" (variants{"şaptesprezece" ; "şapspe"}) "şaptezeci" ; +lin n8 = mkNum "opt" (variants{"optsprezece" ; "opspe"}) "optzeci" ; +lin n9 = regNum "nouă" ; + +lin pot01 = {s = table {attr => "o" ; f => "unu"} ; size = sg} ; +lin pot0 d = d ; +lin pot110 = ss "zece" ; +lin pot111 = ss (variants { "unsprezece" ; "unş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 ++ "şi" ++ e.s ! unit ; + det => d.s ! ten ++ "ş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..6e3a6b8e0 --- /dev/null +++ b/examples/numerals/russian.gf @@ -0,0 +1,116 @@ +concrete russian of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=russian ; + +-- 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} => "тысяча" ; + {sgg} => "тысячи" ; + _ => "тысяч"} ; + +oper gg : Str -> Gen => Str = \s -> table {_ => s} ; + +lin num x0 = + {s = [] ++ x0.s ! masc ++ []} ; -- Russian environment + +lin n2 = + {s = table {{unit} => table {{fem} => "две" ; _ => "два"} ; + {teen} => gg "двенадцать" ; + {ten} => gg "двадцать" ; + {hund} => gg "двести"} ; + size = sgg} ; +lin n3 = + {s = table {{unit} => gg "три" ; + {teen} => gg "тринадцать" ; + {ten} => gg "тридцать" ; + {hund} => gg "триста"} ; + size = sgg} ; +lin n4 = + {s = table {{unit} => gg "четыре" ; + {teen} => gg "четырнадцать" ; + {ten} => gg "сорок" ; + {hund} => gg "четыреста"} ; + size = sgg} ; +lin n5 = + {s = table {{unit} => gg "пять" ; + {teen} => gg "пятнадцать" ; + {ten} => gg "пятьдесят" ; + {hund} => gg "пятьсот"} ; + size = plg} ; +lin n6 = + {s = table {{unit} => gg "шесть" ; + {teen} => gg "шестнадцать" ; + {ten} => gg "шестьдесят" ; + {hund} => gg "шестьсот"} ; + size = plg} ; +lin n7 = + {s = table {{unit} => gg "семь" ; + {teen} => gg "семнадцать" ; + {ten} => gg "семьдесят" ; + {hund} => gg "семьсот"} ; + size = plg} ; +lin n8 = + {s = table {{unit} => gg "восемь" ; + {teen} => gg "восемнадцать" ; + {ten} => gg "восемьдесят" ; + {hund} => gg "восемьсот"} ; + size = plg} ; +lin n9 = + {s = table {{unit} => gg "девять" ; + {teen} => gg "девятнадцать" ; + {ten} => gg "девяносто" ; + {hund} => gg "девятьсот"} ; + size = plg} ; + + +lin pot01 = + {s = table {{attr} => table {{hund} => gg "сто" ; _ => gg []} ; + _ => table {{hund} => gg "сто" ; + _ => table {{masc} => "один" ; {fem} => "одна" ; _ => "одно"}}} ; + size = nom} ; +lin pot0 d = + {s = table {_ => d.s} ; size = d.size} ; +lin pot110 = + {s = table {_ => gg "десять"} ; size = plg} ; +lin pot111 = + {s = table {_ => gg "одиннадцать"} ; 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..db5feea19 --- /dev/null +++ b/examples/numerals/sango.gf @@ -0,0 +1,66 @@ +concrete sango of Numerals = { +-- 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 "mbsmbr" ; +lin n8 = mkNum "miombe" ; +lin n9 = mkNum "ngomby" ; + +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/slovak.gf b/examples/numerals/slovak.gf new file mode 100644 index 000000000..4bf362f4b --- /dev/null +++ b/examples/numerals/slovak.gf @@ -0,0 +1,63 @@ +concrete slovak of Numerals = { +-- 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..30920c445 --- /dev/null +++ b/examples/numerals/sorani.gf @@ -0,0 +1,99 @@ +concrete sorani of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=extendedarabic ; + +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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str ; size : Size} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str ; size : Size} ; +lincat Sub100 = {s : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +lin num x0 = + {s = [] ++ x0.s ++ []} ; -- the Arabic environment + +oper mkNum : Str -> Str -> Str -> LinDigit = + \dwA -> \cl -> \dwwls -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; hund => dwA + "سهد" ; + kilurrest => "دuممي" ; kilurresthAzar => "دuممي" } ; size = less500}; + +oper mkNum6 : Str -> Str -> Str -> Str -> Str -> LinDigit = + \dwA -> \cl -> \dwwls -> \pEn -> \rest -> + {s = table {unit => dwA ; ten => cl ; teen => dwwls ; hund => pEn + "سهد" ; + kilurrest => rest + "سهد" ; kilurresthAzar => rest + "سهد" ++ "ههزار"} ; size = fiveup} ; + +-- lin n1 mkNum "يهك" "ده" variants { "يازده" ; "يانزه"} [] ; +lin n2 = mkNum "دۇ" "بىست" (variants { "دووازده" ; "دووانزه" }) ; +lin n3 = mkNum "سى" "سى" (variants { "سىزده" ; "سيانزه" }) ; +lin n4 = mkNum "چووار" "ځل" "چووارده" ; +lin n5 = {s = table {unit => "پىنج" ; + ten => "پهنجا" ; + teen => (variants { "پازده" ; "پانزه" }) ; + hund => "پىن" + "سهد"; + kilurrest => [] ; + kilurresthAzar => [] } ; + size = fiveup } ; + +lin n6 = mkNum6 "شهش" "شهست" (variants { "شازده"; "شانزه"}) "شهش" [] ; +lin n7 = mkNum6 "حهوت" "حهفتا" "حهڤده" "حهو" "دۇ" ; +lin n8 = mkNum6 "ههشت" "ههشتا" "ههژده" "ههش" "سى" ; +lin n9 = mkNum6 "نۃ" "نهوهد" "نۃزده" "نۃ" "چووار" ; + +oper ss : Str -> {s : Str ; size : Size} = \s -> {s = s ; size = less500} ; + +lin pot01 = {s = table {unit => "يهك" ; hund => "سهد" ; _ => "دuممي" } ; size = sg } ; +lin pot0 d = {s = table {f => d.s ! f} ; size = d.size} ; +lin pot110 = ss "ده" ; +lin pot111 = ss (variants { "يازده" ; "يانزه"}); +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) ++ "و" ++ (e.s ! unit); size = less500} ; +lin pot1as2 n = {s = n.s ; s2 = "دuممي" ; size = n.size } ; +lin pot2 d = {s = d.s ! hund ; s2 = "كلۇر" ++ d.s ! kilurresthAzar ; size = isover500 d.size} ; +lin pot2plus d e = + {s = d.s ! hund ++ e.s ; + s2 = "كلۇر" ++ d.s ! kilurrest ++ (mkhAzar e.s "دuممي") ! 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 => "ههزار" ; + fiveup => attr ++ "ههزار" ; + less500 => attr ++ "ههزار" ; + more500 => kilur} ; + + + + + +} diff --git a/examples/numerals/spanish.gf b/examples/numerals/spanish.gf new file mode 100644 index 000000000..2be316824 --- /dev/null +++ b/examples/numerals/spanish.gf @@ -0,0 +1,64 @@ +concrete spanish of Numerals = { +-- 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..8832e2cca --- /dev/null +++ b/examples/numerals/stieng.gf @@ -0,0 +1,59 @@ +concrete stieng of Numerals = { +-- include numerals.Abs.gf ; + +param Size = sg | belowten | moreten ; + +oper LinDigit = {s : Str ; size : Size} ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +oper mkNum : Str -> LinDigit = \u -> {s = u ; size = belowten} ; + +lin n2 = mkNum "baar" ; +lin n3 = mkNum "p" ; +lin n4 = mkNum "pun" ; +lin n5 = mkNum "pram" ; +lin n6 = mkNum "prau" ; +lin n7 = mkNum "poh" ; +lin n8 = mkNum "phaam" ; +lin n9 = mkNum "sn" ; + +oper ban : Str = (variants {"ban" ; "rabu"} ) ; + +lin num x = x ; + +lin pot01 = {s = variants {"mui" ; "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" ++ "mui" ; s2 = variants {"mu'n" ++ ban ; "jo'm'ot" ++ "mui" ++ 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 { "ring" ; "rhing" }) (d.s ++ "ring") ; + s2 = xsg d.size "seen" (d.s ++ "seen") ; + size = moreten} ; +lin pot2plus d e = {s = xsg d.size (variants { "ring" ; "rhing" }) (d.s ++ "ring") ++ 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..3ed407a44 --- /dev/null +++ b/examples/numerals/swahili.gf @@ -0,0 +1,59 @@ +concrete swahili of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = unit | ten ; +param Size = sg | pl | pl_end | more100; +param S1000 = reg | lakh ; + +lincat Numeral = {s : Str} ; +oper LinDigit = {s : DForm => Str ; size : Size } ; +lincat Digit = LinDigit ; + +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 -> LinDigit = \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..bb7ea17e1 --- /dev/null +++ b/examples/numerals/swedish.gf @@ -0,0 +1,52 @@ +concrete swedish of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = ental | ton | tiotal ; + +lincat Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str} ; +lincat Digit = LinDigit ; + +lincat Sub10 = {s : DForm => Str} ; +lincat Sub100 = { s : Str } ; +lincat Sub1000 = { s : Str } ; +lincat Sub1000000 = { s : Str } ; + +oper + mkTal : Str -> Str -> Str -> LinDigit = \tv, tolv, tjugo -> + {s = table {ental => tv ; ton => tolv ; tiotal => tjugo}} ; + + regTal : Str -> LinDigit = \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..3d9c1ed7f --- /dev/null +++ b/examples/numerals/tamil.gf @@ -0,0 +1,171 @@ +concrete tamil of Numerals = { +flags coding = utf8 ; +-- 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 ; +-- flags coding=tamil ; + +oper + vowel : Strs = strs {"ஒ" ; "எ" ; "அ" ; "இ" ; "உ"} ; + labial : Strs = strs {"மௌ" ; "பௌ"} ; + retroflex : Strs = strs {"ணௌ" ; "டௌ"} ; + sandhi_u : Str = pre {"உ" ; [] / vowel} ; + sandhi_n : Str = pre {"னௌ" ; "மௌ" / labial} ; + sandhi_spc_n : Str = pre {"னௌ" ; "பௌ" / labial} ; + -- sandhi_N : Str = post {"னௌ" ; "ணௌ" / 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 = [] ++ x0.s ++ []} ; -- the Tamil environment + +lin n2 = + {s = table {teen => "பனௌனாரணௌடீ" ; + unit => "இரணௌடௌ" + sandhi_u ; + attr1 => "இரீ" ; + attr2 => variants {"இரணௌடௌ" + sandhi_u ; "ஈரௌ"} } ; size = less100} ; +lin n3 = + {s = table {teen => "பதானௌ" + "முனௌரீ" ; + unit => "முனௌரௌ" + sandhi_u ; + attr1 => "மீ" + sandhi_spc_n ; + attr2 => "முறௌ"} ; size = less100} ; +lin n4 = + {s = table {teen => "பதா" + variants { "ந஽றீ" ; "ந஽னௌகீ" } ; + unit => variants { "ந஽றௌ" + sandhi_u ; "ந஽னௌகௌ" + sandhi_u } ; + attr1 => "ந஽ரௌ" ; + attr2 => "ந஽றௌ"} ; size = four} ; +lin n5 = + {s = table {teen => "பதானௌ" + "ஐனௌdீ" ; + unit => "ஐனௌதௌ" + sandhi_u ; + attr1 => "ஐ" + sandhi_n ; + attr2 => "ஐயௌ"} ; size = five} ; +lin n6 = + {s = table {teen => "பதானௌ" + "ஆரீ" ; + unit => "ஆரௌ" + sandhi_u ; + attr1 => "அரீ" ; + attr2 => "ஆரௌ"} ; size = less100} ; +lin n7 = + {s = table {teen => "பதானௌ" + "ஏலீ" ; + unit => "ஏலௌ" + sandhi_u ; + attr1 => "எலீ" ; + attr2 => "எலௌ"} ; size = less100} ; +lin n8 = + {s = table {teen => "பதானௌ" + "எடௌடீ" ; + unit => "எடௌடௌ" + sandhi_u ; + attr1 => "எணௌ" ; + attr2 => "எணௌணௌ"} ; size = eight} ; +lin n9 = + {s = table {teen => "பதௌதௌ" + "ஓனௌபதீ" ; + unit => "ஓனௌபதௌ" + sandhi_u ; + attr1 => "த௉ணௌ" ; + attr2 => "ஓனௌபதானௌ"} ; size = nine} ; + +oper fiveh : Str = variants { "ஐனௌன஽ரீ" ; "அஞௌஞ஽ரீ"} ; +oper fiveh_sandhi : Str = variants { "ஐனௌன஽ரௌ" + sandhi_u ; "அஞௌஞ஽ரௌ" + sandhi_u } ; + +lin pot01 = + {s = table {unit => "ஓனௌரீ"; teen => "பதானௌ" + "ஓனௌரீ" ; attr1 => "ஓரௌ" + sandhi_u ; attr2 => []} ; size = sg} ; +lin pot0 d = + {s = d.s ; size = d.size} ; +lin pot110 = + {s = table {_ => "பதௌதீ"} ; size = less100} ; +lin pot111 = + {s = table {_ => "பதானௌ" + "ஓனௌரௌ" + 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 => "த௉ணௌண஽ரௌ" + sandhi_u ; _ => d.s ! attr1 ++ "பதீ"} ! d.size} ; size = less100} ; +lin pot1plus d e = + {s = table {_ => table {nine => ("த௉ணௌண஽ரௌ" + sandhi_u) ++ e.s ! unit; _ => d.s ! attr1 ++ "பதௌ" + 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 ; _ => "dீமௌமௌயௌ"}; size = n.size} ; +lin pot2 d = + {s = table {indeptwo => + table {nine => "த௉லௌல஽யாரமௌ" ; + eight => "எணௌண஽ரீ" ; + four => "ந஽ந஽ரீ" ; + five => fiveh ; + sg => "ந஽ரீ" ; + _ => d.s ! attr1 ++ "ந஽ரீ"} ! d.size ; + attrtwo => + table {nine => "த௉லௌல஽யாரதௌதௌ" + sandhi_u ; + eight => "எணௌண஽ரௌ" + sandhi_u ; + four => "ந஽ந஽ரௌ" + sandhi_u; + five => fiveh_sandhi ; + _ => d.s ! attr1 ++ "ந஽ரௌ" + sandhi_u} ! d.size ; + preceded => + table {nine => "த௉லௌல஽யாரமௌ" ; + eight => "எணௌண஽ரீ" ; + four => "ந஽ந஽ரீ" ; + five => fiveh ; + _ => d.s ! attr1 ++ "ந஽ரீ"} ! d.size ; + lakhs => d.s ! unit ++ "இறடௌசமௌ" ; + lakhs2 => d.s ! unit ++ "இறடௌசதௌதீ" } ; + size = more100} ; +lin pot2plus d e = + {s = table {indeptwo => + table {nine => ("த௉லௌல஽யாரதௌதௌ" + sandhi_u) ; + eight => ("எணௌண஽ரௌ" + sandhi_u) ; + four => ("ந஽ந஽ரௌ" + sandhi_u) ; + five => fiveh_sandhi ; + sg => ("ந஽ரௌ" + sandhi_u) ; + _ => d.s ! attr1 ++ ("ந஽ரௌ" + sandhi_u) } ! d.size ++ e.s ! indep ; + attrtwo => + table {nine => ("த௉லௌல஽யாரதௌதௌ" + sandhi_u) ; + eight => ("எணௌண஽ரௌ" + sandhi_u) ; + four => ("ந஽ந஽ரௌ" + sandhi_u) ; + five => fiveh_sandhi ; + sg => ("ந஽ரௌ" + sandhi_u) ; + _ => d.s ! attr1 ++ ("ந஽ரௌ" + sandhi_u) } ! d.size ++ e.s ! indep ; + preceded => + table {nine => ("த௉லௌல஽யாரதௌதௌ" + sandhi_u) ; + eight => ("எணௌண஽ரௌ" + sandhi_u) ; + four => ("ந஽ந஽ரௌ" + sandhi_u) ; + five => fiveh_sandhi ; + _ => d.s ! attr1 ++ ("ந஽ரௌ" + sandhi_u) } ! d.size ++ e.s ! indep ; + lakhs => d.s ! unit ++ ("இறடௌசதௌதௌ" + sandhi_u) ++ + table {sg => "ஆயாரமௌ" ; _ => e.s ! attr ++ "ஆயாரமௌ" } ! e.size ; + lakhs2 => d.s ! unit ++ ("இறடௌசதௌதௌ" + sandhi_u) ++ + table {sg => "ஆயாரதௌதௌ" + sandhi_u ; _ => e.s ! attr ++ ("ஆயாரதௌதௌ" + sandhi_u) } ! e.size} ; size = more100} ; + +lin pot2as3 n = + {s = n.s ! indeptwo} ; +lin pot3 n = + {s = table {sg => "ஆயாரமௌ" ; + more100 => n.s ! lakhs ; + _ => n.s ! attrtwo ++ "ஆயாரமௌ" } ! n.size } ; + +lin pot3plus n m = + {s = table {sg => "ஆயாரதௌதௌ" + sandhi_u; + more100 => n.s ! lakhs2 ; + _ => n.s ! attrtwo ++ "ஆயாரதௌதௌ" + 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..bdd8f431b --- /dev/null +++ b/examples/numerals/tampere.gf @@ -0,0 +1,63 @@ +concrete tampere of Numerals = { +-- 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} => "seittmn"}} ; +lin n8 = + {s = table {p => "kahreksan"}} ; +lin n9 = + {s = table {p => "yhreksn"}} ; +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/thai.gf b/examples/numerals/thai.gf new file mode 100644 index 000000000..8180045af --- /dev/null +++ b/examples/numerals/thai.gf @@ -0,0 +1,72 @@ +concrete thai of Numerals = { +-- include numerals.Abs.gf ; + +-- Thai transliteration, produces thaiU.gf by GF/Text/Thai.hs +-- AR 28/12/2006 + +flags coding=utf8 ; + +lincat + Numeral = {s : Str} ; + Digit = {s : DForm => Str} ; + Sub10 = {s : DForm => Str} ; + Sub100 = {s : NForm => Str} ; + Sub1000 = {s : NForm => Str} ; + Sub1000000 = {s : Str} ; + +lin + num x = x ; + + pot01 = mkNum "หนึง" "หนึง" "เอ็ด" ; + + n2 = mkNum "สอง" "ยี่" "สอง" ; + n3 = regNum "สาม" ; + n4 = regNum "สี่" ; -- T1 = E48 ' + n5 = regNum "ห้า" ; -- T2 = E49 9 + n6 = regNum "หก" ; + n7 = regNum "เจ็ด" ; -- S = E47 w + n8 = regNum "แปด" ; + n9 = regNum "เกา" ; + + + pot0 d = d ; + + pot110 = {s = sip} ; + pot111 = {s = table { + Unit => ["สิบเอ็ด"] ; + Thousand => ["หนึงหมื่นหนึงพะน"] + } + } ; + pot1to19 d = {s = table { + Unit => "สิบ" ++ d.s ! After ; + Thousand => ["หนึงหมื่น"] ++ d.s ! Indep ++ "พะน" + } + } ; + pot0as1 d = {s = \\n => d.s ! Indep ++ phan ! n} ; + pot1 d = {s = \\n => d.s ! ModTen ++ sip ! n} ; + pot1plus d e = { + s = \\n => d.s ! ModTen ++ sip ! n ++ e.s ! After ++ phan ! n + } ; + pot1as2 n = n ; + pot2 d = {s = \\n => d.s ! Indep ++ roy ! n} ; + pot2plus d e = {s = \\n => d.s ! Indep ++ roy ! n ++ e.s ! n} ; + pot2as3 n = {s = n.s ! Unit} ; + pot3 n = {s = n.s ! Thousand} ; + pot3plus n m = {s = n.s ! Thousand ++ m.s ! Unit} ; + +param + DForm = Indep | ModTen | After ; + NForm = Unit | Thousand ; + +oper + mkNum : Str -> Str -> Str -> {s : DForm => Str} = \x,y,z -> + {s = table {Indep => x ; ModTen => y ; After => z}} ; + regNum : Str -> {s : DForm => Str} = \x -> + mkNum x x x ; + + + sip = table {Unit => "สิบ" ; Thousand => "หมื่น"} ; + roy = table {Unit => "ร้อย" ; Thousand => "แสน"} ; + phan = table {Unit => [] ; Thousand => "พะน"} ; + +} diff --git a/examples/numerals/tibetan.gf b/examples/numerals/tibetan.gf new file mode 100644 index 000000000..a68c4cb31 --- /dev/null +++ b/examples/numerals/tibetan.gf @@ -0,0 +1,72 @@ +concrete tibetan of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=extradiacritics ; + +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 Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str} ; +lincat Sub1000 = {s : Str ; s2 : Str} ; +lincat Sub1000000 = { s : 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 + "ğya" ; agg => "ṭ'a'" ++ u}} ; + +-- lin n1 mkNum "chi'" "chuǵchi'" ; +lin n2 = +{s = table {unit => "n̆yī" ; teen => "chuǵn̆yī" ; ten => "tsaǵ" ; + bform => "nyishu" ; hundred => (variants {"nyibğya"; "nyībğya"}) ; + agg => "ṭ'a'" ++ "n̆yī" } }; +lin n3 = mkNum "sum" "chuǵsum" "sum" "soǵ" ; +lin n4 = mkNum "z̆hyi" "chubz̆hyi" (variants {"z̆hyib" ; "z̆hib"}) "źhye" ; +lin n5 = mkNum "n̆ga" "chȫn̆ga" "n̆gab" "nga" ; +lin n6 = mkNum "ḍu'" "chuḍu'" "ḍuǵ" "re"; +lin n7 = mkNum "d̆ün" "chubd̆ün" "d̆ün" "d́ön"; +lin n8 = mkNum "ğyä'" "chobğyä'" "ğyä'" "ǵya"; +lin n9 = mkNum "ğu" "chuğu" "ğub" "ǵo"; + +oper dang : Str = "d́ang" ; +oper tampa : Str -> Str = \s -> (variants {s; s ++ "t'ampa"}); + +lin num x = {s = [] ++ x.s ++ [] }; -- extra diacritics translation + +lin pot01 = + {s = table {hundred => "ğya" ; agg => (variants {[] ; "t'a'"}) ; _ => "chi'"}} ; +lin pot0 d = d ; +lin pot110 = {s = tampa "chu" ; s2 = variants {"ṭ'i" ; "ṭ'iṭ'a'"}} ; +lin pot111 = + {s = "chuǵchi'" ; + s2 = variants {"ṭ'i" ; "ṭ'iṭ'a'"} ++ dang ++ variants {"t̆ong'i" ; "t̆ongṭ'a'"}} ; +lin pot1to19 d = {s = d.s ! teen ; s2 = variants {"ṭ'i" ; "ṭ'iṭ'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) "ṭ'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) "ṭ'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/todo/irula.gf b/examples/numerals/todo/irula.gf new file mode 100644 index 000000000..46864dc88 --- /dev/null +++ b/examples/numerals/todo/irula.gf @@ -0,0 +1,80 @@ +concrete irula of Numerals = { +-- 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} ; ----BUG in Compute (AR 9/5/2005) + cavira : Str = variants {"a:yira" + T ; "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 => "nr_u" ; ---- pre {[] ; "nr_u" / strs {[]}} ; + ---- equivalent by the sem. of pre. AR + + 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/todo/kodagu.gf b/examples/numerals/todo/kodagu.gf new file mode 100644 index 000000000..6b8e63ec4 --- /dev/null +++ b/examples/numerals/todo/kodagu.gf @@ -0,0 +1,75 @@ +concrete kodagu of Numerals = { +-- 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" ("padmu:nd"+I) "nupp" "mu:n" "mu:v" ; +lin n4 = mkN "na:l" ("padna:l"+I) "na:p" "na:n" "na:l" ; +lin n5 = mkN "an~ji" "padnan~ji" "aymb" "a" "ay" ; +lin n6 = mkN "a:r" ("padna:r"+I) "arup" "a:rn" "a:r" ; +lin n7 = mkN ":l" ("padn:l"+I) "l.up" ":l.n" ":l." ; +lin n8 = mkN "t.t." ("padnt.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 => "ond" ; ---- pre {[] ; "ond" / strs {[]}} ; + ---- equivalent by the sem. of pre. AR + 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/todo/sanskrit.gf b/examples/numerals/todo/sanskrit.gf new file mode 100644 index 000000000..4c357e953 --- /dev/null +++ b/examples/numerals/todo/sanskrit.gf @@ -0,0 +1,205 @@ +concrete sanskrit of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=devanagari ; + +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 {"अ" ; "ए" ; "इ" ; "उ" ; "ओ"} ; + dental : Strs = strs {"न"; "त"; "द"} ; + labial : Strs = strs {"म"; "प"; "ब"} ; + velar : Strs = strs {"ग़"; "क"; "ग"} ; + affricate : Strs = strs {"ञ" ; "च"; "ज" } ; + retroflex : Strs = strs {"ण" ; "ट" ; "ड"; "ष"} ; + sibilant : Strs = strs {"श" ; "स"; "ह"; "र"} ; -- r also + unvoiced : Strs = strs {"क"; "प"; "च"; "त"} ; + +oper + S : Str = pre {"ष" ; "ट" / unvoiced ; "ड" / vowel } ; + as : Str = pre {"ओ" ; "अस" / unvoiced ; "अः" / sibilant } ; + i : Str = pre {"इ" ; "य" / vowel } ; + am : Str = "अ" + (pre {"म" ; "न" / dental ; "ग़" / velar ; "ञ" / affricate ; "ण" / retroflex ; "ं" / sibilant}) ; + a_ : Str = pre { "आ" ; "अ" / vowel } ; -- shortened if a follows (no other vowel occur initally) + r : Str = pre {"र" ; "स" / unvoiced ; "च" / affricate ; "ः" / sibilant } ; + t : Str = pre {"त" ; "च" / affricate ; "ट" / retroflex } ; + + +LinDigit = {s : DForm => Str ; size : DSize} ; + +lincat Numeral = { s : Str } ; +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 } ; +lincat Sub1000000 = { s : Str } ; + +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 "एक" daca ... ; +lin n2 = mkNum "द्व" viMcati r2 ; +lin n3 = mkNum ("त्र" + i) triMcat r3 ; +lin n4 = mkNum ("चतु" + r) catvariMcat r4 ; +lin n5 = mkNum "पञ्च" pancacat r5 ; +lin n6 = mkNum ("ष" + S) SaSTi r6 ; +lin n7 = mkNum "सप्त" saptati r7 ; +lin n8 = mkNum "अष्ट" aciti r8; +lin n9 = mkNum "नव" navati r9 ; + +oper daca : Str = "दश" ; +oper viMcati : Str = "विंशत" + i; +oper triMcat : Str = "त्रिंश" + t; +oper catvariMcat : Str = "चत्वारिंश" + t ; +oper pancacat : Str = "पञ्चाश" + t; +oper SaSTi : Str = "षष्ट" + i; +oper saptati : Str = "सप्तत" + i ; +oper aciti : Str = "अशीत" + i ; +oper navati : Str = "नवत" + 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 ; "ऊना" + viMcati} ; + r2 => variants {a1 + viMcati ; "ऊना" + triMcat } ; + r3 => variants {a1 + triMcat ; "ऊना" + catvariMcat } ; + r4 => variants {a1 + catvariMcat ; "ऊना" + pancacat } ; + r5 => variants {a1 + pancacat ; "ऊना" + SaSTi } ; + r6 => variants {a1 + SaSTi ; "ऊना" + saptati } ; + r7 => variants {a1 + saptati ; "ऊना" + aciti } ; + r8 => variants {a1 + aciti ; "ऊना" + navati } ; + r9 => variants {a1 + navati ; "ऊना" + 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 => "षोडश" ; + r2 => a1 + viMcati ; + r3 => a1 + triMcat ; + r4 => a1 + catvariMcat ; + r5 => a1 + pancacat ; + r6 => a1 + SaSTi ; + r7 => a1 + saptati ; + r8 => a1 + aciti ; + r9 => "षोण्णवत" + i +} ; + +oper rows : DSize => DSize => Str = table { + sg => mkR1 ("एक" + a_) eka ; + r2 => mkR3 ("द्व" + a_) ("द्व" + i) ; + r3 => mkR3 ("त्रय" + as) ("त्र" + i) ; + r4 => mkR ("चतु" + r) ; + r5 => mkR "पञ्च" ; + r6 => mkR6 ("ष" + S) ; + r7 => mkR "सप्त" ; + r8 => mkR3 ("अष्ट" + a_) "अष्ट" ; + r9 => mkR9 "नव" +} ; + +oper eka : Str = "एक" ; + +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 => "सहस्र" + am ; dual => "द्वे" ++ "सहस्रे" ; _ => s ++ ("सहस्राण" + i)} ! sz ; +oper mksahasra : DSize -> Str -> Str = \sz -> \s -> table {sg => "सहस्र" + am ; r2 => "द्वे" ++ "सहस्रे" ; _ => s ++ ("सहस्राण" + i)} ! sz ; +oper mkcata : DSize -> Str -> Str = \sz -> \s -> table {sg => cata ; r2 => variants {"द्वे" ++ "शते" ; "द्वी" + cata }; _ => s ++ ("शतान" + i)} ! sz ; +oper mklakh : DSize -> Str -> Str = \sz -> \s -> table {sg => "लक्ष" + am ; r2 => "द्वे" ++ "लक्षे" ; _ => s ++ ("लक्षाण" + i) } ! sz ; +oper mklakh2 : Size -> Str -> Str = \sz -> \s -> table {sing => "लक्ष" + am ; dual => "द्वे" ++ "लक्षे" ; _ => s ++ ("लक्षाण" + i) } ! sz ; + +oper mkayuta : DSize -> Str -> Str = \sz -> \s -> table {sg => "अयुत" + am ; r2 => "द्वे" ++ "अयुते" ; _ => s ++ ("अयुतान" + i)} ! sz ; + +oper adhikam : Str = "अधिक" + am ; +oper ca : Str = "च" ; +oper ayuta : Str = "अयुत" + am ; +oper cata : Str = "शत" + am ; + +oper hundredplusunit : Str -> Str -> Str = \hun -> \unit -> + variants {hun ++ unit ++ "च" ; 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/todo/sanskritTranslit.gf b/examples/numerals/todo/sanskritTranslit.gf new file mode 100644 index 000000000..cf94af33e --- /dev/null +++ b/examples/numerals/todo/sanskritTranslit.gf @@ -0,0 +1,204 @@ +concrete sanskrit of Numerals = { +-- include numerals.Abs.gf ; +-- flags coding=devanagari ; + +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 Numeral = { s : Str } ; +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 } ; +lincat Sub1000000 = { s : Str } ; + +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 "paca" 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 = "daa" ; +oper viMcati : Str = "viMat" + i; +oper triMcat : Str = "triMa" + t; +oper catvariMcat : Str = "catva:riMa" + t ; +oper pancacat : Str = "paca:a" + t; +oper SaSTi : Str = "SaST" + i; +oper saptati : Str = "saptat" + i ; +oper aciti : Str = "ai: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 => "SoDaa" ; + 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 "paca" ; + 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/todo/thai.gf b/examples/numerals/todo/thai.gf new file mode 100644 index 000000000..0b9144001 --- /dev/null +++ b/examples/numerals/todo/thai.gf @@ -0,0 +1,72 @@ +concrete thai of Numerals = { +-- include numerals.Abs.gf ; + +-- Thai transliteration, produces thaiU.gf by GF/Text/Thai.hs +-- AR 28/12/2006 + +-- flags coding=utf8 ; + +lincat + Numeral = {s : Str} ; + Digit = {s : DForm => Str} ; + Sub10 = {s : DForm => Str} ; + Sub100 = {s : NForm => Str} ; + Sub1000 = {s : NForm => Str} ; + Sub1000000 = {s : Str} ; + +lin + num x = x ; + + pot01 = mkNum "hnvg" "hnvg" "eOSd" ; + + n2 = mkNum "sOg" "yi:T1" "sOg" ; + n3 = regNum "sa:m" ; + n4 = regNum "si:T1" ; -- T1 = E48 ' + n5 = regNum "hT2a:" ; -- T2 = E49 9 + n6 = regNum "ho?k" ; + n7 = regNum "ecSd" ; -- S = E47 w + n8 = regNum "e'pd" ; + n9 = regNum "eka:" ; + + + pot0 d = d ; + + pot110 = {s = sip} ; + pot111 = {s = table { + Unit => ["sib eOSd"] ; + Thousand => ["hnvg hmv:T1n hnvg p2an"] + } + } ; + pot1to19 d = {s = table { + Unit => "sib" ++ d.s ! After ; + Thousand => ["hnvg hmv:T1n"] ++ d.s ! Indep ++ "p2an" + } + } ; + pot0as1 d = {s = \\n => d.s ! Indep ++ phan ! n} ; + pot1 d = {s = \\n => d.s ! ModTen ++ sip ! n} ; + pot1plus d e = { + s = \\n => d.s ! ModTen ++ sip ! n ++ e.s ! After ++ phan ! n + } ; + pot1as2 n = n ; + pot2 d = {s = \\n => d.s ! Indep ++ roy ! n} ; + pot2plus d e = {s = \\n => d.s ! Indep ++ roy ! n ++ e.s ! n} ; + pot2as3 n = {s = n.s ! Unit} ; + pot3 n = {s = n.s ! Thousand} ; + pot3plus n m = {s = n.s ! Thousand ++ m.s ! Unit} ; + +param + DForm = Indep | ModTen | After ; + NForm = Unit | Thousand ; + +oper + mkNum : Str -> Str -> Str -> {s : DForm => Str} = \x,y,z -> + {s = table {Indep => x ; ModTen => y ; After => z}} ; + regNum : Str -> {s : DForm => Str} = \x -> + mkNum x x x ; + + + sip = table {Unit => "sib" ; Thousand => "hmv:T1n"} ; + roy = table {Unit => "rT2Oy" ; Thousand => "e'sn"} ; + phan = table {Unit => [] ; Thousand => "p2an"} ; + +} diff --git a/examples/numerals/todo/thaiDU.gf b/examples/numerals/todo/thaiDU.gf new file mode 100644 index 000000000..9dfd2f345 --- /dev/null +++ b/examples/numerals/todo/thaiDU.gf @@ -0,0 +1,51 @@ +concrete thaiDU of Numerals = { +-- include numerals.Abs.gf ; + +-- Thai digits. AR 28/12/2006 + +flags lexer=chars ; unlexer=concat ; flags coding=utf8 ; + +param Zeros = noz | zz ; + +lincat Numeral = { s : Str } ; +lincat Digit = { s : Str } ; +lincat Sub10 = { s : Str } ; +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 "๒" ; +lin n3 = ss "๓" ; +lin n4 = ss "๔" ; +lin n5 = ss "๕" ; +lin n6 = ss "๖" ; +lin n7 = ss "๗" ; +lin n8 = ss "๘" ; +lin n9 = ss "๙" ; + +lin pot01 = ss "๑" ; +lin pot0 d = d ; + +lin pot110 = mkz ("๑" ++ "๐") ; +lin pot111 = mkz ("๑" ++ "๑") ; +lin pot1to19 d = mkz ("๑" ++ d.s) ; + +lin pot0as1 n = {s = table {noz => n.s ; zz => "๐" ++ n.s}} ; + +lin pot1 d = mkz (d.s ++ "๐") ; +lin pot1plus d e = mkz (d.s ++ e.s) ; + +lin pot1as2 n = {s = table {noz => n.s ! noz ; zz => "๐" ++ n.s ! zz}} ; +lin pot2 d = mkz (d.s ++ "๐" ++ "๐") ; +lin pot2plus d e = mkz (d.s ++ e.s ! zz) ; + +lin pot2as3 n = {s = table {noz => n.s ! noz ; zz => "๐" ++ n.s ! zz}} ; + +lin pot3 n = mkz (n.s ! noz ++ "๐" ++ "๐" ++ "๐") ; +lin pot3plus n m = {s = table {z => n.s ! z ++ m.s ! zz}} ; + +} diff --git a/examples/numerals/todo/thaiP.gf b/examples/numerals/todo/thaiP.gf new file mode 100644 index 000000000..27ebb842e --- /dev/null +++ b/examples/numerals/todo/thaiP.gf @@ -0,0 +1,72 @@ +concrete thaiP of Numerals = { +-- include numerals.Abs.gf ; + +-- Thai pronunciation (mostly following Smyth's Essential Grammar) +-- AR 28/12/2006 + +-- flags coding=utf8 ; + +lincat + Numeral = {s : Str} ; + Digit = {s : DForm => Str} ; + Sub10 = {s : DForm => Str} ; + Sub100 = {s : NForm => Str} ; + Sub1000 = {s : NForm => Str} ; + Sub1000000 = {s : Str} ; + +lin + num x = x ; + + pot01 = mkNum "nỳng" "nỳng" "èt" ; + + n2 = mkNum "söong" "yîi" "söong" ; + n3 = regNum "säam" ; + n4 = regNum "sìi" ; + n5 = regNum "hâa" ; + n6 = regNum "hòk" ; + n7 = regNum "cèt" ; + n8 = regNum "pèet" ; + n9 = regNum "kâaw" ; + + + pot0 d = d ; + + pot110 = {s = sip} ; + pot111 = {s = table { + Unit => ["sìp èt"] ; + Thousand => ["nỳng mỳyn nỳng phan"] + } + } ; + pot1to19 d = {s = table { + Unit => "sìp" ++ d.s ! After ; + Thousand => ["nỳng mỳyn"] ++ d.s ! Indep ++ "phan" + } + } ; + pot0as1 d = {s = \\n => d.s ! Indep ++ phan ! n} ; + pot1 d = {s = \\n => d.s ! ModTen ++ sip ! n} ; + pot1plus d e = { + s = \\n => d.s ! ModTen ++ sip ! n ++ e.s ! After ++ phan ! n + } ; + pot1as2 n = n ; + pot2 d = {s = \\n => d.s ! Indep ++ roy ! n} ; + pot2plus d e = {s = \\n => d.s ! Indep ++ roy ! n ++ e.s ! n} ; + pot2as3 n = {s = n.s ! Unit} ; + pot3 n = {s = n.s ! Thousand} ; + pot3plus n m = {s = n.s ! Thousand ++ m.s ! Unit} ; + +param + DForm = Indep | ModTen | After ; + NForm = Unit | Thousand ; + +oper + mkNum : Str -> Str -> Str -> {s : DForm => Str} = \x,y,z -> + {s = table {Indep => x ; ModTen => y ; After => z}} ; + regNum : Str -> {s : DForm => Str} = \x -> + mkNum x x x ; + + + sip = table {Unit => "sìp" ; Thousand => "mỳyn"} ; + roy = table {Unit => "róoy" ; Thousand => "sëen"} ; + phan = table {Unit => [] ; Thousand => "phan"} ; + +} diff --git a/examples/numerals/todo/welsh.gf b/examples/numerals/todo/welsh.gf new file mode 100644 index 000000000..ddd7a07a8 --- /dev/null +++ b/examples/numerals/todo/welsh.gf @@ -0,0 +1,74 @@ +concrete welsh of Numerals = { +-- 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/totonac.gf b/examples/numerals/totonac.gf new file mode 100644 index 000000000..8e7e89d33 --- /dev/null +++ b/examples/numerals/totonac.gf @@ -0,0 +1,111 @@ +concrete totonac of Numerals = { +-- 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 Numeral = { s : Str } ; +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} ; + +} diff --git a/examples/numerals/tukang_besi.gf b/examples/numerals/tukang_besi.gf new file mode 100644 index 000000000..f04241ce6 --- /dev/null +++ b/examples/numerals/tukang_besi.gf @@ -0,0 +1,46 @@ +concrete tukang_besi of Numerals = { +-- include numerals.Abs.gf ; + +param DForm = u | v ; + +oper LinDigit = {s : DForm => Str } ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = LinDigit ; +lincat Sub1000 = LinDigit ; +lincat Sub1000000 = { s : Str } ; + +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..90647c212 --- /dev/null +++ b/examples/numerals/turkish.gf @@ -0,0 +1,65 @@ +concrete turkish of Numerals = { +flags coding = utf8 ; +-- include numerals.Abs.gf ; +-- flags coding=latinasupplement ; + +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 Numeral = { s : Str } ; +oper LinDigit = {s : DForm => Str } ; +lincat Digit = LinDigit ; + +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 -> LinDigit = + \iki -> \yirmi -> + {s = table {unit => iki ; teen => (variants {"on" + iki ; "on" ++ iki}) ; ten => yirmi } } ; + +lin num x = {s = [] ++ x.s ++ [] } ; + +-- lin n1 mkNum "bir" "dA" ; +lin n2 = mkNum "iki" "yirmi" ; +lin n3 = mkNum "üç" "otuz" ; +lin n4 = mkNum "dört" "kırk" ; +lin n5 = mkNum "beş" "elli" ; +lin n6 = mkNum "altı" "altmış" ; +lin n7 = mkNum "yedi" "yetmiş" ; +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..a0f192424 --- /dev/null +++ b/examples/numerals/votic.gf @@ -0,0 +1,64 @@ +concrete votic of Numerals = { +-- 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} ; + +} diff --git a/examples/numerals/yasin_burushaski.gf b/examples/numerals/yasin_burushaski.gf new file mode 100644 index 000000000..1b38d0208 --- /dev/null +++ b/examples/numerals/yasin_burushaski.gf @@ -0,0 +1,65 @@ +concrete yasin_burushaski of Numerals = { +-- 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 "wlte" "alt"; +lin n5 = mk20Ten "cend" "alt"; +lin n6 = mkEven20 "bis'nde" "isk" ; +lin n7 = mk20Ten "thal" "isk"; +lin n8 = mkEven20 "altmbe" "wlte"; +lin n9 = mk20Ten "hut" "wlte"; + +lin pot01 = + {s = table {unit => "hek" ; teen => "turma-" + "hk" ; twenty => []} ; even20 = ten ; size = sg}; +lin pot0 d = d ; +lin pot110 = {s = "trum" ; size = pl} ; +lin pot111 = {s = "turma-" + "hk" ; 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 ++ "trum"} ! 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 ++ "hazr"} ; +lin pot3plus n m = + {s = selsg n.size n.s ++ "hazr" ++ m.s } ; + +oper selsg : Size -> Str -> Str = \sz -> \attr -> + table {sg => [] ; _ => attr} ! sz ; + +} diff --git a/examples/numerals/zaiwa.gf b/examples/numerals/zaiwa.gf new file mode 100644 index 000000000..e93af3421 --- /dev/null +++ b/examples/numerals/zaiwa.gf @@ -0,0 +1,61 @@ +concrete zaiwa of Numerals = { +-- include numerals.Abs.gf ; + +-- flags lexer = words ; + +param Size = sg | sub10 | pl ; + +oper LinDigit = {s : Str ; size : Size} ; + +lincat Numeral = { s : Str } ; +lincat Digit = LinDigit ; +lincat Sub10 = LinDigit ; +lincat Sub100 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size} ; +lincat Sub1000000 = { s : Str } ; + +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} ; + + + + +}