hanzidentifier
Python module that identifies Chinese text as Simplified or Traditional.
What it is and what it does
Hanzidentifier is a lightweight Python module that classifies Chinese text by script system. It examines strings for Simplified characters, Traditional characters, or a mix of both, returning one of five classification constants: UNKNOWN (no Chinese), SIMPLIFIED, TRADITIONAL, BOTH (characters valid in both systems), or MIXED (both script-exclusive characters present). The package relies on zhon's CC-CEDICT dictionary to recognize Chinese characters; characters not in that dictionary are ignored during classification.
The module is designed for straightforward text-processing tasks where you need to know what kind of Chinese characters are present. It offers both high-level helper functions (has_chinese, is_simplified, is_traditional) and a lower-level identify() function for more granular control. It has no external system dependencies and installs as a pure Python wheel.
Use it for:
- Validate user input in a form to ensure it uses the expected Chinese script variant.
- Route Chinese text to appropriate downstream processing pipelines based on script type.
- Filter or categorize documents in a corpus by their Chinese character system.
- Detect mixed-script content that may indicate encoding errors or intentional code-switching.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Identifies whether a string contains Simplified Chinese, Traditional Chinese, both, or mixed character sets using CC-CEDICT data.
Yes, if you need to classify Chinese text by script system. The package is stable, has no known vulnerabilities, and installs with minimal friction. Maintenance is dormant but the codebase is mature and the task it solves is well-defined. The single dependency (zhon) is also lightweight. Consider it a solid choice for text processing pipelines that must distinguish Simplified from Traditional Chinese.
Install
hanzidentifier on PyPI
pip
pip install hanzidentifieruv
uv add hanzidentifierpoetry
poetry add hanzidentifierInstalling hanzidentifier
Before you install
Low friction: pure Python wheel with a single dependency (zhon). Maintenance is dormant—last release was 632 days ago and no recent commits—but the package is marked stable and the repository is not archived.
License in practice
MIT license permits commercial and private use with minimal restrictions; attribution required.
Quickstart
pip install hanzidentifier
import hanzidentifier
result = hanzidentifier.identify('你好')
if result is hanzidentifier.SIMPLIFIED:
print('Simplified Chinese')
Requires Python 3.9 or later.
Verify before relying
- Whether the CC-CEDICT data bundled via zhon is current enough for modern Chinese text.
- Performance characteristics on very long strings or bulk processing workloads.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — zhon |
| Maintenance | dormant — 632 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 549,195/month — #6,056 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hanzidentifier-1.3.0-py3-none-any.whl
Keywords: characters, chinese, cjk, hanzi, mandarin, simplified, traditional
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
zhonZhon provides character constants and regular…
permissive · top 15,000 on PyPI
opencc-python-reimplementedConverts text between Simplified Chinese,…
permissive · top 5,000 on PyPI
identifyIdentifies file types by examining file paths,…
permissive · top 1,000 on PyPI
xpinyinConverts Chinese characters (hanzi) to their…
permissive · top 15,000 on PyPI
zhconvConverts text between Simplified and…
copyleft · top 15,000 on PyPI
OpenCCConverts text between Traditional Chinese,…
permissive · top 15,000 on PyPI
pinyinConverts Chinese characters to pinyin…
permissive · top 15,000 on PyPI
jiebaJieba segments Chinese text into words using…
permissive · top 5,000 on PyPI
cnocrCnOCR recognizes text in images—Chinese…
permissive · top 15,000 on PyPI
pypinyinConverts Chinese characters to pinyin…
permissive · top 5,000 on PyPI