chibinjiang / pinyin

A simple python script to translate chinese to pinyin based on Mandarin.dat

Home Page:http://lxyu.github.io/pinyin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pinyin

image

image

image

Translate chinese chars to pinyin based on Mandarin.dat

Install

$ pip install pinyin

Usage

>>> import pinyin
>>> print pinyin.get('你 好')
 hǎo

>>> print pinyin.get('你好', format="strip", delimiter=" ")
ni hao

>>> print pinyin.get('你好', format="numerical")
ni3hao3

>>> print pinyin.get_initial('你好')
n h

Note

format must be one of: numerical/diacritical/strip

About

A simple python script to translate chinese to pinyin based on Mandarin.dat

http://lxyu.github.io/pinyin

License:MIT License


Languages

Language:Python 100.0%