關於部落格
職場生活筆記....熱情依然在
  • 51771

    累積人氣

  • 7

    今日人氣

    1

    追蹤人氣

在Ubuntu 10.4 之ibus 安裝嘸蝦米輸入法

Ubuntu新手,眼見已經出到10.04版了,過去只用過X window , Fedora。使用上OK的,但是在輸入法上卻沒有Boshiamy,讓我瞬時失去了動力.

在Fedora時代,輸入法僅有gcin,現在Ubuntu已經支援gcin, scim 和iBus了,因為習慣用嘸蝦米,我一直都是用gcin,但Ubuntu的gcin我灌完就給我不太正常,只好使用iBus跑嘸蝦米的方法。

這安裝過程實在是非常不friendly,一場災難…… 

花了2個小時,參考下面幾個網站,才終於把嘸蝦米搞定

按照以下步驟,可以省去不少時間

Step1. 安裝正版的嘸蝦米(Boshiamy) for windows based後 ,至C:WINDOWSsystem32 

liu-uni.tab
liu-uni2.tab
liu-uni3.tab
liu-uni4.tab

將這四個檔案取出

Step2. 下載轉檔工具
 uni2txt 並針對Step 1所提到的四個.tab檔執行轉檔,得到四個.txt檔。
            (在windows下用command line執行)

     uni2txt.exe liu-uni.tab liu-uni.txt

     uni2txt.exe liu-uni2.tab liu-uni2.txt
     uni2txt.exe liu-uni3.tab liu-uni3.txt
     uni2txt.exe liu-uni4.tab liu-uni4.txt

Step3. 下載五個檔案


    
uni2txt.sh
    
liu-uni.tab 的 vrsf
    
liu-uni2.tab 的 vrsf
    
liu-uni3.tab 的 vrsf
    
liu-uni4.tab 的 vrsf 

Step4.  將 uni2txt.sh 中的四行加上註解 #

   # wine ./uni2txt.exe liu-uni.tab liu-uni.txt
   # wine ./uni2txt.exe liu-uni2.tab liu-uni2.txt
   # wine ./uni2txt.exe liu-uni3.tab liu-uni3.txt
   # wine ./uni2txt.exe liu-uni4.tab liu-uni4.txt

Step5. 存檔後, 在Linux的Command line執行

       sh uni2txt.sh

Step6. 執行後,會有四行Error,可以不予理會

   uni2txt.sh: line 18: gcin2tab: command not found
   uni2txt.sh: line 29: gcin2tab: command not found
   uni2txt.sh: line 40: gcin2tab: command not found
   uni2txt.sh: line 51: gcin2tab: command not foun

        執行完成後,原先 Step 1所提到的四個.txt檔,會各自生成二種檔案(*.unix,個 *.cin )

Step7. 下載
 
liu.box ,在Linux的Command line執行,並生成liu-utf8.box

        iconv -f UTF-16 -t UTF-8 liu.box | tail -n +23 | sed -e 's/; / /' > liu-utf8.box

Step8. 在Linux的Command line執行,並生成boshiamy-hyper.cin

        cat noseeing.cin liu-uni2.unix liu-uni3.unix liu-uni4.unix liu-utf8.box | perl -nle '(print,$hash{$_}=1)           unless defined $hash{$_}' > boshiamy-hyper.cin

Step9. 在Linux的Command line執行,並生成liu.tmp

        awk '/%chardef begin/{f=1;next}/%chardef end/{exit}f' boshiamy-hyper.cin | grep -v '^%' | awk               '{counter[$1]++} END {} {print $1"t"$2"t"101-counter[$1]}' > liu.tmp

Step10. 將其以下內容以utf-8格式儲存為ibus-head.txt

 

        ### File header must not be modified
        ### This file must be encoded into UTF-8.
        ### This table under LGPL
        ### comments start with ### not single #
        ### Derive from the format of SCIM Table, so you can modify the table from
        ### scim-tables' table
        SCIM_Generic_Table_Phrase_Library_TEXT
        VERSION_1_0

        ### Begin Table definition.
        BEGIN_DEFINITION
        LICENSE = LGPL
        UUID = 702d9641-a51b-4688-b4a2-8e8b8fe579cf
        SERIAL_NUMBER = 20090709

        ICON = icon.png           

     NAME = liu5
        NAME.zh_TW = 嘸蝦米
        DESCRIPTION = Boshiamy Input Method
        LANGUAGES = zh_TW
        AUTHOR = Boshiamy Corp. Reic Wang
        STATUS_PROMPT = TW
        VALID_INPUT_CHARS = ,.'abcdefghijklmnopqrstuvwxyz[]
        LAYOUT = us
        MAX_KEY_LENGTH = 5
        AUTO_COMMIT = FALSE

        DEF_FULL_WIDTH_PUNCT = FALSE
        DEF_FULL_WIDTH_LETTER = FALSE

        USER_CAN_DEFINE_PHRASE = TRUE

        PINYIN_MODE = TRUE
        DYNAMIC_ADJUST = FALSE

        END_DEFINITION

        ### Begin Table data.
        ### Format of every line whose formated in "input_keystphrasetfreqn" is an
        ### entry.
        ### From left to right, the 1st column are the input key combination that you
        ### entered via keyboard; the 2nd column are presented character or phrase of
        ### the key combination you want; the 3rd column are frequency of the character
        ### or phrase.

Step11. 在Linux的Command line執行,並生成liu7utf8ibus.txt, liu7.db

        cat ibus-head.txt> liu7utf8ibus.txt

        echo 'BEGIN_TABLE'>> liu7utf8ibus.txt
        cat liu.tmp >> liu7utf8ibus.txt
        echo 'END_TABLE' >> liu7utf8ibus.txt
        ibus-table-createdb -s liu7utf8ibus.txt -n liu7.db

Step12. 在Linux的Command line執行,進行收尾工作

        sudo cp liu7.db /usr/share/ibus-table/tables/
        sudo cp liu7.png /usr/share/ibus-table/icons/
        exit


Step13. 登出Ubuntu,再登入,大功告成 

 



相簿設定
標籤設定
相簿狀態