mozillazg / python-pinyin

汉字转拼音(pypinyin)
https://pypinyin.readthedocs.io
MIT License
4.9k stars 612 forks source link

拼音顺序颠倒问题 #122

Closed zhouygg closed 6 years ago

zhouygg commented 6 years ago

运行环境

问题描述

pinyin_list = pinyin(u'物美价廉',style=Style.TONE2,heteronym=False)
print(pinyin_list)

[['jia4'], ['lia2n'], ['wu4'], ['me3i']]

mozillazg commented 6 years ago

@zhouygg 感谢反馈!这个词语的拼音有问题,可以先暂时通过自定义词组拼音库的方式覆盖掉:

In [1]: from pypinyin import pinyin, Style, load_phrases_dict

In [2]: pinyin(u'物美价廉',style=Style.TONE2,heteronym=False)
Out[2]: [['jia4'], ['lia2n'], ['wu4'], ['me3i']]

In [3]: load_phrases_dict({u'物美价廉': [[u'wù'], [u'měi'], [u'jià'], [u'lián']]})

In [4]: pinyin(u'物美价廉',style=Style.TONE2,heteronym=False)
Out[4]: [['wu4'], ['me3i'], ['jia4'], ['lia2n']]

后面会更新一下这个词语的拼音。