summaryrefslogtreecommitdiff
path: root/examples/numerals/romanian.gf
blob: 4dfaaceac84cf056f82de77ff9da96709de46738 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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 ;

}