Skip to content

Commit

Permalink
make initialization of phonemizer backend optional to cover the case …
Browse files Browse the repository at this point in the history
…of chinese being used on older versions
  • Loading branch information
Flux9665 committed Nov 7, 2022
1 parent f3733e6 commit ee3b798
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Preprocessing/TextFrontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self,
print("Created a Polish Text-Frontend")

elif language == "cmn":
self.g2p_lang = "cmn-latn-pinyin" # in older versions of espeak this shorthand was zh
self.g2p_lang = "cmn" # we don't use espeak for this case
self.expand_abbreviations = convert_kanji_to_pinyin_mandarin
if not silent:
print("Created a Mandarin-Chinese Text-Frontend")
Expand Down Expand Up @@ -158,11 +158,12 @@ def __init__(self,
print("Language not supported yet")
sys.exit()

self.phonemizer_backend = EspeakBackend(language=self.g2p_lang,
punctuation_marks=';:,.!?¡¿—…"«»“”~/。【】、‥،؟“”؛',
preserve_punctuation=True,
language_switch='remove-flags',
with_stress=self.use_stress)
if self.g2p_lang != "cmn" or self.g2p_lang != "cmn-latn-pinyin":
self.phonemizer_backend = EspeakBackend(language=self.g2p_lang,
punctuation_marks=';:,.!?¡¿—…"«»“”~/。【】、‥،؟“”؛',
preserve_punctuation=True,
language_switch='remove-flags',
with_stress=self.use_stress)

self.phone_to_vector = generate_feature_table()
self.phone_to_id = get_phone_to_id()
Expand Down

0 comments on commit ee3b798

Please sign in to comment.