From 69dd3bfe39677810f35e0e9867c2c7664915fe43 Mon Sep 17 00:00:00 2001 From: "david.95" Date: Tue, 30 Aug 2022 10:20:20 +0800 Subject: [PATCH] add special tone modifed case, test=tts --- paddlespeech/t2s/frontend/tone_sandhi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/paddlespeech/t2s/frontend/tone_sandhi.py b/paddlespeech/t2s/frontend/tone_sandhi.py index 6482e82f7..55b78b74d 100644 --- a/paddlespeech/t2s/frontend/tone_sandhi.py +++ b/paddlespeech/t2s/frontend/tone_sandhi.py @@ -84,7 +84,9 @@ class ToneSandhi(): if j - 1 >= 0 and item == word[j - 1] and pos[0] in {"n", "v", "a"}: finals[j] = finals[j][:-1] + "5" ge_idx = word.find("个") - if (len(word) > 1 and word[-1] in "吧呢啊呐噻嘛吖嗨呐哦哒滴哩哟喽啰耶喔诶") or (len(word)>1 and word[-2] in '好是帅酷棒衰烂臭狗糗') or (len(word)==1 and word[-1] in "额嗯"): + if (len(word) > 1 and word[-1] in "吧呢啊呐噻嘛吖嗨呐哦哒滴哩哟喽啰耶喔诶") or ( + len(word) > 1 and word[-2] in '好是帅酷棒衰烂臭狗糗' and word[-1]=='额') or ( + len(word) == 1 and word[-1] in "额嗯"): finals[-1] = finals[-1][:-1] + "5" elif len(word) >= 1 and word[-1] in "的地得": finals[-1] = finals[-1][:-1] + "5" @@ -347,7 +349,7 @@ class ToneSandhi(): def modified_tone(self, word: str, pos: str, finals: List[str]) -> List[str]: - + finals = self._bu_sandhi(word, finals) finals = self._yi_sandhi(word, finals) finals = self._neural_sandhi(word, pos, finals)