From a861e56e91b42b65eaab2781ba615efd4f95ecc3 Mon Sep 17 00:00:00 2001 From: TianYuan Date: Fri, 26 Nov 2021 11:04:29 +0000 Subject: [PATCH] rm space for pure Chinese --- demos/style_fs2/style_syn.py | 2 +- paddlespeech/t2s/exps/fastspeech2/inference.py | 2 +- paddlespeech/t2s/exps/fastspeech2/multi_spk_synthesize_e2e.py | 2 +- paddlespeech/t2s/exps/fastspeech2/synthesize_e2e.py | 2 +- paddlespeech/t2s/exps/fastspeech2/synthesize_e2e_melgan.py | 2 +- paddlespeech/t2s/exps/speedyspeech/inference.py | 2 +- paddlespeech/t2s/exps/speedyspeech/synthesize_e2e.py | 2 +- paddlespeech/t2s/frontend/zh_frontend.py | 2 ++ paddlespeech/t2s/frontend/zh_normalization/text_normlization.py | 2 ++ 9 files changed, 11 insertions(+), 7 deletions(-) diff --git a/demos/style_fs2/style_syn.py b/demos/style_fs2/style_syn.py index 9bd61579..0ed87e7c 100644 --- a/demos/style_fs2/style_syn.py +++ b/demos/style_fs2/style_syn.py @@ -36,7 +36,7 @@ def evaluate(args, fastspeech2_config, pwg_config): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) with open(args.phones_dict, "r") as f: diff --git a/paddlespeech/t2s/exps/fastspeech2/inference.py b/paddlespeech/t2s/exps/fastspeech2/inference.py index 8ea64b99..1d6ea667 100644 --- a/paddlespeech/t2s/exps/fastspeech2/inference.py +++ b/paddlespeech/t2s/exps/fastspeech2/inference.py @@ -84,7 +84,7 @@ def main(): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) for utt_id, sentence in sentences: diff --git a/paddlespeech/t2s/exps/fastspeech2/multi_spk_synthesize_e2e.py b/paddlespeech/t2s/exps/fastspeech2/multi_spk_synthesize_e2e.py index a2f8ada6..9dc3ab4b 100644 --- a/paddlespeech/t2s/exps/fastspeech2/multi_spk_synthesize_e2e.py +++ b/paddlespeech/t2s/exps/fastspeech2/multi_spk_synthesize_e2e.py @@ -39,7 +39,7 @@ def evaluate(args, fastspeech2_config, pwg_config): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) with open(args.phones_dict, "r") as f: diff --git a/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e.py b/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e.py index aac2c054..47c8a5e7 100644 --- a/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e.py +++ b/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e.py @@ -42,7 +42,7 @@ def evaluate(args, fastspeech2_config, pwg_config): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) with open(args.phones_dict, "r") as f: diff --git a/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e_melgan.py b/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e_melgan.py index 527e5d41..4d5d1ac4 100644 --- a/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e_melgan.py +++ b/paddlespeech/t2s/exps/fastspeech2/synthesize_e2e_melgan.py @@ -42,7 +42,7 @@ def evaluate(args, fastspeech2_config, melgan_config): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) with open(args.phones_dict, "r") as f: diff --git a/paddlespeech/t2s/exps/speedyspeech/inference.py b/paddlespeech/t2s/exps/speedyspeech/inference.py index 75f937de..0ed2e0bf 100644 --- a/paddlespeech/t2s/exps/speedyspeech/inference.py +++ b/paddlespeech/t2s/exps/speedyspeech/inference.py @@ -89,7 +89,7 @@ def main(): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) for utt_id, sentence in sentences: diff --git a/paddlespeech/t2s/exps/speedyspeech/synthesize_e2e.py b/paddlespeech/t2s/exps/speedyspeech/synthesize_e2e.py index b0418940..403d3508 100644 --- a/paddlespeech/t2s/exps/speedyspeech/synthesize_e2e.py +++ b/paddlespeech/t2s/exps/speedyspeech/synthesize_e2e.py @@ -42,7 +42,7 @@ def evaluate(args, speedyspeech_config, pwg_config): for line in f: items = line.strip().split() utt_id = items[0] - sentence = ",".join(items[1:]) + sentence = "".join(items[1:]) sentences.append((utt_id, sentence)) with open(args.phones_dict, "r") as f: diff --git a/paddlespeech/t2s/frontend/zh_frontend.py b/paddlespeech/t2s/frontend/zh_frontend.py index 5b69477d..84852b9c 100644 --- a/paddlespeech/t2s/frontend/zh_frontend.py +++ b/paddlespeech/t2s/frontend/zh_frontend.py @@ -129,6 +129,8 @@ class Frontend(): # we discriminate i, ii and iii if c and c not in self.punc: phones.append(c) + if c and c in self.punc: + phones.append('sp') if v and v not in self.punc: phones.append(v) # add sp between sentence (replace the last punc with sp) diff --git a/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py b/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py index c3885fb9..c68caeeb 100644 --- a/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py +++ b/paddlespeech/t2s/frontend/zh_normalization/text_normlization.py @@ -64,6 +64,8 @@ class TextNormalizer(): List[str] Sentences. """ + # Only for pure Chinese here + text = text.replace(" ", "") text = self.SENTENCE_SPLITOR.sub(r'\1\n', text) text = text.strip() sentences = [sentence.strip() for sentence in re.split(r'\n+', text)] -- GitLab