Convert numbered pinyin to pinyin with tone marks

前端 未结 7 1138
春和景丽
春和景丽 2021-02-04 02:40

Are there any scripts, libraries, or programs using Python, or BASH tools (e.g. awk, perl, sed) which can correc

相关标签:
7条回答
  • 2021-02-04 03:03

    The cjklib library does cover your needs:

    Either use the Python shell:

    >>> from cjklib.reading import ReadingFactory
    >>> f = ReadingFactory()
    >>> print f.convert('Bei3jing1', 'Pinyin', 'Pinyin', sourceOptions={'toneMarkType': 'numbers'})
    Běijīng
    

    Or just the command line:

    $ cjknife -m Bei3jing1
    Běijīng
    

    Disclaimer: I developed that library.

    0 讨论(0)
提交回复
热议问题