corvus-skk: installl and configuration

概要

corvus-skkをインストールしてazikで入力できるようにする。

azikについて

http://hp.vector.co.jp/authors/VA002116/azik/azikinfo.htm

install

以下のページを参照。

http://code.google.com/p/corvus-skk/

config

どっかにazikの設定ファイルが落ちていないかと探したのだが、残念ながら見つからず。

仕方がないので、自分で書くことに。

/AppData/Roaming/CorvusSKK/confkana.txt

を編集する。

全部直打ちするのがいやだったので、config file生成スクリプトを書いたが、思いのほか大変だった(文字入力的な意味で)。

適当に書き始めたのがいけなかったか。

ghc –make -o a.out azik.hs
./a.out > azik.txt

(azik.hsのソースは下)

azik.txtとsymbol.txt(数字と記号の変換表)のencodingを

little-endian utf-16 with CRLF, CR Line terminators

にする。ようはemacsで開いて Ctr-x f して utf-16-le-dos にすればよい。

その後、2つのファイルを結合。

cat azik.txt > confkana.txt
cat symbol.txt >> confkana.txt

あとはできたconfkana.txtを /AppData/Roaming/CorvusSKK/ においておけばOk

(変換表を再読み込みさせるために、IMEを切り替える必要がある?)。

azik.hsは基本的なローマ字ひらがな変換を実装して、azikの変換規則はローマ字上での変換として実装している(アルファベットのままのほうが扱いやすいため)。

ローマ字ひらがな変換表を書くのが面倒だったのと、特殊変換の数が多いので、変換規則を直打ちしたほうが早かったかもしれない。

symbol.txt

z               0
z,  ‥   ‥   ‥   0
z.  …   …   …   0
z/  ・   ・   ・   0
z[  『   『   『   0
z]  』   』   』   0
z;  ;   ;   ;   0
z:  :   :   :   0

xxh ← ← ← 0 xxj ↓ ↓ ↓ 0 xxk ↑ ↑ ↑ 0 xxl → → → 0 xx’ ‘ ’ ‘ 0

0 0 0 0 0 1 1 1 1 0 2 2 2 2 0 3 3 3 3 0 4 4 4 4 0 5 5 5 5 0 6 6 6 6 0 7 7 7 7 0 8 8 8 8 0 9 9 9 9 0 0 ! ! ! ! 0 “ ” ” ” 0

# # # 0

$ $ $ $ 0 % % % % 0 & & & & 0 ‘ ’ ’ ’ 0 ( ( ( ( 0 ) ) ) ) 0 * * * * 0 + + + + 0 , 、 、 、 0 - ー ー ー 0 . 。 。 。 0 / / / / 0 < < < < 0 = = = = 0 > > > > 0 ? ? ? ? 0 @ @ @ @ 0 [ 「 「 「 0 \ \ \ \ 0 ] 」 」 」 0 ^ ^ ^ ^ 0 _ _ _ _ 0 ‘ ‘ 0 { { { { 0 | | | | 0 } } } } 0 ~ ~ ~ ~ 0

azik.hs

import Data.Maybe (isJust, fromJust)
import Data.List (intercalate, sortBy, groupBy, (\))
import Data.Ord (comparing)

convert _ [] = [] convert t (c:cs) | isJust r = fromJust r ++ convert t cs where r = lookup t convert t (b:c:cs) | isJust r = fromJust r ++ convert t cs where r = lookup [b,c] t convert t (a:b:c:cs) | isJust r = fromJust r ++ convert t cs where r = lookup [a,b,c] t convert t (c:cs) = convert t cs

zenkakuHiragana = map ((a,b,,) -> (a,b)) table zenkakuKatakana = map ((a,,b,) -> (a,b)) table hankakuKatakana = map ((a,,,b) -> (a,b)) table

vowel = “aiueo” isVowel c = elem c vowel extendVowel = vowel ++ map fst syllabicTable ++ map fst doubleVowelTable isExtendVowel c = elem c extendVowel consonant = “kstnhmyrwgzdbp” isConsonant c = elem c consonant contractedConsonant = map fst contractedTable isContractedConsonant c = elem c contractedConsonant

syllabic [] = [] syllabic [a] = [a] syllabic (a:b:cs) | isVowel a = a:syllabic (b:cs) syllabic (a:b:cs) | isJust r = a:fromJust r ++ syllabic cs | otherwise = a:syllabic (b:cs) where r = lookup b syllabicTable syllabicTable = [(‘z’, “ann”), (‘n’, “ann”), (‘k’, “inn”), (‘j’, “unn”), (’d’, “enn”), (‘l’, “onn”)]

