From 4f3917b9a673a4039e577a8098f545978df5ea2f Mon Sep 17 00:00:00 2001 From: tset-tset-tset <47290160+tset-tset-tset@users.noreply.github.com> Date: Tue, 1 Sep 2020 01:15:42 +0900 Subject: [PATCH] Add a language_switch argument when calling phonemize The language_switch defaults to keep-flags, but the result is inappropriate. --- mozilla_voice_tts/tts/utils/text/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mozilla_voice_tts/tts/utils/text/__init__.py b/mozilla_voice_tts/tts/utils/text/__init__.py index 191508be..9301d545 100644 --- a/mozilla_voice_tts/tts/utils/text/__init__.py +++ b/mozilla_voice_tts/tts/utils/text/__init__.py @@ -45,7 +45,7 @@ def text2phone(text, language): for punct in punctuations: ph = ph.replace('| |\n', '|'+punct+'| |', 1) elif version.parse(phonemizer.__version__) >= version.parse('2.1'): - ph = phonemize(text, separator=seperator, strip=False, njobs=1, backend='espeak', language=language, preserve_punctuation=True) + ph = phonemize(text, separator=seperator, strip=False, njobs=1, backend='espeak', language=language, preserve_punctuation=True, language_switch='remove-flags') # this is a simple fix for phonemizer. # https://github.com/bootphon/phonemizer/issues/32 if punctuations: