From 1edd474bcb00939e06269b52b34792b5ee697b0f Mon Sep 17 00:00:00 2001 From: "david.95" Date: Tue, 9 Aug 2022 14:32:29 +0800 Subject: [PATCH] add filter for double punctuation in sentences; add homonym, test=tts --- paddlespeech/t2s/frontend/phonectic.py | 6 +++++- paddlespeech/t2s/frontend/zh_frontend.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/paddlespeech/t2s/frontend/phonectic.py b/paddlespeech/t2s/frontend/phonectic.py index 8e9f1173..ff8c149a 100644 --- a/paddlespeech/t2s/frontend/phonectic.py +++ b/paddlespeech/t2s/frontend/phonectic.py @@ -99,7 +99,11 @@ class English(Phonetics): if (phn in self.vocab_phones and phn not in self.punc) else "sp" for phn in phones ] - phones_list.append(phones) + # when sentences have double punctuations in the end, like "!\"",or "?\"", will get null list like [] + # add judge to filter it + if len(phones) != 0: + # replace unk phone with sp + phones_list.append(phones) if merge_sentences: merge_list = sum(phones_list, []) diff --git a/paddlespeech/t2s/frontend/zh_frontend.py b/paddlespeech/t2s/frontend/zh_frontend.py index 143ccbc1..06e7dca2 100644 --- a/paddlespeech/t2s/frontend/zh_frontend.py +++ b/paddlespeech/t2s/frontend/zh_frontend.py @@ -94,10 +94,12 @@ class Frontend(): large_pinyin.load() load_phrases_dict({u'开户行': [[u'ka1i'], [u'hu4'], [u'hang2']]}) + load_phrases_dict({u'俩个':[[u'lia3ng'],[u'ge4']]}) load_phrases_dict({u'发卡行': [[u'fa4'], [u'ka3'], [u'hang2']]}) load_phrases_dict({u'放款行': [[u'fa4ng'], [u'kua3n'], [u'hang2']]}) load_phrases_dict({u'茧行': [[u'jia3n'], [u'hang2']]}) load_phrases_dict({u'行号': [[u'hang2'], [u'ha4o']]}) + load_phrases_dict({u'行政': [[u'xing2'], [u'zhen4g']]}) load_phrases_dict({u'各地': [[u'ge4'], [u'di4']]}) load_phrases_dict({u'借还款': [[u'jie4'], [u'hua2n'], [u'kua3n']]}) load_phrases_dict({u'时间为': [[u'shi2'], [u'jia1n'], [u'we2i']]})