This is the official repository of our paper G2PL:LEXICON ENHANCED CHINESE POLYPHONE DISAMBIGUATION WITH A NEW DATASET
pip install g2pL
pip install -r requirements.txt
点击此处下载模型及词向量等相关文件,并自行创建与g2pL同级目录的g2pL_files文件夹,将这些文件放入g2pL_files目录中。
You can set the tone style, the default tone style is 2.
from G2pL import G2PL
>>> g2p = G2PL()
>>> g2p("请您把这台收音机的音量调低一点。", 0)
['qing', 'nin', 'ba', 'zhe', 'tai', 'shou', 'yin', 'ji', 'de', 'yin', 'liang', 'tiao', 'di', 'yi', 'dian', '。']
>>> g2p("请您把这台收音机的音量调低一点。", 1)
['qǐng', 'nín', 'bǎ', 'zhè', 'tái', 'shōu', 'yīn', 'jī', 'de', 'yīn', 'liàng', 'tiáo', 'dī', 'yī', 'diǎn', '。']
>>> g2p("请您把这台收音机的音量调低一点。", 2)
['qing3', 'nin2', 'ba3', 'zhe4', 'tai2', 'shou1', 'yin1', 'ji1', 'de5', 'yin1', 'liang4', 'tiao2', 'di1', 'yi1', 'dian3', '。']