close

簡體字轉繁體字 工具很多 , 其中 opencc 很棒 , 會將簡體常用語換成台灣繁體常用語

要先轉成 Unicode 呦 !! ( 用 iconv 或是 enca/enconv 轉換為 utf8 )

記錄一下 linux CentOS下安裝方式 (windows 自行下載安裝包, 用 cmd 抄作)

wget https://github.com/BYVoid/OpenCC/archive/master.zip -O opencc.zip
unzip opencc.zip
cd OpenCC-master
yum install -y cmake gcc gcc-c++ doxygen
make
make install
ln -s /usr/lib/libopencc.so.2 /usr/lib64/libopencc.so.2

檢查是否安裝成功

# opencc -h

Open Chinese Convert (OpenCC) Command Line Tool
Author: Carbo Kuo <byvoid@byvoid.com>
Bug Report: http://github.com/BYVoid/OpenCC/issues

Usage:

   opencc  [--noflush <bool>] [-i <file>] [-o <file>] [-c <file>] [--]
           [--version] [-h]

Options:

   --noflush <bool>
     Disable flush for every line

   -i <file>,  --input <file>
     Read original text from <file>.

   -o <file>,  --output <file>
     Write converted text to <file>.

   -c <file>,  --config <file>
     Configuration file

   --,  --ignore_rest
     Ignores the rest of the labeled arguments following this flag.

   --version
     Displays version information and exits.

   -h,  --help
     Displays usage information and exits.


   Open Chinese Convert (OpenCC) Command Line Tool

轉個匯出的 SQL .....

opencc -i o.sql -o o2.sql -c s2twp.json

使用方式

opencc -i 輸入檔案 -o 輸出檔案 -c 組態檔案

組態檔案  ... 我最常用的是 s2twp.json , tw2sp.json

​​​​​​‧ s2t.json - 簡體到繁體
‧ t2s.json - 繁體到簡體
‧ s2tw.json - 簡體到臺灣正體
‧ tw2s.json - 臺灣正體到簡體
‧ s2hk.json - 簡體到香港繁體(香港小學學習字詞表標準)
‧ hk2s.json - 香港繁體(香港小學學習字詞表標準)到簡體
‧ s2twp.json - 簡體到繁體(臺灣正體標準)並轉換爲臺灣常用詞彙
‧ tw2sp.json - 繁體(臺灣正體標準)到簡體並轉換爲中國大陸常用詞彙 

 

 

 

arrow
arrow
    全站熱搜

    echochio 發表在 痞客邦 留言(0) 人氣()