汉语拼音转换工具.
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.12.0.tar.gz
(732.2 kB
view details)
Built Distribution
pypinyin-0.12.0-py2.py3-none-any.whl
(740.6 kB
view details)
File details
Details for the file pypinyin-0.12.0.tar.gz
.
File metadata
- Download URL: pypinyin-0.12.0.tar.gz
- Upload date:
- Size: 732.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1687d10851301f4fcf0d921908f8d908874646eaf2dc479e353b6274469eed05 |
|
MD5 | bb12ecd4603dd32e146662b53ad09549 |
|
BLAKE2b-256 | 3260e948142ac615c201ac6105ae7aa7fbe226acde1b062a54cd6f595f8feab4 |
File details
Details for the file pypinyin-0.12.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pypinyin-0.12.0-py2.py3-none-any.whl
- Upload date:
- Size: 740.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4beb35cad411bc95899741af34bc658274d5a404ccfa77c8e062c5ad9cd3d20 |
|
MD5 | a303878bdc39022db2265dfa2d1f8850 |
|
BLAKE2b-256 | 36ff37abc398adfcac866cd97fb82ca773aa15b154d3c01f2ae275df221e17e4 |