-
Notifications
You must be signed in to change notification settings - Fork 203
Open
Description
中文繁简互转说明
安装说明
先安装 opencc 套件
$ apt-get install opencc libopencc1.1
$ opencc --version
$ Open Chinese Convert (OpenCC) Command Line Tool
# Version: 1.1.1
$ opencc --help查找所支持的标准
先列出所有的标准,并查找细节
$ locate opencc | grep share | grep json
# /usr/share/opencc/hk2s.json
# /usr/share/opencc/hk2t.json
# /usr/share/opencc/jp2t.json
# /usr/share/opencc/s2hk.json
# /usr/share/opencc/s2t.json
# /usr/share/opencc/s2tw.json
# /usr/share/opencc/s2twp.json
# /usr/share/opencc/t2hk.json
# /usr/share/opencc/t2jp.json
# /usr/share/opencc/t2s.json
# /usr/share/opencc/t2tw.json
# /usr/share/opencc/tw2s.json
# /usr/share/opencc/tw2sp.json
# /usr/share/opencc/tw2t.json
$ head /usr/share/opencc/s2t.json
# {
# "name": "Simplified Chinese to Traditional Chinese",
# "segmentation": {
# "type": "mmseg",
# "dict": {
# "type": "ocd2",
# "file": "STPhrases.ocd2"
# }
# },
# "conversion_chain": [{
$ head /usr/share/opencc/s2twp.json
# {
# "name": "Simplified Chinese to Traditional Chinese (Taiwan standard, with phrases)",
# "segmentation": {
# "type": "mmseg",
# "dict": {
# "type": "ocd2",
# "file": "STPhrases.ocd2"
# }
# },
# "conversion_chain": [{中文简转繁
使用以下指令去尝试语言互换
$ echo '数据库' | opencc -c s2t
# 數據庫
$ echo '数据库' | opencc -c s2twp
# 資料庫
$ echo '数据库' > foo.cn.txt
$ opencc -i ./foo.cn.txt -c s2twp -o ./foo.tw.txt
$ cat ./foo.tw.txt
# 資料庫中文繁转简
使用以下指令去尝试语言互换
$ echo '資料庫' | opencc -c t2s
# 资料库
$ echo '資料庫' | opencc -c tw2sp
# 数据库
$ echo '資料庫' > foo.tw.txt
$ opencc -i ./foo.tw.txt -c tw2sp -o ./foo.cn.txt
$ cat ./foo.cn.txt
# 数据库Metadata
Metadata
Assignees
Labels
No labels