skillfed

cn2an

Convert Chinese numerals and Arabic numerals.

cn2an v0.5.24 304.2K downloads/30d#7,807 on PyPI765
Permissive license MIT License Active released

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 cn2an

uv

uv add cn2an

poetry

poetry add cn2an

Installing 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

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

chinese numerals to arabicconvert chinese numberscn2an number conversionchinese text to digitschinese number parsersentence numeral transformchinese numeral parsing
chinese-nlpnumber-conversiontext-normalization

More Linguistic packages