doubleVowel [] = [] doubleVowel [a] = [a] doubleVowel (a:b:cs) | isVowel a = a:doubleVowel (b:cs) doubleVowel (a:b:cs) | isJust r = a:fromJust r ++ doubleVowel cs | otherwise = a:doubleVowel (b:cs) where r = lookup b doubleVowelTable doubleVowelTable = [(’\“, “ai”), (‘h’, “uu”), (‘w’, “ei”), (‘p’, “ou”)]

contracted [] = [] contracted [a] = [a] contracted (a:b:cs) | isJust r && isExtendVowel b = fromJust r ++ [b] ++ contracted cs where r = lookup a contractedTable contracted (a:b:c:cs) | isConsonant a && (b == ‘y’ || b == ‘g’) && isExtendVowel c = a:“ily” ++ c:contracted cs contracted (a:cs) = a:contracted cs contractedTable = [(‘x’, “sily”), (‘c’, “tily”), (‘j’, “zily”)]

smallChar [] = [] smallChar (a:b:c:cs) | [a,b] == “xx” && isVowel c = “l” ++ c:smallChar cs | [a,b] == “xy” && isVowel c = “ly” ++ c:smallChar cs smallChar (a:cs) = a:smallChar cs

normalize = syllabic.doubleVowel.contracted.smallChar

ruleToStr (cs,as) = intercalate “\t” $ cs: map (\t-> convert t as) [zenkakuHiragana, zenkakuKatakana, hankakuKatakana] ++ [“0”]

– sort must be stable! rules = map last.groupBy (\a b -> fst a == fst b).sortBy (comparing fst) $ basicRule ++ contractedRule ++ smallRule ++ specialRule

basicRule = map (\x -> (x, normalize x)) $ [[v] | v <- vowel] ++ [ | c <- consonant, v <- extendVowel] contractedRule = map (\x -> (x, normalize x)) $ [| c <- consonant \ “yw” , y <- “yg”, v <-extendVowel] ++ [| c <- contractedConsonant, v <-extendVowel] smallRule = map (\x -> (x, normalize x)) $ [“xx” ++ [v]| v <- vowel] ++ [“xy” ++ [v]| v <- vowel]

main = mapM_ (putStrLn.ruleToStr) rules

