{"id":21778,"library":"pypinyin-dict","title":"pypinyin-dict","description":"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.","status":"active","version":"0.9.0","language":"python","source_language":"en","source_url":"https://github.com/mozillazg/pypinyin-dict","tags":["pinyin","chinese","dict","pypinyin"],"install":[{"cmd":"pip install pypinyin-dict","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"pypinyin-dict is a plugin that modifies pypinyin's dictionary; pypinyin must be installed.","package":"pypinyin","optional":false}],"imports":[{"note":"load function was removed in 0.9.0; use direct imports from submodules.","wrong":"from pypinyin_dict import load","symbol":"load","correct":"from pypinyin_dict.pinyin_data import pinyin_data\nfrom pypinyin_dict.pinyin_data import phrase_pinyin_data"}],"quickstart":{"code":"import pypinyin\nfrom pypinyin_dict.pinyin_data import kxhc1983\n\n# Load the kxhc1983 pinyin data\nkxhc1983.load()\n\n# Now pypinyin will use the loaded data\nresult = pypinyin.pinyin('你好', style=pypinyin.Style.NORMAL)\nprint(result)  # [['ni'], ['hao']]","lang":"python","description":"Load a custom pinyin data file (kxhc1983) and use pypinyin normally."},"warnings":[{"fix":"Change 'from pypinyin_dict import load' to 'from pypinyin_dict.pinyin_data import kxhc1983' and call kxhc1983.load()","message":"In 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.","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Use pypinyin_dict.pinyin_data instead of pypinyin_dict.data","message":"The 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.","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Ensure that load() is called only once before any pypinyin calls.","message":"Calling 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.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from pypinyin_dict.pinyin_data import kxhc1983' and call kxhc1983.load()","cause":"Version 0.9.0 removed the top-level load() function.","error":"ImportError: cannot import name 'load' from 'pypinyin_dict'"},{"fix":"Upgrade to the latest version: pip install --upgrade pypinyin-dict","cause":"Old version of pypinyin-dict, before the module restructuring (pre-0.9.0).","error":"AttributeError: module 'pypinyin_dict' has no attribute 'pinyin_data'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}