@@ -255,48 +255,6 @@ def get_phone_string(self, text, include_eos_symbol=True, for_feature_extraction
255255 # languages use different tones denoted by different numbering
256256 # systems. At this point in the script, it is attempted to unify
257257 # them all to the tones in the IPA standard.
258- if self .g2p_lang == "cmn-latn-pinyin" or self .g2p_lang == "cmn" :
259- """
260- handling for the espeak use-case
261-
262- phones = phones.replace(".", "") # no idea why espeak puts dots everywhere for Chinese
263-
264- # fix for a bug in espeak that ignores the second target in multi-target tones in mandarin, as proposed by GitHub user @GodEase
265- phones = ' '.join([re.sub(r'[1-5ɜ]', u[-1], p) for p, u in zip(phones.split(), utt.split())])
266-
267- # unfortunately the pypinyin package gives us only the unique characters instead of the base characters with modifiers,
268- # so we have to do every vowel separately ̌ ́ ̄ ̀
269-
270- # handle flat tone
271- phones = phones.replace("ā", "˥")
272- phones = phones.replace("ē", "˥")
273- phones = phones.replace("ī", "˥")
274- phones = phones.replace("ō", "˥")
275- phones = phones.replace("ū", "˥")
276- phones = phones.replace("ǖ", "˥")
277- # handle rising tone
278- phones = phones.replace("á", "˧˥")
279- phones = phones.replace("é", "˧˥")
280- phones = phones.replace("í", "˧˥")
281- phones = phones.replace("ó", "˧˥")
282- phones = phones.replace("ú", "˧˥")
283- phones = phones.replace("ǘ", "˧˥")
284- # handle dip tone
285- phones = phones.replace("ǎ", "˨˩˦")
286- phones = phones.replace("ĕ", "˨˩˦")
287- phones = phones.replace("ǐ", "˨˩˦")
288- phones = phones.replace("ǒ", "˨˩˦")
289- phones = phones.replace("ǔ", "˨˩˦")
290- phones = phones.replace("ǚ", "˨˩˦")
291- # handle falling tone
292- phones = phones.replace("à", "˥˩")
293- phones = phones.replace("è", "˥˩")
294- phones = phones.replace("ì", "˥˩")
295- phones = phones.replace("ò", "˥˩")
296- phones = phones.replace("ù", "˥˩")
297- phones = phones.replace("ǜ", "˥˩")
298- """
299-
300258 if self .g2p_lang == "vi" :
301259 phones = phones .replace ('1' , "˧" )
302260 phones = phones .replace ('2' , "˨˩" )
0 commit comments