1 ;;; its/hankata.el --- Hnakaku Katakana Input in Egg Input Method Architecture
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
6 ;; Author: Satoru Tomura <tomura@etl.go.jp>
8 ;; Maintainer: TOMURA Satoru <tomura@etl.go.jp>
10 ;; This file is part of EGG.
12 ;; EGG is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; EGG is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
29 ;; Symbol input is desined by jiro@math.keio.ac.jp (TANAKA Jiro)
30 ;; This file is based on the rules of its/kata.el in Mule-2.3 distribution.
40 (defconst its-compaction-enable t))
42 (defvar its-han-kata-enable-double-n nil "*Enable \"nn\" input for \"
\e$B%s
\e(B\" ")
43 (defvar its-han-kata-enable-zenkaku-alphabet t "*Enable Zenkaku alphabet")
44 (defvar its-han-kata-period "
\e(I!
\e(B" "*
\e$B%T%j%*%I
\e(B") ; ". " "
\e$B!%
\e(B"
45 (defvar its-han-kata-comma "
\e(I$
\e(B" "*
\e$B%3%s%^
\e(B") ; ", " "
\e$B!$
\e(B"
46 (defvar its-han-kata-open-bracket "
\e(I"
\e(B" "*[") ; "
\e$B!N
\e(B"
47 (defvar its-han-kata-close-bracket "
\e(I#
\e(B" "*]") ; "
\e$B!O
\e(B"
48 (defvar its-han-kata-horizontal "
\e(I0
\e(B" "*-") ; "
\e$B!]
\e(B"
50 (define-its-state-machine its-han-kata-map
51 "roma-han-kata" "
\e(I11
\e(B" Japanese
52 "Map for Romaji-Hankaku-Katakana translation. (Japanese)"
54 (defconst its-hankaku-escape "~") ;; Escape character to Hankaku inputs
56 (its-defrule-select-mode-temporally "q" downcase)
62 ;;; kkk
\e$B%C
\e(Bk DING!
64 (its-defrule "tch" "
\e(I/
\e(B" -2)
66 ;;;
\e$B!V%s!W$NF~NO
\e(B
68 (dolist (q1 '("b" "m" "p"))
69 (its-defrule (concat "m" q1) "
\e(I]
\e(B" -1))
71 (its-defrule* "n" "
\e(I]
\e(B")
72 (its-defrule "n'" "
\e(I]
\e(B")
73 (its-defrule "N" "
\e(I]
\e(B")
76 (its-defrule (concat small "a") "
\e(I'
\e(B")
77 (its-defrule (concat small "i") "
\e(I(
\e(B")
78 (its-defrule (concat small "u") "
\e(I)
\e(B")
79 (its-defrule (concat small "e") "
\e(I*
\e(B")
80 (its-defrule (concat small "o") "
\e(I+
\e(B")
81 (its-defrule (concat small "ya") "
\e(I,
\e(B")
82 (its-defrule (concat small "yu") "
\e(I-
\e(B")
83 (its-defrule (concat small "yo") "
\e(I.
\e(B")
84 (its-defrule (concat small "tu") "
\e(I/
\e(B")
85 (its-defrule (concat small "tsu") "
\e(I/
\e(B")
86 (its-defrule (concat small "wa") "
\e(I\
\e(B")
89 (its-defrule "a" "
\e(I1
\e(B")
90 (its-defrule "i" "
\e(I2
\e(B")
91 (its-defrule "u" "
\e(I3
\e(B")
92 (its-defrule "e" "
\e(I4
\e(B")
93 (its-defrule "o" "
\e(I5
\e(B")
95 (dolist (k '(("ka" "
\e(I6
\e(B") ("ki" "
\e(I7
\e(B") ("ku" "
\e(I8
\e(B") ("ke" "
\e(I9
\e(B") ("ko" "
\e(I:
\e(B")
96 ("kya" "
\e(I7,
\e(B") ("kyu" "
\e(I7-
\e(B") ("kye" "
\e(I7*
\e(B") ("kyo" "
\e(I7.
\e(B")))
97 (its-defrule (car k) (cadr k))
98 (its-defrule (concat "k" (car k)) (concat "
\e(I/
\e(B" (cadr k))))
99 (its-defoutput "kk" "
\e(I/
\e(Bk")
100 (its-defoutput "kky" "
\e(I/
\e(Bky")
102 (dolist (s '(("sa" "
\e(I;
\e(B") ("si" "
\e(I<
\e(B") ("su" "
\e(I=
\e(B") ("se" "
\e(I>
\e(B") ("so" "
\e(I?
\e(B")
103 ("sya" "
\e(I<,
\e(B") ("syu" "
\e(I<-
\e(B") ("sye" "
\e(I<*
\e(B") ("syo" "
\e(I<.
\e(B")
104 ("sha" "
\e(I<,
\e(B") ("shi" "
\e(I<
\e(B") ("shu" "
\e(I<-
\e(B") ("she" "
\e(I<*
\e(B")
105 ("sho" "
\e(I<.
\e(B")))
106 (its-defrule (car s) (cadr s))
107 (its-defrule (concat "s" (car s)) (concat "
\e(I/
\e(B" (cadr s))))
108 (its-defoutput "ss" "
\e(I/
\e(Bs")
109 (its-defoutput "ssy" "
\e(I/
\e(Bsy")
110 (its-defoutput "ssh" "
\e(I/
\e(Bsh")
112 (dolist (T '(("ta" "
\e(I@
\e(B") ("ti" "
\e(IA
\e(B") ("tu" "
\e(IB
\e(B") ("te" "
\e(IC
\e(B") ("to" "
\e(ID
\e(B")
113 ("tya" "
\e(IA,
\e(B") ("tyi" "
\e(IC(
\e(B") ("tyu" "
\e(IA-
\e(B") ("tye" "
\e(IA*
\e(B")
114 ("tyo" "
\e(IA.
\e(B") ("tsu" "
\e(IB
\e(B")))
115 (its-defrule (car T) (cadr T))
116 (its-defrule (concat "t" (car T)) (concat "
\e(I/
\e(B" (cadr T))))
117 (its-defoutput "tt" "
\e(I/
\e(Bt")
118 (its-defoutput "tty" "
\e(I/
\e(Bty")
119 (its-defoutput "tts" "
\e(I/
\e(Bts")
121 (dolist (c '(("cha" "
\e(IA,
\e(B") ("chi" "
\e(IA
\e(B") ("chu" "
\e(IA-
\e(B")
122 ("che" "
\e(IA*
\e(B") ("cho" "
\e(IA.
\e(B")))
123 (its-defrule (car c) (cadr c))
124 (its-defrule (concat "c" (car c)) (concat "
\e(I/
\e(B" (cadr c))))
125 (its-defoutput "cc" "
\e(I/
\e(Bc")
126 (its-defoutput "cch" "
\e(I/
\e(Bch")
128 (dolist (h '(("ha" "
\e(IJ
\e(B") ("hi" "
\e(IK
\e(B") ("hu" "
\e(IL
\e(B") ("he" "
\e(IM
\e(B") ("ho" "
\e(IN
\e(B")
129 ("hya" "
\e(IK,
\e(B") ("hyu" "
\e(IK-
\e(B") ("hye" "
\e(IK*
\e(B") ("hyo" "
\e(IK.
\e(B")))
130 (its-defrule (car h) (cadr h))
131 (its-defrule (concat "h" (car h)) (concat "
\e(I/
\e(B" (cadr h))))
132 (its-defoutput "hh" "
\e(I/
\e(Bh")
133 (its-defoutput "hhy" "
\e(I/
\e(Bhy")
135 (dolist (f '(("fa" "
\e(IL'
\e(B") ("fi" "
\e(IL(
\e(B") ("fu" "
\e(IL
\e(B") ("fe" "
\e(IL*
\e(B")
136 ("fo" "
\e(IL+
\e(B")))
137 (its-defrule (car f) (cadr f))
138 (its-defrule (concat "f" (car f)) (concat "
\e(I/
\e(B" (cadr f))))
139 (its-defoutput "ff" "
\e(I/
\e(Bf")
141 (dolist (r '(("ra" "
\e(IW
\e(B") ("ri" "
\e(IX
\e(B") ("ru" "
\e(IY
\e(B") ("re" "
\e(IZ
\e(B") ("ro" "
\e(I[
\e(B")
142 ("rya" "
\e(IX,
\e(B") ("ryu" "
\e(IX-
\e(B") ("rye" "
\e(IX*
\e(B") ("ryo" "
\e(IX.
\e(B")))
143 (its-defrule (car r) (cadr r))
144 (its-defrule (concat "r" (car r)) (concat "
\e(I/
\e(B" (cadr r))))
145 (its-defoutput "rr" "
\e(I/
\e(Br")
146 (its-defoutput "rry" "
\e(I/
\e(Bry")
148 (dolist (l '(("la" "
\e(IW
\e(B") ("li" "
\e(IX
\e(B") ("lu" "
\e(IY
\e(B") ("le" "
\e(IZ
\e(B") ("lo" "
\e(I[
\e(B")
149 ("lya" "
\e(IX,
\e(B") ("lyu" "
\e(IX-
\e(B") ("lye" "
\e(IX*
\e(B") ("lyo" "
\e(IX.
\e(B")))
150 (its-defrule (car l) (cadr l))
151 (its-defrule (concat "l" (car l)) (concat "
\e(I/
\e(B" (cadr l))))
152 (its-defoutput "ll" "
\e(I/
\e(Bl")
153 (its-defoutput "lly" "
\e(I/
\e(Bly")
155 (dolist (g '(("ga" "
\e(I6^
\e(B") ("gi" "
\e(I7^
\e(B") ("gu" "
\e(I8^
\e(B") ("ge" "
\e(I9^
\e(B") ("go" "
\e(I:^
\e(B")
156 ("gya" "
\e(I7^,
\e(B") ("gyu" "
\e(I7^-
\e(B") ("gye" "
\e(I7^*
\e(B") ("gyo" "
\e(I7^.
\e(B")))
157 (its-defrule (car g) (cadr g))
158 (its-defrule (concat "g" (car g)) (concat "
\e(I/
\e(B" (cadr g))))
159 (its-defoutput "gg" "
\e(I/
\e(Bg")
160 (its-defoutput "ggy" "
\e(I/
\e(Bgy")
162 (dolist (z '(("za" "
\e(I;^
\e(B") ("zi" "
\e(I<^
\e(B") ("zu" "
\e(I=^
\e(B") ("ze" "
\e(I>^
\e(B") ("zo" "
\e(I?^
\e(B")
163 ("zya" "
\e(I<^,
\e(B") ("zyu" "
\e(I<^-
\e(B") ("zye" "
\e(I<^*
\e(B") ("zyo" "
\e(I<^.
\e(B")))
164 (its-defrule (car z) (cadr z))
165 (its-defrule (concat "z" (car z)) (concat "
\e(I/
\e(B" (cadr z))))
166 (its-defoutput "zz" "
\e(I/
\e(Bz")
167 (its-defoutput "zzy" "
\e(I/
\e(Bzy")
169 (dolist (j '(("ja" "
\e(I<^,
\e(B") ("ji" "
\e(I<^
\e(B") ("ju" "
\e(I<^-
\e(B") ("je" "
\e(I<^*
\e(B")
170 ("jo" "
\e(I<^.
\e(B") ("jya" "
\e(I<^,
\e(B") ("jyu" "
\e(I<^-
\e(B") ("jye" "
\e(I<^*
\e(B")
171 ("jyo" "
\e(I<^.
\e(B")))
172 (its-defrule (car j) (cadr j))
173 (its-defrule (concat "j" (car j)) (concat "
\e(I/
\e(B" (cadr j))))
174 (its-defoutput "jj" "
\e(I/
\e(Bj")
175 (its-defoutput "jjy" "
\e(I/
\e(Bjy")
177 (dolist (d '(("da" "
\e(I@^
\e(B") ("di" "
\e(IA^
\e(B") ("du" "
\e(IB^
\e(B") ("de" "
\e(IC^
\e(B") ("do" "
\e(ID^
\e(B")
178 ("dya" "
\e(IA^,
\e(B") ("dyi" "
\e(IC^(
\e(B") ("dyu" "
\e(IA^-
\e(B") ("dye" "
\e(IA^*
\e(B")
179 ("dyo" "
\e(IA^.
\e(B")))
180 (its-defrule (car d) (cadr d))
181 (its-defrule (concat "d" (car d)) (concat "
\e(I/
\e(B" (cadr d))))
182 (its-defoutput "dd" "
\e(I/
\e(Bd")
183 (its-defoutput "ddy" "
\e(I/
\e(Bdy")
185 (dolist (b '(("ba" "
\e(IJ^
\e(B") ("bi" "
\e(IK^
\e(B") ("bu" "
\e(IL^
\e(B") ("be" "
\e(IM^
\e(B") ("bo" "
\e(IN^
\e(B")
186 ("bya" "
\e(IK^,
\e(B") ("byu" "
\e(IK^-
\e(B") ("bye" "
\e(IK^*
\e(B") ("byo" "
\e(IK^.
\e(B")))
187 (its-defrule (car b) (cadr b))
188 (its-defrule (concat "b" (car b)) (concat "
\e(I/
\e(B" (cadr b))))
189 (its-defoutput "bb" "
\e(I/
\e(Bb")
190 (its-defoutput "bby" "
\e(I/
\e(Bby")
192 (dolist (p '(("pa" "
\e(IJ_
\e(B") ("pi" "
\e(IK_
\e(B") ("pu" "
\e(IL_
\e(B") ("pe" "
\e(IM_
\e(B") ("po" "
\e(IN_
\e(B")
193 ("pya" "
\e(IK_,
\e(B") ("pyu" "
\e(IK_-
\e(B") ("pye" "
\e(IK_*
\e(B") ("pyo" "
\e(IK_.
\e(B")))
194 (its-defrule (car p) (cadr p))
195 (its-defrule (concat "p" (car p)) (concat "
\e(I/
\e(B" (cadr p))))
196 (its-defoutput "pp" "
\e(I/
\e(Bp")
197 (its-defoutput "ppy" "
\e(I/
\e(Bpy")
199 (dolist (v '(("va" "
\e(I3^'
\e(B") ("vi" "
\e(I3^(
\e(B") ("vu" "
\e(I3^
\e(B") ("ve" "
\e(I3^*
\e(B")
200 ("vo" "
\e(I3^+
\e(B")))
201 (its-defrule (car v) (cadr v))
202 (its-defrule (concat "v" (car v)) (concat "
\e(I/
\e(B" (cadr v))))
203 (its-defoutput "vv" "
\e(I/
\e(Bv")
205 (its-defrule "ma" "
\e(IO
\e(B")
206 (its-defrule "mi" "
\e(IP
\e(B")
207 (its-defrule "mu" "
\e(IQ
\e(B")
208 (its-defrule "me" "
\e(IR
\e(B")
209 (its-defrule "mo" "
\e(IS
\e(B")
210 (its-defrule "mya" "
\e(IP,
\e(B")
211 (its-defrule "myu" "
\e(IP-
\e(B")
212 (its-defrule "mye" "
\e(IP*
\e(B")
213 (its-defrule "myo" "
\e(IP.
\e(B")
214 (its-defrule "ya" "
\e(IT
\e(B")
215 (its-defrule "yi" "
\e(I2
\e(B")
216 (its-defrule "yu" "
\e(IU
\e(B")
217 (its-defrule "yo" "
\e(IV
\e(B")
218 (its-defrule "ye" "
\e(I2*
\e(B")
219 (its-defrule "wa" "
\e(I\
\e(B")
220 (its-defrule "wi" "
\e(I(
\e(B")
221 (its-defrule "wu" "
\e(I3
\e(B")
222 (its-defrule "we" "
\e(I*
\e(B")
223 (its-defrule "wo" "
\e(I&
\e(B")
225 (its-defrule "kwa" "
\e(I8\
\e(B")
226 (its-defrule "kwi" "
\e(I8(
\e(B")
227 (its-defrule "kwu" "
\e(I8
\e(B")
228 (its-defrule "kwe" "
\e(I8*
\e(B")
229 (its-defrule "kwo" "
\e(I8+
\e(B")
230 (its-defrule "gwa" "
\e(I8^\
\e(B")
231 (its-defrule "gwi" "
\e(I8^(
\e(B")
232 (its-defrule "gwu" "
\e(I8^
\e(B")
233 (its-defrule "gwe" "
\e(I8^*
\e(B")
234 (its-defrule "gwo" "
\e(I8^+
\e(B")
235 (its-defrule "tsa" "
\e(IB'
\e(B")
236 (its-defrule "tsi" "
\e(IB(
\e(B")
237 (its-defrule "tse" "
\e(IB*
\e(B")
238 (its-defrule "tso" "
\e(IB+
\e(B")
240 (its-defrule "na" "
\e(IE
\e(B")
241 (its-defrule "ni" "
\e(IF
\e(B")
242 (its-defrule "nu" "
\e(IG
\e(B")
243 (its-defrule "ne" "
\e(IH
\e(B")
244 (its-defrule "no" "
\e(II
\e(B")
245 (its-defrule "nya" "
\e(IF,
\e(B")
246 (its-defrule "nyu" "
\e(IF-
\e(B")
247 (its-defrule "nye" "
\e(IF*
\e(B")
248 (its-defrule "nyo" "
\e(IF.
\e(B")
250 (its-defrule "xti" "
\e(IC(
\e(B")
251 (its-defrule "xdi" "
\e(IC^(
\e(B")
252 (its-defrule "xdu" "
\e(ID^)
\e(B")
253 (its-defrule "xde" "
\e(IC^*
\e(B")
254 (its-defrule "xdo" "
\e(ID^+
\e(B")
255 (its-defrule "xwi" "
\e(I3(
\e(B")
256 (its-defrule "xwe" "
\e(I3*
\e(B")
257 (its-defrule "xwo" "
\e(I3+
\e(B")
263 (dolist (digit '( "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" ))
264 (its-defrule (concat its-hankaku-escape digit) digit))
266 (dolist (symbol '( " " "!" "@" "#" "$" "%" "^" "&" "*" "(" ")"
267 "-" "=" "`" "\\" "|" "_" "+" "~" "[" "]" "{" "}"
268 ":" ";" "\"" "'" "<" ">" "?" "/" "," "." ))
269 (its-defrule (concat its-hankaku-escape symbol) symbol))
271 (dolist (downcase '("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n"
272 "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z"))
273 (its-defrule (concat its-hankaku-escape downcase) downcase))
275 (dolist (upcase '("A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N"
276 "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z"))
277 (its-defrule (concat its-hankaku-escape upcase) upcase)))
279 (define-its-state-machine-append its-han-kata-map
280 (if its-han-kata-enable-double-n
281 (its-defrule "nn" "
\e(I]
\e(B"))
283 (its-defrule "-" its-han-kata-horizontal)
284 (its-defrule "[" its-han-kata-open-bracket)
285 (its-defrule "]" its-han-kata-close-bracket)
286 (its-defrule "." its-han-kata-period)
287 (its-defrule "," its-han-kata-comma)
290 (provide 'its/hankata)
291 ;;; its/kata.el ends here.