skillfed

hanzidentifier

Python module that identifies Chinese text as Simplified or Traditional.

hanzidentifier v1.3.0 549.2K downloads/30d#6,056 on PyPI105
Permissive license MIT DORMANT released

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 hanzidentifier

uv

uv add hanzidentifier

poetry

poetry add hanzidentifier

Installing 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

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 character classificationsimplified vs traditional chinesedetect chinese text typehanzi identificationchinese script detection
chinese-nlptext-classification

More Python Modules packages