예제 #1
0
    def pinyin(self, sentence):
        pinyinlist = HanLP.convertToPinyinList(sentence)
        res = []
        for pinyin in pinyinlist:
            res.append(str(pinyin))

        return ''.join(res)
예제 #2
0
파일: api.py 프로젝트: wisonwang/pyhanlp
def convertToPinyinList(text):
    """
     * 转化为拼音
     *
     * @param text 待解析的文本
     * @return 一个拼音列表

    """
    return HanLP.convertToPinyinList(text)
예제 #3
0
def get_shengmu():
    # convertToPinyinFirstCharString
    for item in HanLP.convertToPinyinList('你好'):
        print(item.getShengmu())