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
Zhon includes the following 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
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.1.1.tar.gz
.
File metadata
- Download URL: zhon-2.1.1.tar.gz
- Upload date:
- Size: 84.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8da424fad4aa698ddd3e1735515b49ff522c84dd1091e8fafd986ac7c6898f0 |
|
MD5 | 0a76747d186de6a60b8c8fdef42c5903 |
|
BLAKE2b-256 | 2a8de6c8ee4df75940ddecb6f5e7b2753a9a3914e6cd357e7238987661723d81 |
File details
Details for the file zhon-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: zhon-2.1.1-py3-none-any.whl
- Upload date:
- Size: 83.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ec0d42229ae60708a045270f755ccefb48f2689f2a6ce0bc6597abf6c4a9871 |
|
MD5 | dc7ab2199e4095e133f2ecec9c0e4073 |
|
BLAKE2b-256 | be13b8d6ca3a41bf5959bc3915678837385bf668162a7295140d81ccae0b96b7 |