summaryrefslogtreecommitdiff
path: root/devel/phrases/NumeralThaiP.gf
blob: fedb0fc1cfd61ff4879fc00fdac589ccd125737f (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
--# -path=.:prelude:resource-1.0/thai

concrete NumeralThaiP of Numeral = {

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 nvg_s nvg_s et_s ;

  n2 = mkNum soog_s yii_s soog_s ;
  n3 = regNum saam_s ;
  n4 = regNum sii_s ;
  n5 = regNum haa_s ;
  n6 = regNum hok_s ;
  n7 = regNum cet_s ; 
  n8 = regNum peet_s ;
  n9 = regNum kaaw_s ;

  pot0 d = d ;

  pot110 = {s = sip} ;
  pot111 = {s = table {
    Unit => sip_s ++ et_s ;
    Thousand => nvg_s ++ mvvn_s ++ nvg_s ++ phan_s
    }
  } ;
  pot1to19 d = {s = table {
    Unit => sip_s ++ d.s ! After ; 
    Thousand => nvg_s ++ mvvn_s ++ d.s ! Indep ++ phan_s
    }
  } ;
  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} ;

oper
  phan_s = "pahn" ;
  rooy_s = "rawy" ;
  mvvn_s = "meun" ;
  seen_s = "sain" ;

  nvg_s = "neung" ; 
  soog_s = "song" ;
  saam_s = "sahm" ;
  sii_s = "see" ; 
  haa_s = "hah" ; 
  hok_s = "hok" ; 
  cet_s = "jet" ; 
  peet_s = "baat" ; 
  kaaw_s = "gow" ; 
  sip_s = "sip" ;
  yii_s = "yee" ;
  et_s = "et" ;

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 => sip_s   ; Thousand => mvvn_s} ;
  roy  = table {Unit => rooy_s ; Thousand => seen_s} ;
  phan = table {Unit => []      ; Thousand => phan_s} ;

}