Fix linting issues

This commit is contained in:
Michael Hansen 2021-06-16 15:26:36 -04:00 committed by Eren Gölge
parent 4d8426fa0a
commit 3f172b84d8
4 changed files with 8 additions and 4 deletions

View File

@ -299,4 +299,5 @@ if __name__ == "__main__":
args = parser.parse_args() args = parser.parse_args()
c = load_config(args.config_path) c = load_config(args.config_path)
c.audio["do_trim_silence"] = False # IMPORTANT!!!!!!!!!!!!!!! disable to align mel
main(args) main(args)

View File

@ -25,7 +25,7 @@ def text_to_seqvec(text, CONFIG):
CONFIG.enable_eos_bos_chars, CONFIG.enable_eos_bos_chars,
tp=CONFIG.characters, tp=CONFIG.characters,
add_blank=CONFIG.add_blank, add_blank=CONFIG.add_blank,
use_espeak_phonemes=CONFIG.use_espeak_phonemes use_espeak_phonemes=CONFIG.use_espeak_phonemes,
), ),
dtype=np.int32, dtype=np.int32,
) )

View File

@ -54,7 +54,7 @@ def text2phone(text, language, use_espeak_phonemes=False):
if gruut.is_language_supported(language): if gruut.is_language_supported(language):
# Use gruut for phonemization # Use gruut for phonemization
phonemizer_args={ phonemizer_args = {
"remove_stress": True, "remove_stress": True,
"ipa_minor_breaks": False, # don't replace commas/semi-colons with IPA | "ipa_minor_breaks": False, # don't replace commas/semi-colons with IPA |
"ipa_major_breaks": False, # don't replace periods with IPA ‖ "ipa_major_breaks": False, # don't replace periods with IPA ‖
@ -104,7 +104,9 @@ def pad_with_eos_bos(phoneme_sequence, tp=None):
return [_phonemes_to_id[_bos]] + list(phoneme_sequence) + [_phonemes_to_id[_eos]] return [_phonemes_to_id[_bos]] + list(phoneme_sequence) + [_phonemes_to_id[_eos]]
def phoneme_to_sequence(text, cleaner_names, language, enable_eos_bos=False, tp=None, add_blank=False, use_espeak_phonemes=False): def phoneme_to_sequence(
text, cleaner_names, language, enable_eos_bos=False, tp=None, add_blank=False, use_espeak_phonemes=False
):
# pylint: disable=global-statement # pylint: disable=global-statement
global _phonemes_to_id, _phonemes global _phonemes_to_id, _phonemes
if tp: if tp:

View File

@ -26,6 +26,7 @@ class TextProcessingTextCase(unittest.TestCase):
self._test_phoneme_to_sequence(add_blank=True) self._test_phoneme_to_sequence(add_blank=True)
def _test_phoneme_to_sequence(self, add_blank): def _test_phoneme_to_sequence(self, add_blank):
"""Verify en-us sentence phonemes"""
text_cleaner = ["phoneme_cleaners"] text_cleaner = ["phoneme_cleaners"]
sequence = phoneme_to_sequence(EXAMPLE_TEXT, text_cleaner, LANG, add_blank=add_blank, use_espeak_phonemes=True) sequence = phoneme_to_sequence(EXAMPLE_TEXT, text_cleaner, LANG, add_blank=add_blank, use_espeak_phonemes=True)
text_hat = sequence_to_phoneme(sequence) text_hat = sequence_to_phoneme(sequence)
@ -92,7 +93,7 @@ class TextProcessingTextCase(unittest.TestCase):
self.assertEqual(text_hat, gt) self.assertEqual(text_hat, gt)
def test_text2phone(self): def test_text2phone(self):
text = "Recent research at Harvard has shown meditating for as little as 8 weeks can actually increase, the grey matter in the parts of the brain responsible for emotional regulation and learning!" """Verify phones directly (with |)"""
ph = text2phone(EXAMPLE_TEXT, LANG) ph = text2phone(EXAMPLE_TEXT, LANG)
self.assertEqual(ph, EXPECTED_PHONEMES) self.assertEqual(ph, EXPECTED_PHONEMES)