Are there any scripts, libraries, or programs using Python
, or BASH
tools (e.g. awk
, perl
, sed
) which can correc
With python dragonmapper (pip install dragonmapper
):
Hanzi to pinyin
from dragonmapper.transcriptions import hanzi
hanzi.to_pinyin("过河拆桥。")
# >>> 'guòhéchāiqiáo。'
hanzi.to_pinyin("过河拆桥。", accented=False)
# >>> 'guo4he2chai1qiao2。'
Accented pinyin to numbered pinyin
from dragonmapper.transcriptions import accented_to_numbered
accented_to_numbered('guò hé chāi qiáo。')
# >>> 'guo4 he2 chai1 qiao2。'
Numbered pinyin to accented pinyin
from dragonmapper.transcriptions import numbered_to_accented
numbered_to_accented('guo4 he2 chai1 qiao2。')
# >>> 'guò hé chāi qiáo。'
DISCLAIMER: I have no connection with the dragonmapper author