Skip to content

Commit

Permalink
Merge pull request #748 from NeonBohdan/gt-repo
Browse files Browse the repository at this point in the history
Error german_transliterate only when using german_cleaners
  • Loading branch information
dathudeptrai authored Mar 10, 2022
2 parents ab6efe4 + 07b49e9 commit 1368771
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tensorflow_tts/utils/cleaners.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
from tensorflow_tts.utils.korean import tokenize as ko_tokenize
from tensorflow_tts.utils.number_norm import normalize_numbers
from unidecode import unidecode
from german_transliterate.core import GermanTransliterate

try:
from german_transliterate.core import GermanTransliterate
except:
pass

# Regular expression matching whitespace:
_whitespace_re = re.compile(r"\s+")
Expand Down Expand Up @@ -111,5 +115,8 @@ def korean_cleaners(text):

def german_cleaners(text):
"""Pipeline for German text, including number and abbreviation expansion."""
text = GermanTransliterate(replace={';': ',', ':': ' '}, sep_abbreviation=' -- ').transliterate(text)
try:
text = GermanTransliterate(replace={';': ',', ':': ' '}, sep_abbreviation=' -- ').transliterate(text)
except NameError:
raise ModuleNotFoundError("Install german_transliterate package to use german_cleaners")
return text

0 comments on commit 1368771

Please sign in to comment.