Convert a Chinese sentence to Pinyin or Jyutping
Project description
Python module which converts a Chinese sentence from Simplified to Mandarin/Pinyin and Traditional to Cantonese/Jyutping, outputting diacritics (accented characters)
Install
$ pip install pinyin_jyutping_sentence
Usage
>>> import pinyin_jyutping_sentence
>>> pinyin_jyutping_sentence.pinyin("提高口语")
'tígāo kǒuyǔ'
>>> pinyin_jyutping_sentence.jyutping("我出去攞野食")
'ngǒ cēothêoi ló jěsik'
How it works
Uses the Jieba library (https://github.com/fxsjy/jieba) to tokenize the sentence. Then words are converted to Pinyin/Jyutping either as a whole, or character by character, using the CC-Canto dictionary (http://cantonese.org/about.html). The Jyutping diacritic convertion is not standard but original described here: http://www.cantonese.sheik.co.uk/phorum/read.php?1,127274,129006
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for pinyin_jyutping_sentence-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3baa3dfc89c479438f864760ac6b771278ada72ad6c7da2d4005edd9fe6a5e8b |
|
MD5 | e9186e18f66d378817e01cef3d63bb8d |
|
BLAKE2b-256 | fbaf84f7eeb5a875d69994464d2545603c419a9127d95a347c64fe18eb9a713e |