汉语拼音转换工具.
Project description
将汉语转为拼音。可以用于汉字注音、排序、检索。
基于 hotoo/pinyin 开发。
Documentation: http://pypinyin.mozillazg.com
License: MIT license
Python version: 2.6, 2.7, pypy, 3.3, 3.4, 3.5
特性
根据词组智能匹配最正确的拼音。
支持多音字。
简单的繁体支持。
支持多种不同拼音风格。
安装
$ pip install pypinyin
文档
详细文档请访问:http://pypinyin.mozillazg.com
使用示例
>>> from pypinyin import pinyin, lazy_pinyin
>>> import pypinyin
>>> pinyin(u'中心')
[[u'zh\u014dng'], [u'x\u012bn']]
>>> pinyin(u'中心', heteronym=True) # 启用多音字模式
[[u'zh\u014dng', u'zh\xf2ng'], [u'x\u012bn']]
>>> pinyin(u'中心', style=pypinyin.FIRST_LETTER) # 设置拼音风格
[['z'], ['x']]
>>> pinyin('中心', style=pypinyin.TONE2, heteronym=True)
[['zho1ng', 'zho4ng'], ['xi1n']]
>>> lazy_pinyin(u'中心') # 不考虑多音字的情况
['zhong', 'xin']
命令行工具:
$ pypinyin 音乐
yīn yuè
$ pypinyin -h
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pypinyin-0.11.1.tar.gz
(1.0 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypinyin-0.11.1.tar.gz.
File metadata
- Download URL: pypinyin-0.11.1.tar.gz
- Upload date:
- Size: 1.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
143729cfab177d6ad738fd68aa1028dcaffa235c41decc25eb3978a2b7e0a5ef
|
|
| MD5 |
9f1803c02f64f41586a4006e7fff210b
|
|
| BLAKE2b-256 |
727573aa7e4f4827e2445c16aad9edeb832e672be8a4456cfc2edc3d303ca9d7
|
File details
Details for the file pypinyin-0.11.1-py2.py3-none-any.whl.
File metadata
- Download URL: pypinyin-0.11.1-py2.py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a7ad2bf253f3aef496ddc932235c54b38e5b7b534fcbec470be6af31b3ea09e
|
|
| MD5 |
0d43d14647e131f114e2a31707cf5c77
|
|
| BLAKE2b-256 |
72e893a866b6b8979dbd07c4cd7801681c96373447aa712c8267173bb6b58199
|