skip to navigation
skip to content

Not Logged In

xpinyin 0.5.0

translate chinese hanzi to pinyin by python

xpinyin

https://travis-ci.org/lxneng/xpinyin.png?branch=master https://pypip.in/d/xpinyin/badge.png

translate chinese hanzi to pinyin by python, inspired by flyerhzm’s chinese_pinyin gem

Install

pip install xpinyin

Usage

In [1]: from xpinyin import Pinyin

In [2]: p = Pinyin()

In [3]: p.get_pinyin(u"上海")
Out[3]: 'shang-hai'

In [4]: p.get_pinyin(u"上海", '')
Out[4]: 'shanghai'

In [5]: p.get_pinyin(u"上海", ' ')
Out[5]: 'shang hai'

In [6]: p.get_initial(u"上")
Out[6]: 'S'

In [7]: p.get_initials(u"上海")
Out[7]: 'S-H'

In [8]: p.get_initials(u"上海", u'')
Out[8]: 'SH'

In [9]: p.get_initials(u"上海", u' ')
Out[9]: 'S H'

请输入utf8编码汉字

Changelog

0.4.9 - Oct. 25, 2013

  • change README and get_initials; add get_initial [tangsty]

0.4.8 - Jun. 16, 2013

  • change README and get_initials; add get_initial [tangsty]
  • add download status image to README.rst [lxneng]
  • add travis status image to README.rst [lxneng]
  • add .travis.yml [lxneng]
  • 添加测试 [lxneng]
  • 解决翻译中英文混合句子问题 [lxneng]
 
File Type Py Version Uploaded on Size
xpinyin-0.5.0.tar.gz (md5) Source 2013-10-25 124KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 121 downloads in the last week
  • 899 downloads in the last month