Skip to main content

translate chinese hanzi to pinyin by python

Project description

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]

Project details


Release history Release notifications

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

History Node

0.5.2

History Node

0.5.1

This version
History Node

0.5.0

History Node

0.4.9

History Node

0.4.8

History Node

0.4.7

History Node

0.4.6

History Node

0.4.5

History Node

0.4.4

History Node

0.4.3

History Node

0.4.2

History Node

0.4.1

History Node

0.4

History Node

0.3

History Node

0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
xpinyin-0.5.0.tar.gz (127.0 kB) Copy SHA256 hash SHA256 Source None Oct 25, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page