汉语拼音转换工具.
- cc2py - Chinese-Character to Pinyin converter
- Usage
- Download/install binaries
- Install Source
- Author
- Contributors
cc2py
will convert Chinese-Character to pinyin.
$ cc2py -V
cc2py - Chinese-Character to Pinyin converter
Copyright (C) 2022, Tong Sun
Converter Chinese to pinyin in different ways
Built on 2022-01-22
Version 0.2.3
Usage:
cc2py [OPTIONS] CCStrs...
Application Options:
-i, --in= the Chinese text file to read from (or "-" for stdin)
-t, --tone= tone selection
0: normal. mnemonic~ nothing
1: tone at the end. mnemonic~ single sided
2: tone after yunmu. mnemonic~ double sided
3: tone on yunmu. mnemonic~ fancy [$CC2PY_TONE]
-l, --truncate= select only part of the pinyin
0: normal. mnemonic~ nothing truncated
1: leave first char. mnemonic~ one
2: leave first shengmu. mnemonic~ might be two
9: leave only yunmu. mnemonic~ last [$CC2PY_TRUNCATE]
-s, --separator= separator string between each pinyin (default: )
[$CC2PY_SEPARATOR]
-p, --polyphone polyphone support, output each polyphone pinyin available
[$CC2PY_POLYPHONE]
-c, --capitalized capitalized each pinyin word [$CC2PY_CAPITAL]
-v, --verbose Verbose mode (Multiple -v options increase the verbosity)
-V, --version Show program version and exit
Help Options:
-h, --help Show this help message
$ cc2py 汉语拼音转换工具
han yu pin yin zhuan huan gong ju
$ cc2py -c 汉语 拼音 转换 工具
Han Yu Pin Yin Zhuan Huan Gong Ju
$ cc2py -t 1 -c 汉语 拼音 转换 工具
Han4 Yu3 Pin1 Yin1 Zhuan3 Huan4 Gong1 Ju4
$ cc2py -c 汉语 拼音 转换 工具 -t 2
Ha4n Yu3 Pi1n Yi1n Zhua3n Hua4n Go1ng Ju4
$ cc2py -c 汉语 拼音 转换 工具 -t 3
Hàn Yǔ Pīn Yīn Zhuǎn Huàn Gōng Jù
$ cc2py -c 汉语 拼音 转换 工具 -t 4 || true
[cc2py] cli options error: tone 4 out of range. run `cc2py -h` to get help.
$ cc2py -c -t 3 -s '' 汉语拼音 转换 工具
HànYǔPīnYīn ZhuǎnHuàn GōngJù
$ cc2py -t 3 "中国人的〖中国银行〗,很.行.。"
zhōng guó rén de 〖zhōng guó yín xíng 〗,hěn .xíng .。
$ echo "中国人的〖中国银行〗,很.行.。" | tee /tmp/pytest.txt | cc2py -t 1 -i -
zhong1 guo2 ren2 de 〖zhong1 guo2 yin2 xing2 〗,hen3 .xing2 .。
$ cc2py -i /tmp/pytest.txt -t 2
zho1ng guo2 re2n de 〖zho1ng guo2 yi2n xi2ng 〗,he3n .xi2ng .。
$ cc2py -i /tmp/pytest.txt -p -t 3
zhōng/zhòng guó rén de/dī/dí/dì 〖zhōng/zhòng guó yín xíng/háng/héng/xìng/hàng 〗,hěn .xíng/háng/héng/xìng/hàng .。
$ cc2py -i /tmp/pytest.txt -l 1 -c
Z G R D 〖Z G Y X 〗,H .X .。
$ cc2py -i /tmp/pytest.txt -l 2 -s '' -c
ZhGRD〖ZhGYX〗,H.X.。
- The latest binary executables are available as the result of the Continuous-Integration (CI) process.
- I.e., they are built automatically right from the source code at every git release by GitHub Actions.
- There are two ways to get/install such binary executables
- Using the binary executables directly, or
- Using packages for your distro
- The latest binary executables are directly available under
https://github.com/go-cc/cc2py/releases/latest - Pick & choose the one that suits your OS and its architecture. E.g., for Linux, it would be the
cc2py_verxx_linux_amd64.tar.gz
file. - Available OS for binary executables are
- Linux
- Mac OS (darwin)
- Windows
- If your OS and its architecture is not available in the download list, please let me know and I'll add it.
- The manual installation is just to unpack it and move/copy the binary executable to somewhere in
PATH
. For example,
tar -xvf cc2py_*_linux_amd64.tar.gz
sudo mv -v cc2py_*_linux_amd64/cc2py /usr/local/bin/
rmdir -v cc2py_*_linux_amd64
The repo setup instruction url has been given above. For example, for Debian --
curl -1sLf \
'https://dl.cloudsmith.io/public/suntong/repo/setup.deb.sh' \
| sudo -E bash
# That's it. You then can do your normal operations, like
sudo apt-get update
apt-cache policy cc2py
sudo apt-get install -y cc2py
To install the source code instead:
go get -v -u github.com/go-cc/cc2py
Powered by WireFrame
the one-stop wire-framing solution for Go cli based projects, from init to deploy.
Thanks goes to these wonderful people (emoji key):
suntong 💻 🤔 🎨 🔣 |
This project follows the all-contributors specification. Contributions of any kind welcome!