A simple implementation of Simplified-Traditional Chinese conversion.
Project description
zhconv 提供基于 MediaWiki 词汇表的最大正向匹配简繁转换。Python 2, 3 通用。支持以下地区词转换:
zh-cn 大陆简体
zh-tw 台灣正體
zh-hk 香港繁體
zh-sg 马新简体(无词汇表,需要手工指定)
zh-hans 简体
zh-hant 繁體
示例
>>> print(convert(u'我幹什麼不干你事。', 'zh-cn'))
我干什么不干你事。
>>> print(convert(u'人体内存在很多微生物', 'zh-tw'))
人體內存在很多微生物
完整支持 MediaWiki 人工转换语法:
>>> print(convert_for_mw(u'在现代,机械计算-{}-机的应用已经完全被电子计算-{}-机所取代', 'zh-hk'))
在現代,機械計算機的應用已經完全被電子計算機所取代
>>> print(convert_for_mw(u'-{zh-hant:資訊工程;zh-hans:计算机工程学;}-是电子工程的一个分支,主要研究计算机软硬件和二者间的彼此联系。', 'zh-tw'))
資訊工程是電子工程的一個分支,主要研究計算機軟硬體和二者間的彼此聯繫。
>>> print(convert_for_mw(u'張國榮曾在英國-{zh:利兹;zh-hans:利兹;zh-hk:列斯;zh-tw:里茲}-大学學習。', 'zh-sg'))
张国荣曾在英国利兹大学学习。
>>> print(convert_for_mw('毫米(毫公分),符號mm,是長度單位和降雨量單位,-{zh-hans:台湾作-{公釐}-或-{公厘}-;zh-hant:港澳和大陸稱為-{毫米}-(台灣亦有使用,但較常使用名稱為毫公分);zh-mo:台灣作-{公釐}-或-{公厘}-;zh-hk:台灣作-{公釐}-或-{公厘}-;}-。', 'zh-cn'))
毫米(毫公分),符号mm,是长度单位和降雨量单位,台湾作公釐或公厘。
和其他 高级字词转换语法。
命令行工具
python -mzhconv [-w] {zh-cn|zh-tw|zh-hk|zh-sg|zh-hans|zh-hant|zh} < input > output
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zhconv-1.4.0.tar.gz
(178.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
zhconv-1.4.0-py2.py3-none-any.whl
(179.5 kB
view details)
File details
Details for the file zhconv-1.4.0.tar.gz.
File metadata
- Download URL: zhconv-1.4.0.tar.gz
- Upload date:
- Size: 178.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed2f3ebe8a90e9e43bc2e116155f741965aa93adb046fb0b9a2bea487d9385c4
|
|
| MD5 |
3277fdce05022b37f88143fadbdb6341
|
|
| BLAKE2b-256 |
bce0dc2ea16c12404774ccfd604403dafc991cd48e12791328219e5afcc0b3df
|
File details
Details for the file zhconv-1.4.0-py2.py3-none-any.whl.
File metadata
- Download URL: zhconv-1.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 179.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc1c8e0fe4b772f02a30db0c2125d3b2df413e989e39e91a66f4dba534d01edb
|
|
| MD5 |
0ba00b9cc2b7965bb5f7de2a4c1a4155
|
|
| BLAKE2b-256 |
4bffbefc05572aa53eaf542c75a7d7b18d66c24c418ba0cc9202d383e58f6c70
|