Convert Chinese to Pinyin

I found places on the Internet, such as http://www.chinesetopinyin.com/ , that convert Chinese characters to pinyin (Latinization). Does anyone know how to do this, or have a database that can be analyzed?

EDIT: I use C #, but actually prefer the / flatfile database.

+5
source share
3 answers

possible solution using Python :

I think the Unicode database contains pinyin Latin for Chinese characters, but they are not included in the module data unicodedata.

, cjklib, :

# coding: UTF-8
import cjklib
from cjklib.characterlookup import CharacterLookup

c = u'好'

cjk = CharacterLookup('T')
readings = cjk.getReadingForCharacter(c, 'Pinyin')
for r in readings:
    print r

:

hāo
hǎo
hào

UPDATE

cjklib cjknife, .

+6
+3

All Articles