From 855d5b811198070bd5843be2fb2dce44231023b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stardust=C2=B7=E5=87=8F?= Date: Sat, 23 Sep 2023 20:16:51 +0800 Subject: [PATCH] Update __init__.py --- text/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/text/__init__.py b/text/__init__.py index 8dd10db04..897ff10b7 100644 --- a/text/__init__.py +++ b/text/__init__.py @@ -11,7 +11,12 @@ def cleaned_text_to_sequence(cleaned_text, tones, language): Returns: List of integers corresponding to the symbols in the text """ - phones = [_symbol_to_id[symbol] for symbol in cleaned_text] + phones = [] # _symbol_to_id[symbol] for symbol in cleaned_text + for symbol in cleaned_text: + try: + phones.append(_symbol_to_id[symbol]) + except KeyError: + phones.append(0) # symbol not found in ID map, use 0('_') by default tone_start = language_tone_start_map[language] tones = [i + tone_start for i in tones] lang_id = language_id_map[language]