specialRule = [ (“;”, “ltu”), (”:“, “-”), (“fa”, “hula”), (“fi”, “huli”), (“fu”, “hu”), (“fe”, “hule”), (“fo”, “hulo”), (“fz”, “hulann”), (“fn”, “hulann”), (“fk”, “hulinn”), (“fj”, “hunn”), (“fd”, “hulenn”), (“fl”, “hulonn”), (“f\‘“, “hulai”), (“fh”, “huu”), (“fw”, “hulei”), (“fp”, “hulo-”), (“wi”, “uli”), (“we”, “ule”), (“wk”, “ulinn”), (“wd”, “ulenn”), (“wl”, “ulonn”), (“w\‘“, “wai”), (“wp”, “wolo-”), (“kf”, “ki”), (“jf”, “zilyu”), (“hf”, “hu”), (“yf”, “yu”), (“mf”, “mu”), (“nf”, “nu”), (“df”, “de”), (“cf”, “tile”), (“pf”, “ponn”), (“wso”, “ulo”), (“tgi”, “teli”), (“tgu”, “tolu”), (“dci”, “deli”), (“dcu”, “dolu”), (“wf”, “wai”), (“sf”, “sai”), (“ss”, “sei”), (“zc”, “za”), (“zv”, “zai”), (“zf”, “ze”), (“zx”, “zei”), (“kt”, “koto”), (“st”, “sita”), (“tt”, “tati”), (“ht”, “hito”), (“wt”, “wata”), (“mn”, “mono”), (“ms”, “masu”), (“ds”, “desu”), (“km”, “kamo”), (“tm”, “tame”), (“dm”, “demo”), (“kr”, “kara”), (“sr”, “suru”), (“tr”, “tara”), (“nr”, “naru”), (“yr”, “yoru”), (“rr”, “rare”), (“zr”, “zaru”), (“mt”, “mata”), (“tb”, “tabi”), (“nb”, “neba”), (“bt”, “bito”), (“gr”, “gara”), (“gt”, “goto”), (“nt”, “niti”), (“dt”, “dati”), (“wr”, “ware”), (“nn”, “nn”) ] table = [ (“a”, “あ”, “ア”, “ア”), (“i”, “い”, “イ”, “イ”), (“u”, “う”, “ウ”, “ウ”), (“e”, “え”, “エ”, “エ”), (“o”, “お”, “オ”, “オ”), (“ka”, “か”, “カ”, “カ”), (“ki”, “き”, “キ”, “キ”), (“ku”, “く”, “ク”, “ク”), (“ke”, “け”, “ケ”, “ケ”), (“ko”, “こ”, “コ”, “コ”), (“sa”, “さ”, “サ”, “サ”), (“si”, “し”, “シ”, “シ”), (“su”, “す”, “ス”, “ス”), (“se”, “せ”, “セ”, “セ”), (“so”, “そ”, “ソ”, “ソ”), (“ta”, “た”, “タ”, “タ”), (“ti”, “ち”, “チ”, “チ”), (“tu”, “つ”, “ツ”, “ツ”), (“te”, “て”, “テ”, “テ”), (“to”, “と”, “ト”, “ト”), (“na”, “な”, “ナ”, “ナ”), (“ni”, “に”, “ニ”, “ニ”), (“nu”, “ぬ”, “ヌ”, “ヌ”), (“ne”, “ね”, “ネ”, “ネ”), (“no”, “の”, “ノ”, “ノ”), (“ha”, “は”, “ハ”, “ハ”), (“hi”, “ひ”, “ヒ”, “ヒ”), (“hu”, “ふ”, “フ”, “フ”), (“he”, “へ”, “ヘ”, “ヘ”), (“ho”, “ほ”, “ホ”, “ホ”), (“ma”, “ま”, “マ”, “マ”), (“mi”, “み”, “ミ”, “ミ”), (“mu”, “む”, “ム”, “ム”), (“me”, “め”, “メ”, “メ”), (“mo”, “も”, “モ”, “モ”), (“ya”, “や”, “ヤ”, “ヤ”), (“yu”, “ゆ”, “ユ”, “ユ”), (“yo”, “よ”, “ヨ”, “ヨ”), (“ra”, “ら”, “ラ”, “ラ”), (“ri”, “り”, “リ”, “リ”), (“ru”, “る”, “ル”, “ル”), (“re”, “れ”, “レ”, “レ”), (“ro”, “ろ”, “ロ”, “ロ”), (“wa”, “わ”, “ワ”, “ワ”), (“wo”, “を”, “ヲ”, “ヲ”), (“nn”, “ん”, “ン”, “ン”), (“ga”, “が”, “ガ”, “ガ”), (“gi”, “ぎ”, “ギ”, “ギ”), (“gu”, “ぐ”, “グ”, “グ”), (“ge”, “げ”, “ゲ”, “ゲ”), (“go”, “ご”, “ゴ”, “ゴ”), (“za”, “ざ”, “ザ”, “ザ”), (“zi”, “じ”, “ジ”, “ジ”), (“zu”, “ず”, “ズ”, “ズ”), (“ze”, “ぜ”, “ゼ”, “ゼ”), (“zo”, “ぞ”, “ゾ”, “ゾ”), (“da”, “だ”, “ダ”, “ダ”), (“di”, “ぢ”, “ヂ”, “ヂ”), (“du”, “づ”, “ヅ”, “ヅ”), (“de”, “で”, “デ”, “デ”), (“do”, “ど”, “ド”, “ド”), (“ba”, “ば”, “バ”, “バ”), (“bi”, “び”, “ビ”, “ビ”), (“bu”, “ぶ”, “ブ”, “ブ”), (“be”, “べ”, “ベ”, “ベ”), (“bo”, “ぼ”, “ボ”, “ボ”), (“pa”, “ぱ”, “パ”, “パ”), (“pi”, “ぴ”, “ピ”, “ピ”), (“pu”, “ぷ”, “プ”, “プ”), (“pe”, “ぺ”, “ペ”, “ペ”), (“po”, “ぽ”, “ポ”, “ポ”), (“la”, “ぁ”, “ァ”, “ァ”), (“li”, “ぃ”, “ィ”, “ィ”), (“lu”, “ぅ”, “ゥ”, “ゥ”), (“le”, “ぇ”, “ェ”, “ェ”), (“lo”, “ぉ”, “ォ”, “ォ”), (“ltu”, “っ”, “ッ”, “ッ”), (“lya”, “ゃ”, “ャ”, “ャ”),(“lyi”, “ぃ”, “ィ”, “ィ”), (“lyu”, “ゅ”, “ゅ”, “ュ”), (“lye”, “ぇ”, “ェ”, “ェ”),(“lyo”, “ょ”, “ョ”, “ョ”), (“-”, “ー”, “ー”, “ー”) ]