We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lazy_pinyin(word, style=style.TONE3, tone_sandhi=True)返回的一些词未经三声变调,例如: lazy_pinyin(‘永远’, style=style.TONE3, tone_sandhi=True) 返回 ['yong3', 'yuan3'] (应当为yong2yuan3) lazy_pinyin(‘两手’, style=style.TONE3, tone_sandhi=True) 返回 ['liang3', 'shou3'] (应当为liang2shou3) lazy_pinyin(‘辗转反侧’, style=style.TONE3, tone_sandhi=True) 返回 ['zhan3', 'zhuan3', 'fan3', 'ce4'] (应当为zhan2zhuan2fan3ce4)
另一部分词例如‘你好’ni2hao3是正常的。
from pypinyin import pinyin, lazy_pinyin, Style lazy_pinyin('辗转反侧', style=Style.TONE3, tone_sandhi=True) ['zhan3', 'zhuan3', 'fan3', 'ce4']
The text was updated successfully, but these errors were encountered:
这个跟分词有关,目前的实现是只会对词语进行变调处理,你可以先分词然后再把分词后的结果传入:
# ['永远'] 表示是分词后的结果 lazy_pinyin(['永远'], style=style.TONE3, tone_sandhi=True)
辗转反侧 这个词语的结果(目前传 list 也会是这个结果)跟实现以及之前可能是对变调的理解不够全面有关,我再调研一下。
辗转反侧
等我有空的时候我再调研一下更全面的变调规则以及完善一下变调的实现方式。
Sorry, something went wrong.
非常感谢!
三声连续变调(例如辗转反侧)的规律其实有点复杂,而且也有一些争议,这个知乎回答给了一些比较基础的解释。可能连续变调问题超过了pypinyin应当实现的功能范围,现有的功能已经非常好啦!
再次感谢。
@mozillazg '你追我赶' 这个结果也不正确吧
>>> lazy_pinyin('你追我赶', style=Style.TONE, tone_sandhi=True) ['ní', 'zhuī', 'wǒ', 'gǎn']
No branches or pull requests
运行环境
问题描述
lazy_pinyin(word, style=style.TONE3, tone_sandhi=True)返回的一些词未经三声变调,例如:
lazy_pinyin(‘永远’, style=style.TONE3, tone_sandhi=True) 返回 ['yong3', 'yuan3'] (应当为yong2yuan3)
lazy_pinyin(‘两手’, style=style.TONE3, tone_sandhi=True) 返回 ['liang3', 'shou3'] (应当为liang2shou3)
lazy_pinyin(‘辗转反侧’, style=style.TONE3, tone_sandhi=True) 返回 ['zhan3', 'zhuan3', 'fan3', 'ce4'] (应当为zhan2zhuan2fan3ce4)
另一部分词例如‘你好’ni2hao3是正常的。
问题复现步骤
from pypinyin import pinyin, lazy_pinyin, Style
lazy_pinyin('辗转反侧', style=Style.TONE3, tone_sandhi=True)
['zhan3', 'zhuan3', 'fan3', 'ce4']
The text was updated successfully, but these errors were encountered: