Zhon provides constants used in Chinese text processing.
Project description
Zhon is a Python library that provides constants commonly used in Chinese text processing.
Documentation: https://tsroten.github.io/zhon/
GitHub: https://github.com/tsroten/zhon
Free software: MIT license
About
Zhon’s constants can be used in Chinese text processing, for example:
Find CJK characters in a string:
>>> re.findall('[{}]'.format(zhon.hanzi.characters), 'I broke a plate: 我打破了一个盘子.') ['我', '打', '破', '了', '一', '个', '盘', '子']
Validate Pinyin syllables, words, or sentences:
>>> re.findall(zhon.pinyin.syllable, 'Yuànzi lǐ tíngzhe yí liàng chē.', re.I) ['Yuàn', 'zi', 'lǐ', 'tíng', 'zhe', 'yí', 'liàng', 'chē'] >>> re.findall(zhon.pinyin.word, 'Yuànzi lǐ tíngzhe yí liàng chē.', re.I) ['Yuànzi', 'lǐ', 'tíngzhe', 'yí', 'liàng', 'chē'] >>> re.findall(zhon.pinyin.sentence, 'Yuànzi lǐ tíngzhe yí liàng chē.', re.I) ['Yuànzi lǐ tíngzhe yí liàng chē.']
Features
- Includes commonly-used constants:
CJK characters and radicals
Chinese punctuation marks
Chinese sentence regular expression pattern
Pinyin vowels, consonants, lowercase, uppercase, and punctuation
Pinyin syllable, word, and sentence regular expression patterns
Zhuyin characters and marks
Zhuyin syllable regular expression pattern
CC-CEDICT characters
Getting Started
Read Zhon’s introduction
Learn from the API documentation
Contribute documentation, code, or feedback
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
Built Distribution
File details
Details for the file zhon-2.0.0.tar.gz
.
File metadata
- Download URL: zhon-2.0.0.tar.gz
- Upload date:
- Size: 84.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 766cf66d1e6a3b6efe43790fada0cc0c428e6d4bc0e3b28b66a07fe8175050a6 |
|
MD5 | abc4afcfb8965cdb10f7a2f25f4da00a |
|
BLAKE2b-256 | 495d7f62f5bceb27b0e7e864aa8b990b0b3c451120052e6910af5937d3b0b1ee |
File details
Details for the file zhon-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: zhon-2.0.0-py3-none-any.whl
- Upload date:
- Size: 84.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3e12593ebeab2f77b9f4bbe32f920bc684dafa840bccbf47fe95bb7059b6b44 |
|
MD5 | 8b545ce631718287c43760e145c2318e |
|
BLAKE2b-256 | 91cfa9fced50fbe70022692a05341a981054b918730a9a7ce808b93ccd123f5f |