# pypinyin

汉字转拼音(pypinyin)

Repository: https://github.com/mozillazg/python-pinyin
Canonical: https://ross.abutalabs.com/products/pypinyin
Homepage: https://pypinyin.readthedocs.io
Language: Python
License: MIT
License Family: permissive
Topics: python, pinyin, pypinyin, hanzi, hanzi-pinyin, python2, python3, chinese
Last push: 2026-07-20T16:22:54+00:00

## Health v2 (maintenance only)
Score: 67/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 93, release rhythm 16, longevity 100
- inputs: {"age_days": 4736, "days_push": 44, "days_rel": 409, "gap_med": 153.5, "n_releases_24m": 3}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5356, forks 627 (observed 2026-08-28T04:09:15.981474+00:00)

## What it is
pypinyin is a Python library (with a companion CLI) that converts Chinese characters (hanzi) to pinyin, supporting polyphonic characters, multiple pinyin styles, bopomofo, and Wade-Giles romanization. It also has related Go and data projects under the same author.

## Use cases
- convert chinese characters to pinyin
- get pinyin annotations for hanzi text
- sort chinese strings alphabetically by pinyin
- build chinese text search with pinyin matching
- handle polyphonic characters correctly
- convert pinyin with tone numbers to tone marks
- get first letters of chinese words for indexing

## When to choose
- you need accurate hanzi-to-pinyin conversion in Python or Go
- you need polyphone/heteronym support or custom pinyin dictionaries
- you need multiple romanization styles including bopomofo and Wade-Giles

## When to avoid
- you need Chinese word segmentation or full NLP pipelines rather than pinyin conversion
- you need machine translation or speech synthesis
- you work in a language ecosystem without a pypinyin port

## Facets
- artifact type: library
- maturity: stable
- function: nlp, cli, parser
- domain: developer-tools
- platform: python, cli, cross-platform
- tags: pinyin, chinese, hanzi, text-processing, transliteration, natural-language-processing, localization

## Member repositories
- mozillazg/python-pinyin (main) score 67
- mozillazg/go-pinyin (sdk) score 55
- mozillazg/pinyin-data (infra) score 54

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:15.981474+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:58:46.855270+00:00, confidence not recorded.
  - readme: https://github.com/mozillazg/python-pinyin (fetched 2026-08-28T04:09:15.981474+00:00, sha 83db2e412f6b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
