cn2an
Convert Chinese numerals and Arabic numerals.
What it is and what it does
cn2an is a bidirectional converter between Chinese numerals and Arabic numerals. It handles standard conversions across multiple parsing modes: strict mode enforces proper numeral syntax, normal mode accepts informal sequences, smart mode handles mixed notation, and direct mode performs character-by-character translation. Beyond simple numbers, it transforms dates, fractions, percentages, and temperatures within sentences, supporting negative numbers and decimals up to 10**16 magnitude in both directions.
The package offers three output styles for Arabic-to-Chinese conversion: lowercase Chinese numerals, uppercase formal numerals, and RMB currency notation. It includes an HTTP API for non-Python environments. The library depends on proces for data preprocessing and is actively maintained with recent bug fixes for numeral parsing edge cases.
Use it for:
- Parse Chinese financial documents or invoices that use written numerals into machine-readable integers
- Generate human-readable Chinese numeral output for financial reports, receipts, or formal RMB amounts
- Extract and normalize dates from Chinese text for data cleaning pipelines
- Convert mixed-notation numbers in Chinese text for standardization
- Build multilingual number handling for applications serving Chinese-speaking users
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts between Chinese numerals and Arabic numerals in multiple modes, supporting integers, decimals, negatives, and sentence-level transformations including dates, fractions, and percentages.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and solves a specific problem with low install friction. It is well-suited for applications that need bidirectional Chinese-Arabic numeral conversion. The experimental sentence-level transformation feature adds value for text processing but should be tested for your specific use cases.
Install
cn2an on PyPI
pip
pip install cn2anuv
uv add cn2anpoetry
poetry add cn2anInstalling cn2an
Before you install
Low install friction with a pure Python wheel. The package is actively maintained with recent commits and no known vulnerabilities. Supports Python 3.7 and later versions across Windows, macOS, and Ubuntu.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install cn2an
import cn2an
# Chinese to Arabic
result = cn2an.cn2an("一百二十三")
print(result) # 123
# Arabic to Chinese
result = cn2an.an2cn("123")
print(result) # 一百二十三
Requires Python 3.7 or later. The sentence-level transformation feature is marked experimental and may produce unexpected results in edge cases.
Verify before relying
- Whether the proces dependency is a required runtime or only used for internal data preprocessing
- Performance characteristics for very large batch conversions or real-time API usage
- Accuracy of the experimental sentence-level transformation feature across edge cases
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — proces |
| Maintenance | actively maintained — 114 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 304,235/month — #7,807 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cn2an-0.5.24-py3-none-any.whl
Tags
More Linguistic packages
Detects and normalizes text encoding from…
permissive · top 100 on PyPI
tiktokentiktoken is a fast BPE tokenizer that converts…
permissive · top 1,000 on PyPI
chardetDetects character encoding and language in byte…
permissive · top 1,000 on PyPI
text-unidecodeConverts Unicode text to ASCII by…
copyleft · top 1,000 on PyPI
larkLark is a parsing library that builds abstract…
permissive · top 1,000 on PyPI
tree-sitterPython bindings to the tree-sitter parsing…
permissive · top 1,000 on PyPI
romanConverts between Arabic integers and Roman…
unclear · top 5,000 on PyPI
roman-numeralsConverts between integers and Roman numerals,…
permissive · top 5,000 on PyPI
zhconvConverts text between Simplified and…
copyleft · top 15,000 on PyPI
roman-numerals-pyConverts between integers and Roman numerals,…
permissive · top 5,000 on PyPI
procesProces provides text preprocessing functions…
permissive · top 15,000 on PyPI
pypinyinConverts Chinese characters to pinyin…
permissive · top 5,000 on PyPI
recognizers-text-numberRecognizes and extracts numeric entities…
permissive · top 15,000 on PyPI
banglaConverts Gregorian dates to the Bengali…
permissive · top 15,000 on PyPI
recognizers-text-number-with-unitRecognizes and extracts numbers with units…
permissive · top 15,000 on PyPI
arabic-reshaperReshapes Arabic text characters into their…
permissive · top 5,000 on PyPI