New input method for Tay Viet.
[m17n/m17n-contrib.git] / im / tay-sonla.mim
1 ;; tay-sonla-kdb.mim -- Tai Viet input method with Phonetic sequence
2 ;; Copyright (C) 2007
3 ;; Thua Thien Hue Center of Information Technology (HueCIT, Vietnam)
4
5 ;; This file is part of the m17n contrib; a sub-part of the m17n
6 ;; library.
7
8 ;; The m17n library is free software; you can redistribute it and/or
9 ;; modify it under the terms of the GNU Lesser General Public License
10 ;; as published by the Free Software Foundation; either version 2.1 of
11 ;; the License, or (at your option) any later version.
12
13 ;; The m17n library is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 ;; Lesser General Public License for more details.
17
18 ;; You should have received a copy of the GNU Lesser General Public
19 ;; License along with the m17n library; if not, write to the Free
20 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
22
23 (input-method tay sonla-kbd)
24
25 (title "꫞")
26
27 (description "Tay Viet input method using the phonetic key sequence, accord with the Tay Son La keyboard.
28 The phonetic key sequence means that you type a syllable in this order:
29   C W? V v? F? T?
30 where
31   C is an initial consonant,
32   W is a label to labializing C ('ꪫ'),
33   V is a vowel (prefix, postfix, or combining),
34   v is the second vowel of a digraph vowel (in that case V is 'ꪹ'),
35   F is a final consonant,
36   T is a tonemark (spacing or combining).")
37
38 (map
39  (consonant
40   ("k" "ꪀ")
41   ("K" "ꪁ")
42   ("x" "ꪂ")
43   ("X" "ꪃ")
44   ("q" "ꪄ")
45   ("Q" "ꪅ")
46   ("|" "ꪆ")
47   ("\"" "ꪇ")
48   ("g" "ꪈ")
49   ("G" "ꪉ")
50   ("c" "ꪊ")
51   ("C" "ꪋ")
52   ("." "ꪌ")
53   (">" "ꪍ")
54   ("s" "ꪎ")
55   ("S" "ꪏ")
56   ("z" "ꪐ")
57   ("Z" "ꪑ")
58   ("d" "ꪒ")
59   ("D" "ꪓ")
60   ("t" "ꪔ")
61   ("T" "ꪕ")
62   ("w" "ꪖ")
63   ("W" "ꪗ")
64   ("n" "ꪘ")
65   ("N" "ꪙ")
66   ("b" "ꪚ")
67   ("B" "ꪛ")
68   ("p" "ꪜ")
69   ("P" "ꪝ")
70   ("/" "ꪞ")
71   ("?" "ꪟ")
72   ("f" "ꪠ")
73   ("F" "ꪡ")
74   ("m" "ꪢ")
75   ("M" "ꪣ")
76   ("j" "ꪤ")
77   ("J" "ꪥ")
78   ("r" "ꪦ")
79   ("R" "ꪧ")
80   ("l" "ꪨ")
81   ("L" "ꪩ")
82   ("v" "ꪪ")
83   ("V" "ꪫ")
84   ("h" "ꪬ")
85   ("H" "ꪭ")
86   ("o" "ꪮ")
87   ("O" "ꪯ"))
88
89  (final-c
90   ("b" "ꪚ")
91   ("d" "ꪒ")
92   ("k" "ꪀ")
93   ("J" "ꪥ")
94   ("M" "ꪣ")
95   ("N" "ꪙ")
96   ("G" "ꪉ")
97   ("V" "ꪫ"))  
98
99  (high-v
100   ("V" "ꪫ"))  
101
102  (special
103   ("!" "ꫛ")
104   ("@" "ꫜ")
105   ("#" "ꫝ")
106   ("coon" "ꫛ")
107   ("mootj" "ꫜ")
108   ("sawmj" "ꫝ"))
109
110  (vowel-pre
111   ("e" "ꪵ")
112   ("," "ꪶ")
113   ("E" "ꪹ")
114   ("Y" "ꪻ")
115   ("y" "ꪼ")
116   ("o^" "ꪶ")
117   ("wow" "ꪹ")           ; that is "ươ"
118   ("auw" "ꪻ")           ; that is "aư", note:"aw" is used for "ă"
119   ("ay" "ꪼ"))
120
121  (vowel-combining
122   ("}" "ꪰ")
123   ("i" "ꪲ")
124   ("U" "ꪳ")
125   ("u" "ꪴ")
126   ("[" "ꪷ")
127   ("I" "ꪹ")
128   ("{" "ꪾ")
129   ("ia" "ꪸ")
130   ("iee" "ꪸ")
131   ("ie^" "ꪸ")
132   ("aw" "ꪰ") ;; that is “ă”
133   ("uw" "ꪳ")
134   ("awm" "꪿"))
135
136  (vowel-post
137   ("a" "ꪱ")
138   ;; ("A" "ꪱꪲ")
139   ("<" "ꪺ")
140   ("]" "ꪽ")
141   ("ua" "ꪻ")
142   ("uo^" "ꪻ")
143   ("uoo" "ꪻ")
144   ("awn" "ꪽ"))
145
146  (vowel-digraph
147   ("r" "ꪸ")
148   ("R" "ꪰ"))
149
150  (tone-spacing
151   (":" "ꫀ")
152   (";" "ꫂ"))
153
154  (tone-combining
155   ("\"" "꪿")
156   ("'" "꫁"))
157
158  (punctuation
159   (",," ",")
160   (".." ".")
161   (";;" ";")
162   ("::" ":")
163   (";;" ";")
164   ("\"\"" "\"")
165   ("''" "'")
166   ("??" "?")
167   ("[[" "[")
168   ("]]" "]")
169   ("{{" "{")
170   ("}}" "}")))
171
172 (state
173  (init
174   (t (mark M) (set U 0))
175   (consonant (mark M) (shift after-c))
176   (special)
177   (punctuation)
178   (vowel-pre)
179   (vowel-post)
180   (vowel-combining)
181   (tone-spacing)
182   (tone-combining))
183
184  (after-c
185   (high-v (mark M))
186   (vowel-pre (set V @-1)
187              (delete @-)
188              (move @<) (insert V) (move @>) (shift after-c-vpre))
189   (vowel-combining (set U @-1) (mark M) (shift after-c-v))
190   (vowel-post (shift after-c-v))
191   (vowel-digraph (set U @-1) (mark M) (move @-) (insert "ꪹ") (move @>)
192                  (shift after-c-v)))
193   
194  (after-c-vpre
195   (vowel-combining (set U @-1) (mark M) (shift after-c-v))
196   (vowel-post (shift after-c-v))
197   (nil (shift after-c-v)))
198
199  (after-c-v
200   (tone-spacing (shift init))
201   (tone-combining (set T @-1) (delete @-) (move M) (insert T) (move @>)
202                   (shift init))
203   (final-c (cond ((> U 0) (move M) (delete @-) (move @>) insert U))
204            (shift after-c-v-f)))
205
206  (after-c-v-f
207   (tone-spacing (shift init))
208   (tone-combining (set T @-1) (delete @-) (move M) (insert T) (move @>)
209                   (shift init))))