Skip to main content

汉语拼音转换工具

Project description

汉语拼音转换工具(Python 版)

Build Pypi version Pypi downloads

将汉语转为拼音。可以用于汉字注音、排序、检索。基于 pinyinjs 开发。

Installation

To install pypinyin, simply:

$ pip install pypinyin

Basic Usage

>>> from pypinyin import 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'中心', pypinyin.STYLE_INITIALS)  # 设置拼音风格
[['zh'], ['x']]

Changelog

0.2.0 (2013-09-22)

  • 完善对中英文混合字符串的支持:

    >> pypinyin.pinyin(u'你好abc')
    [[u'n\u01d0'], [u'h\u01ceo'], [u'abc']]

0.1.0 (2013-09-21)

  • Initial Release

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.2.0.zip (604.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page