使用 pinyin-data 和 phrase-pinyin-data 中的拼音数据文件覆盖 pypinyin 中的自带拼音数据,实现只使用某个或某些拼音数据文件中的拼音数据的需求
Project description
pypinyin-dict
使用 pinyin-data 和 phrase-pinyin-data 中的拼音数据文件覆盖 pypinyin 中的内置拼音数据, 实现只使用某个或某些拼音数据文件中的拼音数据的需求。
安装
$ pip install pypinyin-dict
使用示例
>>> from pypinyin import pinyin
>>> pinyin('枯萎')
[['kū'], ['wēi']]
# 使用 phrase-pinyin-data 项目中 cc_cedict.txt 文件中的拼音数据优化结果
>>> from pypinyin_dict.phrase_pinyin_data import cc_cedict
>>> cc_cedict.load()
>>> pinyin('枯萎')
[['kū'], ['wěi']]
>>> pinyin('扔', heteronym=True)
[['rēng', 'rèng']]
# 使用 pinyin-data 项目中 cc_cedict.txt 文件中的拼音数据优化结果
>>> from pypinyin_dict.pinyin_data import kxhc1983
>>> kxhc1983.load()
>>> pinyin('扔', heteronym=True)
[['rēng']]
模块介绍
各个模块与数据文件关系如下(所有模块中都有一个 load()
函数用于导入对应的拼音数据,使用方法详见上方【使用示例】):
# pinyin-data/kTGHZ2013.txt
>> from pypinyin_dict.pinyin_data import ktghz2013
# pinyin-data/kHanyuPinyin.txt
>> from pypinyin_dict.pinyin_data import khanyupinyin
# pinyin-data/kXHC1983.txt
>> from pypinyin_dict.pinyin_data import kxhc1983
# pinyin-data/kHanyuPinlu.txt
>> from pypinyin_dict.pinyin_data import khanyupinlu
# pinyin-data/kMandarin_8105.txt
>> from pypinyin_dict.pinyin_data import kmandarin_8105
# pinyin-data/pinyin.txt
>> from pypinyin_dict.pinyin_data import pinyin
# pinyin-data/zdic.txt
>> from pypinyin_dict.pinyin_data import zdic
# pinyin-data/cc_cedict.txt
>> from pypinyin_dict.pinyin_data import cc_cedict
# phrase-pinyin-data/pinyin.txt
>> from pypinyin_dict.phrase_pinyin_data import pinyin
# phrase-pinyin-data/zdic_cibs.txt
>> from pypinyin_dict.phrase_pinyin_data import zdic_cibs
# phrase-pinyin-data/zdic_cybs.txt
>> from pypinyin_dict.phrase_pinyin_data import zdic_cybs
# phrase-pinyin-data/cc_cedict.txt
>> from pypinyin_dict.phrase_pinyin_data import cc_cedict
# phrase-pinyin-data/large_pinyin.txt
>> from pypinyin_dict.phrase_pinyin_data import large_pinyin
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pypinyin-dict-0.2.0.tar.gz
(9.0 MB
view details)
Built Distribution
File details
Details for the file pypinyin-dict-0.2.0.tar.gz
.
File metadata
- Download URL: pypinyin-dict-0.2.0.tar.gz
- Upload date:
- Size: 9.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30f484dd24035c9f6946e4e78bf4400237ffe7af433e8c1cecc670bc3803ff80 |
|
MD5 | 90c43969a7312bf3468e26b54d5921b5 |
|
BLAKE2b-256 | 035b708705dd71a4fd849cb2b20d1e79a2edeb958711fc329e41d5ccc0ea01ca |
File details
Details for the file pypinyin_dict-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pypinyin_dict-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.3 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a355261e443e292b5a353dd37526a8357bcd9de1b7c58f62d847f1ad6ea399f |
|
MD5 | db6a20e4ce24262bfcb117582a38a1d0 |
|
BLAKE2b-256 | efa78940ae69a72174724e76186356322455d78fdf3fdbeea30a40b91116e6df |