From 906467118d04698c25d62280cef2d09046c2d555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:09:07 +0800 Subject: [PATCH] Apply suggestions from code review --- paddlespeech/t2s/frontend/tone_sandhi.py | 2 +- paddlespeech/t2s/frontend/zh_frontend.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paddlespeech/t2s/frontend/tone_sandhi.py b/paddlespeech/t2s/frontend/tone_sandhi.py index bc021d5aa..d8688115b 100644 --- a/paddlespeech/t2s/frontend/tone_sandhi.py +++ b/paddlespeech/t2s/frontend/tone_sandhi.py @@ -303,7 +303,7 @@ class ToneSandhi(): for (word, pos) in seg: orig_finals = lazy_pinyin( word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - # after pypinyin==0.41.0, 嗯 will be processed as "", so we need to change it to "n2" + # after pypinyin==0.44.0, '嗯' need to be n2, cause the initial and final consonants cannot be empty at the same time en_index = [index for index, c in enumerate(word) if c == "嗯"] for i in en_index: orig_finals[i] = "n2" diff --git a/paddlespeech/t2s/frontend/zh_frontend.py b/paddlespeech/t2s/frontend/zh_frontend.py index 505fd4699..95c75a7f0 100644 --- a/paddlespeech/t2s/frontend/zh_frontend.py +++ b/paddlespeech/t2s/frontend/zh_frontend.py @@ -173,7 +173,7 @@ class Frontend(): word, neutral_tone_with_five=True, style=Style.INITIALS) orig_finals = lazy_pinyin( word, neutral_tone_with_five=True, style=Style.FINALS_TONE3) - # after pypinyin==0.41.0, 嗯 will be processed as "", so we need to change it to "n2" + # after pypinyin==0.44.0, '嗯' need to be n2, cause the initial and final consonants cannot be empty at the same time en_index = [index for index, c in enumerate(word) if c == "嗯"] for i in en_index: orig_finals[i] = "n2"