Skip to main content

Zhon

Zhon is a Python library that provides constants commonly used in Chinese text processing:

  • 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

Some quick examples:

  • Find CJK characters in a string:

    >>> re.findall('[%s]' % 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ē.']

Documentation

Zhon has complete documentation. Check it out if you want to find out how to use Zhon.

Name

Zhon is short for ZHongwen cONstants. It is pronounced like the name ‘John’.

Install

Zhon supports Python 2.7 and 3. Install using pip:

$ pip install zhon

Bugs and Feature Requests

Zhon uses its GitHub Issues page to track bugs, feature requests, and support questions.

License

Zhon is released under the OSI-approved MIT License. See the file LICENSE.txt for more information.

Metadata

Release files for zhon 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zhon 1.1.3
File Size Uploaded Provenance Actions
zhon-1.1.3.tar.gz 98.0 kB Without provenance Details for zhon-1.1.3.tar.gz

Release files / zhon-1.1.3.tar.gz

Download URL zhon-1.1.3.tar.gz
Size 98.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bfd9964352fc3753d60d0b8185b514aa8c9b9f431afae0b08181496f30633878
BLAKE2b-256 checksum
How to use checksums
dd40753cc1b050149ee52ceefa7098bf1e947eb06b496aceaa1be959bfc1b07d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for zhon 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page