天天看點

pypinyin 擷取拼音,作為智能裝置的喚醒比對結果

from pypinyin import lazy_pinyin,TONE,TONE2,TONE3,NORMAL

a = "小七同學"
b = "小琦同學"
c = "小雅同學"
d = "小娅同學"

print(lazy_pinyin(a,style=NORMAL))
print(lazy_pinyin(b,style=NORMAL))
print(lazy_pinyin(c,style=NORMAL))
print(lazy_pinyin(c,style=NORMAL))

print(lazy_pinyin(a,style=TONE))
print(lazy_pinyin(b,style=TONE))
print(lazy_pinyin(c,style=TONE))
print(lazy_pinyin(c,style=TONE))

print(lazy_pinyin(a,style=TONE2))
print(lazy_pinyin(b,style=TONE2))
print(lazy_pinyin(c,style=TONE2))
print(lazy_pinyin(c,style=TONE2))

print(lazy_pinyin(a,style=TONE3))
print(lazy_pinyin(b,style=TONE3))
print(lazy_pinyin(c,style=TONE3))
print(lazy_pinyin(c,style=TONE3))

['xiao', 'qi', 'tong', 'xue']
['xiao', 'qi', 'tong', 'xue']
['xiao', 'ya', 'tong', 'xue']
['xiao', 'ya', 'tong', 'xue']
['xiǎo', 'qī', 'tóng', 'xué']
['xiǎo', 'qí', 'tóng', 'xué']
['xiǎo', 'yǎ', 'tóng', 'xué']
['xiǎo', 'yǎ', 'tóng', 'xué']
['xia3o', 'qi1', 'to2ng', 'xue2']
['xia3o', 'qi2', 'to2ng', 'xue2']
['xia3o', 'ya3', 'to2ng', 'xue2']
['xia3o', 'ya3', 'to2ng', 'xue2']
['xiao3', 'qi1', 'tong2', 'xue2']
['xiao3', 'qi2', 'tong2', 'xue2']
['xiao3', 'ya3', 'tong2', 'xue2']
['xiao3', 'ya3', 'tong2', 'xue2']
      

  

多思考也是一種努力,做出正确的分析和選擇,因為我們的時間和精力都有限,是以把時間花在更有價值的地方。

下一篇: Mybatis