Add a language_switch argument when calling phonemize

The language_switch defaults to keep-flags, but the result is inappropriate.
pull/10/head
tset-tset-tset 2020-09-01 01:15:42 +09:00 committed by GitHub
parent 34241815e7
commit 4f3917b9a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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: