bopomofo

Translate chinese word to bopomofo


License
MIT
Install
pip install bopomofo==0.1.2

Documentation

Bopomofo

https://img.shields.io/travis/antfu/bopomofo.svg?style=flat-square https://img.shields.io/codecov/c/github/antfu/bopomofo.svg?style=flat-square https://img.shields.io/codacy/grade/c5ae3c7ed15f4b388218f83cda6782f9.svg?style=flat-square https://img.shields.io/pypi/v/bopomofo.svg?style=flat-square https://img.shields.io/pypi/pyversions/bopomofo.svg?style=flat-square https://img.shields.io/pypi/status/bopomofo.svg?style=flat-square https://img.shields.io/pypi/l/bopomofo.svg?style=flat-square

Translate 漢字 to ㄅㄆㄇㄈ, based on lxneng/xpinyin.

Install

pip install bopomofo

Usage

>>> from bopomofo import to_bopomofo
>>> to_bopomofo(u'注音')
'ㄓㄨˋ ㄧㄣ'

>>> to_bopomofo(u'注音', tones=False)
'ㄓㄨ ㄧㄣ'

>>> to_bopomofo(u'注音', u'')
'ㄓㄨˋ、ㄧㄣ'

>>> bopomofo.to_bopomofo(u'注音', first_tone_symbol=True)
'ㄓㄨˋ ㄧㄣˉ'