Skip to main content

Zhon

https://badge.fury.io/py/zhon.svg https://github.com/tsroten/zhon/actions/workflows/ci.yml/badge.svg

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

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

Release files for zhon 2.1.1

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 2.1.1
File Size Uploaded
zhon-2.1.1.tar.gz 84.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zhon 2.1.1
File Interpreter ABI Platform
zhon-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 168.4 kB

Release files / zhon-2.1.1.tar.gz

Download URL zhon-2.1.1.tar.gz
Size 84.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c8da424fad4aa698ddd3e1735515b49ff522c84dd1091e8fafd986ac7c6898f0
BLAKE2b-256 checksum
How to use checksums
2a8de6c8ee4df75940ddecb6f5e7b2753a9a3914e6cd357e7238987661723d81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.2

Release files / zhon-2.1.1-py3-none-any.whl

Download URL zhon-2.1.1-py3-none-any.whl
Size 83.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ec0d42229ae60708a045270f755ccefb48f2689f2a6ce0bc6597abf6c4a9871
BLAKE2b-256 checksum
How to use checksums
be13b8d6ca3a41bf5959bc3915678837385bf668162a7295140d81ccae0b96b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.27.2

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

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