skillfed

pinyin

Translate chinese chars to pinyin based on Mandarin.dat

pinyin v0.4.0 79.1K downloads/30d#14,377 on PyPI
Permissive license BSD Abandoned released

What it is and what it does

Pinyin is a library for converting Chinese characters to their romanized Mandarin pronunciation (pinyin). It reads from a Mandarin.dat data file and supports multiple output formats: diacritical marks (nǐ hǎo), numerical tone notation (ni3hao3), or stripped ASCII (ni hao). It also includes an experimental Chinese-to-English translation module using CC-CEDICT data, though this is noted as a prototype and only functions on Python 3.

The package has no runtime dependencies and is lightweight, but it is no longer maintained. The last release was in 2016, and the classifiers indicate support only for Python 2.6–3.5, making it incompatible with modern Python environments without testing or forking.

Use it for:

  • Convert Chinese text to pinyin for phonetic display or learning applications
  • Extract initial consonants from Chinese characters for indexing or sorting
  • Generate numerical tone notation for linguistic analysis or text-to-speech systems
  • Look up English translations of Chinese words or phrases using the cedict module

Worth the install?

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

Converts Chinese characters to pinyin (romanized Mandarin pronunciation) in multiple formats, and provides prototype Chinese-to-English translation via CC-CEDICT data.

No, unless you are maintaining legacy Python 2 code. The package is abandoned with no updates since 2016 and targets obsolete Python versions. For modern projects, seek an actively maintained alternative. If you must use it, test thoroughly on your target Python version first.

Install

pinyin on PyPI

pip

pip install pinyin

uv

uv add pinyin

poetry

poetry add pinyin

Installing pinyin

Before you install

High install friction: the package is abandoned (last release 2016-11-24, over 3550 days ago) and targets obsolete Python versions (2.6, 2.7, 3.2–3.5). No active maintenance or security updates.

License in practice

Permissive BSD license allows commercial and private use. The translation data file is CC-BY-SA 3.0, which requires attribution if you redistribute the data.

Quickstart

pip install pinyin

import pinyin
print(pinyin.get('你好'))
print(pinyin.get('你好', format='strip', delimiter=' '))

Package targets Python 2.6–3.5; compatibility with Python 3.6+ is unverified. Abandoned since 2016 with no active maintenance.

Verify before relying

  • Whether the package actually works on modern Python versions despite classifiers targeting only 2.6–3.5
  • Current state of the Mandarin.dat data file and whether it is complete or outdated
  • Whether the cedict translation module functions correctly on Python 3 as noted in the description

Package facts

License BSD (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 3,550 days since the last release
First released
Downloads 79,145/month — #14,377 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pinyin-0.4.0.tar.gz

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development

Tags

chinese to pinyin conversionmandarin romanizationpinyin generatorchinese character romanizechinese to english translationcedict dictionary lookupchinese phonetic romanization
chinese-nlpromanizationabandoned

More Software Development packages