skillfed

zhon

Zhon provides constants used in Chinese text processing.

zhon v2.1.1 571.8K downloads/30d#5,949 on PyPI386
Permissive license MIT DORMANT released

What it is and what it does

Zhon is a reference library of constants for Chinese language processing. It exports pre-defined character sets (CJK characters, radicals, punctuation), Pinyin validation patterns (vowels, consonants, syllable/word/sentence regex), Zhuyin marks, and CC-CEDICT character references. The package has no runtime dependencies and is designed to be imported and used with Python's re module or other text processing tools.

Typical use is to extract or validate Chinese text components: finding all hanzi characters in a mixed-language string, matching Pinyin syllables or words with regex, or validating sentence structure. It's a data reference, not an algorithm library—you provide the processing logic (usually regex) and zhon provides the character classes and patterns.

Use it for:

  • Extract all CJK characters from mixed-language text using zhon.hanzi.characters with regex
  • Validate and extract Pinyin syllables or words from romanized Chinese using zhon.pinyin patterns
  • Build Chinese text segmentation or tokenization tools that rely on character class definitions
  • Identify Chinese punctuation marks in text for parsing or cleaning tasks
  • Validate Zhuyin (bopomofo) syllables in phonetic Chinese text processing

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Zhon provides character constants and regular expression patterns for processing Chinese text, including CJK characters, Pinyin syllables, and Zhuyin marks.

Yes. Zhon is a stable, dependency-free reference library for Chinese text processing with no known vulnerabilities. Install it if you're building tools that need to identify, validate, or extract Chinese characters, Pinyin, or Zhuyin. The dormant maintenance status is not a concern for a constants-only package—the character sets it exports are unlikely to change frequently.

Install

zhon on PyPI

pip

pip install zhon

uv

uv add zhon

poetry

poetry add zhon

Installing zhon

Before you install

Low install friction with no runtime dependencies. Dormant maintenance status (last release 2024-11-20, last commit 2024-12-11) but stable and widely used; no active development but no signs of abandonment.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

import re
import zhon.hanzi

# Find CJK characters in a string
re.findall('[{}]'.format(zhon.hanzi.characters), 'I broke a plate: 我打破了一个盘子.')
# Returns: ['我', '打', '破', '了', '一', '个', '盘', '子']

Verify before relying

  • Whether the package's character sets and patterns are current with Unicode standards for modern Chinese text

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 632 days since the last release
Last repo commit
First released
Downloads 571,763/month — #5,949 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: zhon-2.1.1-py3-none-any.whl

Keywords: cc-cedict, cedict, characters, chinese, cjk, han, hanzi, mandarin, pinyin, punctuation, radicals, segmentation, simplified, tokenization, traditional, unicode, zhuyin

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: Text Processing :: Linguistic

Tags

chinese text processing constantscjk character patternspinyin regex validationhanzi character setschinese punctuation markszhuyin syllable patternsmandarin text utilities
chinese-nlpcharacter-dataregex-patterns

More Python Modules packages