Skip to content

Commit

Permalink
Fix german_transliterate module error
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonBohdan committed Mar 8, 2022
1 parent ab6efe4 commit 07b49e9
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 07b49e9

Please sign in to comment.