dayi 大易輸入法 in ubuntu 16.04 ibus

ibus-table-createdb -s dayi3_ibus.txt -n dayi3.db
ibus-table-createdb -s dayi4-ibus1.cin -n dayi4.db
cp dayi*.db /usr/share/ibus-table/tables/
ibus restart
ibus-setup

Setting>LanguageSupport下指定Keyboard input method system: IBus
Setting>TextEntry下加入新的input source: Chinese (Dayi4) (IBus)

※選字要用ctrl+數字鍵,再補上空白鍵完成選字。比較不順手。
※dayi4-ibus1.cin做出的db檔會缺字…
※dayi3_ibus.txt做出的db檔含蓋四碼的內容,其實還蠻好用的。

其它ibus輸入法

1
2
3
4
5
6
7
8
9
10
11
12
sudo apt-get install ibus-table-cangjie3 #第三代倉頡輸入法
sudo apt-get install ibus-table-cangjie-big #倉頡輸入法,不過第三代和第五代一起裝
sudo apt-get install ibus-table-wubi #五筆輸入法
sudo apt-get install ibus-table-cantonese #廣東話輸入法
sudo apt-get install ibus-table-emoji #表情符號輸入法
sudo apt-get install ibus-table-quick #速成輸入法
sudo apt-get install ibus-table-stroke5 #筆劃輸入法
sudo apt-get install ibus-zhuyin #注音輸入法
sudo apt-get install ibus-pinyin #拼音輸入法
sudo apt-get install ibus-chewing #新酷音輸入法
ibus restart
#ibus-setup

https://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=319858
https://www.ubuntu-tw.org/modules/newbb/viewtopic.php?topic_id=58116
https://hochin.wordpress.com/2014/07/23/%E5%9C%A8ibus%E4%B8%AD%E5%8A%A0%E5%85%A5%E5%A4%A7%E6%98%93%E8%BC%B8%E5%85%A5%E6%B3%95/


  1. 取得大易輸入法對照檔,編碼格式需為UTF-8。以下是我的dayi3.cin的內容:

%geninp
%ename dayi
%cname 大易
%selkey ‘[]-\”{}
|
%keyname begin
= =
` 巷
, 力
. 點
/ 竹
0 金
1 言
2 牛
3 目
4 四
5 王
6 門
7 田
8 米
9 足
; 虫
A 人
B 馬
C 七
D 日
E 一
F 土
G 手
H 鳥
I 木
J 月
K 立
L 女
M 雨
N 魚
O 口
P 耳
Q 石
R 工
S 革
T 糸
U 艸
V 禾
W 山
X 水
Y 火
Z 心
%keyname end
%chardef begin

` 巷
, 力
, ,
. 方
. 舟
. 。
/ 竹
0 金
1 言
2 牛
3 目
4 四
5 王
6 車
7 田
8 八
9 止
; 虫

(略)

%chardef end

2.利用底下的指令取得字根表,並且將字根表的空白改為tab,並且加上權重,然後將所有的大寫字母改為小寫字母
awk ‘/\%chardef begin/{f=1;next}/\%chardef end/{exit}f’ dayi3.cin | awk ‘{count[$1]++}{print $1”\t”$2”\t”101-count[$1]}’ | tr ‘[A-Z]’ ‘[a-z]’ > dayi3.txt

得到如下內容如下:

` 巷 100
, 力 100
, , 99
. 方 100
. 舟 99
. 。 98
/ 竹 100

(略)

3.將/usr/share/ibus-table/table/ 空白範例表,拷貝到家目錄
cp /usr/share/ibus-table/tables/template.txt ~/.

4.準備修改template.txt表頭資料,加上大易的相關資料,有修改的地方如下

利用 uuidgen 指令產生一組UUID後貼到這裡.

UUID = 730a0da0-20e9-45d9-befa-cbe59375be2d

可直接使用日期簡單省事

SERIAL_NUMBER = 20121010

出現的圖示,這裡直接使用內建的圖型,可自己另行設計

ICON = cb-mode.svg

The local names of this table, this is optional

NAME.zh_CN = 大易
NAME.zh_HK = 大易
NAME.zh_TW = 大易

the gettext tools in runtime as 中.

STATUS_PROMPT = 易

Valid input chars.

VALID_INPUT_CHARS = ,./;`=1234567890abcdefghijklmnopqrstuvwxyz

BEGIN_TABLE

END_TABlE

把最後三行加上三個#號,表示註解,也就是不要用它啦

BEGIN_GOUCI

character_1 goucima_1

character_1 goucima_2

END_GOUCI

  1. 將第2項做出來的檔案資料dayi3.txt的所有內容,複製貼上拷貝到template.txt中的BEGIN_TABLE和END_TABLE之間。 做好之後假設存檔命名為dayi3_ibus.txt。
    6.利用下列指令做出dayi3.db表格檔
    ibus-table-createdb -s dayi3_ibus.txt -n dayi3.db
    7.做出來的dayi3.db拷貝到/usr/share/ibus-table/tables底下
    sudo cp dayi3.db /usr/share/ibus-table/tables/dayi3.db
    8.從ibus偏好設定中,增加大易輸入法即可

Step 1. 視需求下載大易字根檔 (四碼或三碼)
$ wget http://opensource.nchc.org.tw/odp/others/OXIM/cin_tables/dayi4.cin.gz
$ wget https://raw.github.com/lukhnos/openvanilla/master/Source/Mac/MacDataTables/dayi3.cin
Step 2. 本篇以大易四碼為例, 解包後產生 Tab 間隔的字碼表
$ gunzip dayi4.cin.gz
$ awk ‘/\%chardef begin/{f=1;next}/\%chardef end/{exit}f’ dayi4.cin | awk ‘{count[$1]++}{print $1”\t”$2”\t”101-count[$1]}’ | tr ‘[A-Z]’ ‘[a-z]’ > dayi4.txt
Step 3. 編輯樣板檔案
$ cp /usr/share/ibus-table/tables/template.txt ./ (此檔案包含在 ibus-table 套件中)
$ uuidgen
01124167-1c32-472d-ad5f-29c9c7458420
$ vi template.txt
UUID = 01124167-1c32-472d-ad5f-29c9c7458420
SERIAL_NUMBER = 20131230
ICON = dayi3.png
NAME.zh_CN = 大易
NAME.zh_HK = 大易
NAME.zh_TW = 大易
STATUS_PROMPT = 易
VALID_INPUT_CHARS = ,./;`=1234567890abcdefghijklmnopqrstuvwxyz

BEGIN_GOUCI

character_1 goucima_1

character_1 goucima_2

END_GOUCI

Step 4. 將 dayi4.txt 內容插入 template.txt 的 BEGIN_TABLE 與 END_TABLE 之間
Step 5. 產生輸入法資料庫檔案
$ sudo vi /usr/share/ibus-table/engine/tabcreatedb.py
約 210 列的地方
try:
attr,val = unicode (l,”utf-8”).strip().split (‘=’, 1)
except:
attr,val = unicode (l,”utf-8”).strip().split (‘==’, 1)
$ ibus-table-createdb -s template.txt -n dayi4.db
$ sudo cp dayi4.db /usr/share/ibus-table/tables/
Step 6. 取得大易輸入法圖示
$ wget https://raw.github.com/hime-ime/hime/master/icons/blue/dayi3.png
$ sudo cp dayi3.png /usr/share/ibus-table/icons/
Step 7. 於 iBus 設定介面新增大易輸入法
$ ibus-daemon -x -r -d (重新啟動 iBus Daemon)
$ ibus-setup