1 // -*- Coding: utf-8; -*-
2 //--------------------------------------------------------------------
3 // Copyright (c) 1999-2002, International Business Machines
4 // Corporation and others. All Rights Reserved.
5 //--------------------------------------------------------------------
6 // THIS IS A MACHINE-GENERATED FILE
7 // Tool: dumpicurules.bat
8 // Source: ../../../impl/data/Transliterator_Latin_Katakana.txt
9 // Date: Sat Jul 27 10:31:07 2002
10 //--------------------------------------------------------------------
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18 //--------------------------------------------------------------------
20 // note: a global filter is more efficient, but MUST include all source chars
21 //:: [\\u0000-\u007E \u3001\u3002 \u3099-\u309C \u30A1-\u30FC \uFF61-\uFF9F [:Latin:][:Katakana:] [:nonspacing mark:]] ;
22 // MINIMAL FILTER GENERATED FOR: Latin-Katakana
23 //## WARNING -- must add width filter, both here and below!!! ###
24 ":: [[\u1100-\u1112\u111A\u1121\u1160-\u1175\u11AA\u11AC-\u11AD\u11B0-\u11B5\u2190-\u2193\u2502\u25A0\u25CB\u3000-\u3002\u300C-\u300D\u3099-\u309A\u30A1-\u30ED\u30EF\u30F2-\u30F4\u30F7\u30FA-\u30FC\uFF01-\uFF5E\uFFE0-\uFFE6][',.A-Za-z~\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0-\u01A1\u01AF-\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01ED\u01F0\u01F4-\u01F5\u01F8-\u021B\u021E-\u021F\u0226-\u0233\u0304\u04E2-\u04E3\u04EE-\u04EF\u1E00-\u1E99\u1EA0-\u1EF9\u1FB1\u1FB9\u1FD1\u1FD9\u1FE1\u1FE9\u212A-\u212B]] ;"
26 ":: [:Latin:] fullwidth-halfwidth ();"
28 ":: Lower ();" // whenever transliterating from cased to uncased script, include this
29 // :: NFD () ; # this would catch the odd cases where a lowercase is not in NFD, but none are important for Japanese
31 // Uses modified Hepburn. Small changes to make unambiguous.
33 // | Kunrei-shiki: Hepburn/MHepburn
34 // | ------------------------------
52 // | For foreign words:
53 // | -----------------
74 // Most small forms are generated, but if necessary
75 // explicit small forms are given with ~a, ~ya, etc.
77 //------------------------------------------------------
81 "$consonant = [bcdfghjklmnpqrstvwxyz] ;"
84 // Variables used for doubled-consonants with tsu
86 "$kana = [\u3041-\u3094] ;"
88 "$voice = [\u3099\u309B];"
89 "$semivoice = [\u309A\u309C];"
91 "$k_start = [カキクケコかきくけこ] ;"
93 "$s_start = [サシスセソさしすせそ] ;"
95 "$j_start = [シし] $voice ;"
97 "$t_start = [タチツテトたちつてと] ;"
99 "$n_start = [ナニヌネノンなにぬねの] ;"
101 "$h_start = [ハヒヘホはひへほ] ;"
104 "$m_start = [マミムメモまみむめも] ;"
106 "$y_start = [ヤユヨやゆよ] ;"
108 "$r_start = [ラリルレロらりるれろ] ;"
110 "$w_start = [ワヰヱヲわゐゑを] ;"
112 "$v_start = [ワヰヱヲ]゙ ;"
114 // if ン is followed by $n_quoter, then it needs an
115 // apostrophe after its romaji form to disambiguate it.
116 // e.g., ン ア ! = ナ, so represent as "n'a", not "na".
118 "$n_quoter = [ア イ ウ エ オ ナ ニ ヌ ネ ノ ヤ ユ ヨ ン] ;"
120 "$small_y = [ャィュェョ] ;"
122 "$iteration = \u309D ;"
124 //------------------------------------------------------
131 // ' ' } [a-z] > ; # delete spaces before latin
132 // ' ' < [^' '\u30A0-\u30ff] {} ['\u30A0-\u30ff] ; #insert spaces before hiragana
135 // Copy previous letter & marks
138 // | $1 $1 < ($kana [[:M:]$voice$semivoice]?) $iteration
140 // Specials for katakana -- not shared with hiragana
149 // ~~~ begin shared rules ~~~
163 "b | '~' < ヒ ゙} $small_y ;"
164 "by } $vowel > ビ | '~y' ;"
182 "dji'~i' < ヂィ ;" // liu
187 "dj } $vowel > ヂ | '~y' ;"
189 // TODO: QUESTION: use ĵĴżŻ instead of dj, dz
192 "chi'~i' < チィ ;" // liu
197 "ch } $vowel > チ | '~y' ;"
201 "g | '~' < ギ} $small_y ;"
202 "gy } $vowel > ギ | '~y' ;"
212 // j } $vowel > ジ | '~y' ;
215 "ji'~i' < ジィ ;" // liu
221 "k | '~' < キ} $small_y ;"
222 "ky } $vowel > キ | '~y' ;"
230 "m | '~' < ミ} $small_y ;"
231 "my } $vowel > ミ | '~y' ;"
241 "n | '~' < ニ } $small_y ;"
242 "ny } $vowel > ニ | '~y' ;"
252 "p | '~' < ピ } $small_y ;"
253 "py } $vowel > ピ | '~y' ;"
261 "h | '~' < ヒ } $small_y ;"
262 "hy } $vowel > ヒ | '~y' ;"
270 // f | '~' < フ } $small_y ;
271 // f } $vowel > フ | '~' ;
279 "r | '~' < リ } $small_y ;"
280 "ry } $vowel > リ | '~y' ;"
301 "shi'~i' < シィ ;" // liu
306 "sh } $vowel > シ | '~y' ;"
316 // v } $vowel > ヴ | '~' ;
318 //'v~a' < ヴァ ; # liu
319 //'v~i' < ヴィ ; # liu
320 //'v~e' < ヴェ ; # liu
321 //'v~o' < ヴォ ; # liu
326 // w } $vowel > ウ | '~' ;
348 "j } j <> ッ } $j_start ;"
349 "b } b <> ッ } [$h_start$f_start] $voice;"
350 "d } d <> ッ } $t_start $voice;"
351 "g } g <> ッ } $k_start $voice;"
352 "p } p <> ッ } [$h_start$f_start] $semivoice;"
353 // v } v <> ッ } [ワヰウヱヲう] $voice ;
354 "z } z <> ッ } $s_start $voice;"
355 "v } v <> ッ } $v_start;"
359 "k } k <> ッ } $k_start ;"
360 "m } m <> ッ } $m_start ;"
361 "n } n <> ッ } $n_start ;"
362 "h } h <> ッ } $h_start ;"
363 "f } f <> ッ } $f_start ;"
364 "r } r <> ッ } $r_start ;"
365 "t } t <> ッ } $t_start ;"
366 "s } s <> ッ } $s_start ;"
368 "w } w <> ッ } $w_start;"
369 "y } y <> ッ } $y_start;"
381 // prolonged vowel mark. this indicates a doubling of
382 // the preceding vowel sound
408 // TODO: make more accurate
410 "j $1 < sh (y* $vowel) {ヽ$voice ;"
411 "dj $1 < ch (y* $vowel) {ヽ$voice ;"
412 "dz $1 < ts (y* $vowel) {ヽ$voice ;"
414 "g $1 < k (y* $vowel) {ヽ$voice ;"
415 "z $1 < s (y* $vowel) {ヽ$voice ;"
416 "d $1 < t (y* $vowel) {ヽ$voice ;"
417 "h $1 < b (y* $vowel) {ヽ$voice ;"
418 "v $1 < w (y* $vowel) {ヽ$voice ;"
420 "sh $1 < sh (y* $vowel) {ヽ$voice ;"
421 "j $1 < j (y* $vowel) {ヽ$voice ;"
422 "ch $1 < ch (y* $vowel) {ヽ$voice ;"
423 "dj $1 < dj(y* $vowel) {ヽ$voice ;"
424 "ts $1 < ts (y* $vowel) {ヽ$voice ;"
425 "dz $1 < dz (y* $vowel) {ヽ$voice ;"
427 "$1 < ($consonant y* $vowel) {ヽ$voice? ;"
428 "$1 < (.) {ヽ $voice? ;" // otherwise repeat last character
429 "< ヽ $voice? ;" // delete if no characters found
431 // h- rule: lengthens vowel if not followed by a vowel
435 // one-way latin- > kana rules. these do not occur in
436 // well-formed romaji representing actual japanese text.
437 // their purpose is to make all romaji map to kana of
440 // the following are not really necessary, but produce
441 // slightly more natural results.
452 // isolated consonants listed here so as not to mask
453 // longer rules above.
465 "n'' < ン } $n_quoter ;"
485 // simple substitutions using backup
492 // ~~~ END shared rules ~~~
494 //------------------------------------------------------
497 "'~' > ;" // delete stray tildes between letters
498 "[:Katakana:] { '' } [:Latin:] > ;" // delete stray quotes between letters
499 // [\u02BE[:Nonspacing Mark:]-[\u3099-\u309C]] > ; # delete any non-spacing marks that we didn't use
502 ":: ([:Katakana:] halfwidth-fullwidth);"
504 // note: a global filter is more efficient, but MUST include all source chars!!
505 //:: ([\\u0000-\u007E \u3001\u3002 \u3099-\u309C \u30A1-\u30FC \uFF61-\uFF9F [:Latin:][:Katakana:] [:nonspacing mark:]]);
506 // MINIMAL FILTER GENERATED FOR: Latin-Katakana BACKWARD
507 ":: ( [[\\\ -~\u00A2-\u00A3\u00A5-\u00A6\u00AC\u0304\u20A9\uFF61-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE8-\uFFEE][~\u3001-\u3002\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070-\u3071\u3073-\u3074\u3076-\u3077\u3079-\u307A\u307C-\u307D\u3094\u3099-\u309B\u309E\u30A1-\u30FA\u30FC-\u30FE]] ) ;"