Registry / pypinyin-dict

pypinyin-dict

JSON →
library0.9.0pypypi✓ verified 85d ago

pypinyin-dict provides custom pinyin data files from pinyin-data and phrase-pinyin-data to override or supplement the built-in pinyin data in pypinyin. It allows users to use only specific pinyin data sources. Current version 0.9.0, with stable but infrequent releases.

pip install pypinyin-dict
INSTALL
IMPORT
SIG · PYPINYIN-DICT
P
pypinyin-dict
pythonv0.9.0
Install
15.7s avg
Import
Disk
245MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 754.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 15.7s · import 0.000s · 755MB
245MB installed
● package 245MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pinyin_data
from pypinyin_dict import pinyin_data
from pypinyin_dict.pinyin_data import pinyin_data
phrase_pinyin_data
from pypinyin_dict import phrase_pinyin_data
from pypinyin_dict.pinyin_data import phrase_pinyin_data

Load a custom pinyin data file (kxhc1983) and use pypinyin normally.

import pypinyin from pypinyin_dict.pinyin_data import kxhc1983 # Load the kxhc1983 pinyin data kxhc1983.load() # Now pypinyin will use the loaded data result = pypinyin.pinyin('你好', style=pypinyin.Style.NORMAL) print(result) # [['ni'], ['hao']]
Debug
Known issues
breakingIn version 0.9.0, the load() function was removed from the top-level pypinyin_dict module. You must import from specific submodules like pypinyin_dict.pinyin_data or pypinyin_dict.phrase_pinyin_data.
fix
Change 'from pypinyin_dict import load' to 'from pypinyin_dict.pinyin_data import kxhc1983' and call kxhc1983.load()
affects: >=0.9.0
breakingThe module pypinyin_dict.pinyin_data has replaced the old pypinyin_dict.data. If you used pypinyin_dict.data in versions prior to 0.9.0, it no longer exists.
fix
Use pypinyin_dict.pinyin_data instead of pypinyin_dict.data
affects: >=0.9.0
gotchaCalling load() multiple times on the same data file can cause unexpected behavior. It is recommended to load only once at the start of your application.
fix
Ensure that load() is called only once before any pypinyin calls.
affects: all
Upgrade
Version history
0.9.0latest on PyPI · released Jan 12, 2025
Audit
Dependencies
pypinyinrequiredpypinyin-dict is a plugin that modifies pypinyin's dictionary; pypinyin must be installed.
Agent activity
4 hits · last 30 days
node
4
Resources
pypinyin-dict — pip install pypinyin-dict · libregistry