Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

中文繁简互转说明 #15

Open
panhongrainbow opened this issue Jul 2, 2022 · 0 comments
Open

中文繁简互转说明 #15

panhongrainbow opened this issue Jul 2, 2022 · 0 comments

Comments

@panhongrainbow
Copy link

panhongrainbow commented Jul 2, 2022

中文繁简互转说明

安装说明

先安装 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 
# 数据库
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant