summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorbernardy <bernardy@chalmers.se>2007-10-15 09:54:41 +0000
committerbernardy <bernardy@chalmers.se>2007-10-15 09:54:41 +0000
commit869da61a5b965f4a6db9d54706ce333a902298d4 (patch)
treea2443335a4f64af72c243f01be2c25c2cf5fc6c8 /examples
parentbb0252e323ab4850e1d36858556bdf9c0fbe6d50 (diff)
add interlingua numerals grammar
Diffstat (limited to 'examples')
-rw-r--r--examples/numerals/interlingua.gf56
-rw-r--r--examples/numerals/mkNumerals.gfs1
2 files changed, 57 insertions, 0 deletions
diff --git a/examples/numerals/interlingua.gf b/examples/numerals/interlingua.gf
new file mode 100644
index 000000000..acd431688
--- /dev/null
+++ b/examples/numerals/interlingua.gf
@@ -0,0 +1,56 @@
+include numerals.Abs.gf ;
+
+param DForm = unit | ten ;
+
+lincat Numeral = { s : Str } ;
+lincat Digit = { s : DForm => Str } ;
+lincat Sub10 = { s : DForm => Str } ;
+lincat Sub100 = { s : Str } ;
+lincat Sub1000 = { s : Str } ;
+lincat Sub1000000 = { s : Str } ;
+
+oper mkNum : Str -> Str -> Lin Digit =
+ \duo-> \vinti->
+ {s = table {unit => duo ; ten => vinti}} ;
+
+oper regNum : Str -> Lin Digit =
+ \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/mkNumerals.gfs b/examples/numerals/mkNumerals.gfs
index 63ac75bf8..7799c6c55 100644
--- a/examples/numerals/mkNumerals.gfs
+++ b/examples/numerals/mkNumerals.gfs
@@ -30,6 +30,7 @@ i -old -abs=Numerals -cnc=hebrew_biblical hebrew_biblical.gf
i -old -abs=Numerals -cnc=hindi hindi.gf
i -old -abs=Numerals -cnc=hungarian hungarian.gf
i -old -abs=Numerals -cnc=icelandic icelandic.gf
+i -old -abs=Numerals -cnc=interlingua interlingua.gf
i -old -abs=Numerals -cnc=irish irish.gf
i -old -abs=Numerals -cnc=irula irula.gf
i -old -abs=Numerals -cnc=italian italian.gf