diff --git a/scim-wnn/data/scim-wnn-def.rkt b/scim-wnn/data/scim-wnn-def.rkt new file mode 100644 index 0000000..98c0c05 --- /dev/null +++ b/scim-wnn/data/scim-wnn-def.rkt @@ -0,0 +1,332 @@ +# utf8 + +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 や +yi い +yu ゆ +ye いぇ +yo よ +ra ら +ri り +ru る +re れ +ro ろ +la ら +li り +lu る +le れ +lo ろ +wa わ +wi ゐ +wu う +we ゑ +wo を +nn ん +N ん +xa ぁ +xi ぃ +xu ぅ +xe ぇ +xo ぉ +xtu っ +xya ゃ +xyu ゅ +xyo ょ +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 ぽ +kya きゃ +kyi きぃ +kyu きゅ +kye きぇ +kyo きょ +sya しゃ +syi し +syu しゅ +sye しぇ +syo しょ +sha しゃ +shi し +shu しゅ +she しぇ +sho しょ +cha ちゃ +chi ち +chu ちゅ +che ちぇ +cho ちょ +tya ちゃ +tyi てぃ +tyu ちゅ +tye ちぇ +tyo ちょ +dya ぢゃ +dyi でぃ +dyu ぢゅ +dye ぢぇ +dyo ぢょ +va ヴぁ +vi ヴぃ +vu ヴ +ve ヴぇ +vo ヴぉ +zya じゃ +zyi じぃ +zyu じゅ +zye じぇ +zyo じょ +ja じゃ +ji じ +ju じゅ +je じぇ +jo じょ +fa ふぁ +fi ふぃ +fu ふ +fe ふぇ +fo ふぉ +hya ひゃ +hyi ひぃ +hyu ひゅ +hye ひぇ +hyo ひょ +rya りゃ +ryi りぃ +ryu りゅ +rye りぇ +ryo りょ +nya にゃ +nyi にぃ +nyu にゅ +nye にぇ +nyo にょ +gya ぎゃ +gyi ぎぃ +gyu ぎゅ +gye ぎぇ +gyo ぎょ +bya びゃ +byi びぃ +byu びゅ +bye びぇ +byo びょ +pya ぴゃ +pyi ぴぃ +pyu ぴゅ +pye ぴぇ +pyo ぴょ +mya みゃ +myi みぃ +myu みゅ +mye みぇ +myo みょ +Za a +Zb b +Zc c +Zd d +Ze e +Zf f +Zg g +Zh h +Zi i +Zj j +Zk k +Zl l +Zm m +Zn n +Zo o +Zp p +Zq q +Zr r +Zs s +Zt t +Zu u +Zv v +Zw w +Zx x +Zy y +Zz z +ZA A +ZB B +ZC C +ZD D +ZE E +ZF F +ZG G +ZH H +ZI I +ZJ J +ZK K +ZL L +ZM M +ZN N +ZO O +ZP P +ZQ Q +ZR R +ZS S +ZT T +ZU U +ZV V +ZW W +ZX X +ZY Y +ZZ Z +Z1 1 +Z2 2 +Z3 3 +Z4 4 +Z5 5 +Z6 6 +Z7 7 +Z8 8 +Z9 9 +Z0 0 + +Z^ ^ +z1 ○ +z2 ▽ +z3 △ +z4 □ +z5 ◇ +z6 ☆ +z7 ◎ +z8 ¢ +z9 ♂ +z0 ♀ +z- ~ +z^ ★ +z\\ \ +z, ‥ +z. … +z/ ・ + +- ー +[ 「 +] 」 +. 。 +, 、 +{ { +} } +@ @ +: : +; ; +? ? +< < +> > +* * ++ + +/ / +\\ ¥ + +z- ~ +z[ 『 +z] 』 +z. … +z, ‥ +z{ 〔 +z} 〕 +z@ ▼ +z: ゜ +z; ゛ +z? ∞ +z< ≦ +z> ≧ +z* × +z+ ± +z/ ・ + +Z- - +Z[ [ +Z] ] +Z. . +Z, , +Z{ { +Z} } +Z@ @ +Z: : +Z; ; +Z? ? +Z< < +Z> > +Z* * +Z+ + +Z/ / +Z\\ ¥ +Z,   + +zb ° +zc 〇 +zd ゝ +zf 〃 +zg ‐ +zh ← +zj ↓ +zk ↑ +zl → +zm ″ +zn ′ +zp 〒 +zq 《 +zr 々 +zs ヽ +zt 〆 +zv ※ +zw 》 +zx :- diff --git a/scim-wnn/src/romkan.cpp b/scim-wnn/src/romkan.cpp index e027703..c08167c 100644 --- a/scim-wnn/src/romkan.cpp +++ b/scim-wnn/src/romkan.cpp @@ -53,6 +53,61 @@ /*! + \fn Romkan::loadTable(const String &filename) + */ +void Romkan::loadTable(const String &filename) +{ + RomkanTable.clear(); + keepTable.clear(); + + FILE *f = fopen(filename.c_str(),"r"); + if (!f) return; + + while(-1) { + char s[256]; + if(fgets(s,256,f) == NULL) break; + String k,r; + unsigned int i = 0; + for(;s[i];i ++) { + if (s[i] == ' ') { + if (k.size()) break; + else continue; + } + if (s[i] == '#') break; + if ((s[i] == '\\') && (s[i + 1] != 0)) { + i ++; + } + k += s[i]; + } + if ((!k.size()) || (s[i] == 0) || (s[i] == '#')) continue; + i ++; + for(;s[i];i ++) { + if ((s[i] == '#') || (s[i] == '\n')) break; + if (s[i] == ' ') { + if (r.size()) break; + else continue; + } + if ((s[i] == '\\') && (s[i + 1] != 0)) { + i ++; + } + r += s[i]; + } + if (!r.size()) continue; + RomkanTable.insert(pair(k,utf8_mbstowcs(r))); + + for(unsigned int j = k.length();j > 1;j --) { + String keep = k.substr(0,j - 1); + if ((keepTable.find(keep) == keepTable.end()) && (RomkanTable.find(keep) == RomkanTable.end())) { + keepTable.insert(keep); + } + } + } + fclose(f); + +} + + +/*! \fn Romkan::init() */ void Romkan::init() @@ -64,6 +119,12 @@ scim_string_to_key_list(key_wascii_mode, config->read(String(SCIM_CONFIG_WNN_KEY_ROMKAN_WASCIIMODE), String(SCIM_DEFAULT_WNN_KEY_ROMKAN_WASCIIMODE))); + String rk_table = config->read(SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE,String(SCIM_DEFAULT_WNN_ROMKAN_TABLE_FILE)); + + if (rk_table.size()) { + loadTable(rk_table); + return; + } RomkanTable.clear(); keepTable.clear(); @@ -83,7 +144,7 @@ } i += 2; } - + } @@ -409,3 +470,5 @@ } + + diff --git a/scim-wnn/src/romkan.h b/scim-wnn/src/romkan.h index 1010000..55199f0 100644 --- a/scim-wnn/src/romkan.h +++ b/scim-wnn/src/romkan.h @@ -68,6 +68,7 @@ WideString eval(); WideString insert(char k); void init(); + void loadTable(const String &filename); protected: String buf; diff --git a/scim-wnn/src/romkan_table.h b/scim-wnn/src/romkan_table.h index f65d44f..d542587 100644 --- a/scim-wnn/src/romkan_table.h +++ b/scim-wnn/src/romkan_table.h @@ -265,7 +265,7 @@ //"Z-", "��", "Z^", "��", - "Z\\", "��", + //"Z\\", "��", "z1", "��", "z2", "��", "z3", "��", diff --git a/scim-wnn/src/scim_wnn_def.h b/scim-wnn/src/scim_wnn_def.h index 61a09f4..b5565d7 100644 --- a/scim-wnn/src/scim_wnn_def.h +++ b/scim-wnn/src/scim_wnn_def.h @@ -113,11 +113,14 @@ #define SCIM_CONFIG_WNN_ROMKAN_NNMODE "/IMEngine/Wnn/Romkan/nnMode" #define SCIM_DEFAULT_WNN_ROMKAN_NNMODE false +#define SCIM_CONFIG_WNN_ROMKAN_TABLE_FILE "/IMEngine/Wnn/Romkan/TableFile" +#define SCIM_DEFAULT_WNN_ROMKAN_TABLE_FILE "" #define SCIM_CONFIG_WNN_KEY_ROMKAN_ASCIIMODE "/IMEngine/Wnn/Romkan/Key/Ascii" #define SCIM_DEFAULT_WNN_KEY_ROMKAN_ASCIIMODE "q" #define SCIM_CONFIG_WNN_KEY_ROMKAN_WASCIIMODE "/IMEngine/Wnn/Romkan/Key/WideAscii" #define SCIM_DEFAULT_WNN_KEY_ROMKAN_WASCIIMODE "Shift+Q" + #endif