|
本帖最後由 tinyding 於 14-9-1 18:50 編輯
超級美少女 發表於 14-9-1 17:31
我要轉 utf8的~
opencc -i gb.txt -o big5.txt
底下是 "opencc --help" :
- root@linode-001:/tmp# opencc --help
- Open Chinese Convert (OpenCC) Command Line Tool
- Version 0.3.0
- Author: BYVoid <byvoid.kcp@gmail.com>
- Bug Report: http://code.google.com/p/open-chinese-convert/issues/entry
- Usage:
- opencc [Options]
- Options:
- -i [file], --input=[file] Read original text from [file].
- -o [file], --output=[file] Write converted text to [file].
- -c [file], --config=[file] Load configuration of conversion from [file].
- -v, --version Print version and build information.
- -h, --help Print this help.
- With no input file, reads standard input and writes converted stream to standard output.
- Default configuration(zhs2zht.ini) will be loaded if not set.
複製代碼
底下是 "man opencc > T1 ; cat T1" :
- OPENCC(1) User Commands OPENCC(1)
- NAME
- opencc - simplified-traditional chinese conversion tool
- DESCRIPTION
- Open Chinese Convert (OpenCC) Command Line Tool
- Usage:
- opencc [-i input_file] [-o output_file] [-c config_file]
- -i Read original text from input_file.
- -o Write converted text to output_file.
- -c Load dictionary configuration from config_file.
- Package libopencc1 has some configuration file preset:
- /usr/lib/${DEB_HOST_MULTIARCH}/opencc/*.ini; the ${DEB_HOST_MUL‐
- TIARCH} is something like "x86_64-linux-gnu" (AMD64) or
- "i386-linux-gnu" (i386), or something else; you can get it by
- `dpkg-architecture -qDEB_HOST_MULTIARCH`.
- Note:
- Text from standard input will be read if input_file is not set
- and will be written to standard output if output_file is not
- set.
- Default configuration(zhs2zht.ini) will be load if config_file
- is not set.
- Open Chinese Convert (OpenCC) Command Line Tool
- SEE ALSO
- iconv(1)
- opencc June 2010 OPENCC(1)
複製代碼
由上述得知 opencc 的設定檔在 "/usr/lib" ... :
- root@linode-001:/tmp# cd /usr/lib
- root@linode-001:/usr/lib# find ./ -name "opencc*" -print
- ./x86_64-linux-gnu/opencc
複製代碼 切進目錄查看 ... :
- root@linode-001:/usr/lib# cd x86_64-linux-gnu/opencc
- root@linode-001:/usr/lib/x86_64-linux-gnu/opencc# ls -la
- total 8808
- drwxr-xr-x 2 root root 4096 Aug 28 08:40 .
- drwxr-xr-x 23 root root 20480 Aug 28 12:49 ..
- -rw-r--r-- 1 root root 725 Dec 1 2011 from_tw_phrases.txt
- -rw-r--r-- 1 root root 167 Dec 1 2011 from_tw_variants.txt
- -rw-r--r-- 1 root root 873 Dec 1 2011 mix2zhs.ini
- -rw-r--r-- 1 root root 874 Dec 1 2011 mix2zht.ini
- -rw-r--r-- 1 root root 2184064 Jun 10 2012 simp_to_trad_characters.ocd
- -rw-r--r-- 1 root root 4046192 Jun 10 2012 simp_to_trad_phrases.ocd
- -rw-r--r-- 1 root root 3283 Dec 1 2011 to_cn_phrases.txt
- -rw-r--r-- 1 root root 3471 Dec 1 2011 to_tw_phrases.txt
- -rw-r--r-- 1 root root 168 Dec 1 2011 to_tw_variants.txt
- -rw-r--r-- 1 root root 2185288 Jun 10 2012 trad_to_simp_characters.ocd
- -rw-r--r-- 1 root root 495480 Jun 10 2012 trad_to_simp_phrases.ocd
- -rw-r--r-- 1 root root 817 Dec 1 2011 zhs2zht.ini
- -rw-r--r-- 1 root root 809 Dec 1 2011 zhs2zhtw_p.ini
- -rw-r--r-- 1 root root 812 Dec 1 2011 zhs2zhtw_v.ini
- -rw-r--r-- 1 root root 863 Dec 1 2011 zhs2zhtw_vp.ini
- -rw-r--r-- 1 root root 817 Dec 1 2011 zht2zhs.ini
- -rw-r--r-- 1 root root 733 Dec 1 2011 zht2zhtw_p.ini
- -rw-r--r-- 1 root root 736 Dec 1 2011 zht2zhtw_v.ini
- -rw-r--r-- 1 root root 787 Dec 1 2011 zht2zhtw_vp.ini
- -rw-r--r-- 1 root root 890 Dec 1 2011 zhtw2zhcn_s.ini
- -rw-r--r-- 1 root root 814 Dec 1 2011 zhtw2zhcn_t.ini
- -rw-r--r-- 1 root root 843 Dec 1 2011 zhtw2zhs.ini
- -rw-r--r-- 1 root root 767 Dec 1 2011 zhtw2zht.ini
複製代碼
預設的設定檔案是 "zhs2zht.ini" :
- root@linode-001:/usr/lib/x86_64-linux-gnu/opencc# cat zhs2zht.ini
- ; Open Chinese Convert
- ;
- ; Copyright 2010 BYVoid <byvoid.kcp@gmail.com>
- ;
- ; Licensed under the Apache License, Version 2.0 (the "License");
- ; you may not use this file except in compliance with the License.
- ; You may obtain a copy of the License at
- ;
- ; http://www.apache.org/licenses/LICENSE-2.0
- ;
- ; Unless required by applicable law or agreed to in writing, software
- ; distributed under the License is distributed on an "AS IS" BASIS,
- ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ; See the License for the specific language governing permissions and
- ; limitations under the License.
- title = simp_to_trad
- description = Standard Configuration for Conversion from Simplified Chinese to Traditional Chinese
- dict0 = OCD simp_to_trad_phrases.ocd
- dict0 = OCD simp_to_trad_characters.ocd
複製代碼
但你可以指定使用哪一個設定檔案,例如:
- root@linode-001:/tmp# opencc -i test-UTF8-CN_UTF8-TW-100M.txt -o TXT.txt -c /usr/lib/x86_64-linux-gnu/opencc/mix2zht.ini
- root@linode-001:/tmp# tail TXT.txt
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
- 意萊爾負離子衛生巾抑菌透氣組合\\', NULL, NULL, \\'意萊爾居家日用旗艦店
複製代碼
|
評分
-
查看全部評分
|