未验证 提交 a7362702 编写于 作者: 小湉湉's avatar 小湉湉 提交者: GitHub

Merge pull request #1310 from yt605155624/fix_yi_bug

[tts]fix tone_sandhi of yi
...@@ -65,6 +65,7 @@ class ToneSandhi(): ...@@ -65,6 +65,7 @@ class ToneSandhi():
self.must_not_neural_tone_words = { self.must_not_neural_tone_words = {
"男子", "女子", "分子", "原子", "量子", "莲子", "石子", "瓜子", "电子" "男子", "女子", "分子", "原子", "量子", "莲子", "石子", "瓜子", "电子"
} }
self.punc = ":,;。?!“”‘’':,;.?!"
# the meaning of jieba pos tag: https://blog.csdn.net/weixin_44174352/article/details/113731041 # the meaning of jieba pos tag: https://blog.csdn.net/weixin_44174352/article/details/113731041
# e.g. # e.g.
...@@ -147,7 +148,9 @@ class ToneSandhi(): ...@@ -147,7 +148,9 @@ class ToneSandhi():
finals[i] = finals[i][:-1] + "2" finals[i] = finals[i][:-1] + "2"
# "一" before non-tone4 should be yi4, e.g. 一天 # "一" before non-tone4 should be yi4, e.g. 一天
else: else:
finals[i] = finals[i][:-1] + "4" # "一" 后面如果是标点,还读一声
if word[i + 1] not in self.punc:
finals[i] = finals[i][:-1] + "4"
return finals return finals
def _split_word(self, word: str) -> List[str]: def _split_word(self, word: str) -> List[str]:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册