(self)
| 69 | self.assertEqual(text_hat, "jˈoʊk ʌv wˈʌn ˈɛɡ bˈiːʔn lˈaɪt") |
| 70 | |
| 71 | def test_init_from_config(self): |
| 72 | @dataclass |
| 73 | class Characters(Coqpit): |
| 74 | characters_class: str = None |
| 75 | characters: str = _phonemes |
| 76 | punctuations: str = _punctuations |
| 77 | pad: str = _pad |
| 78 | eos: str = _eos |
| 79 | bos: str = _bos |
| 80 | blank: str = _blank |
| 81 | is_unique: bool = True |
| 82 | is_sorted: bool = True |
| 83 | |
| 84 | @dataclass |
| 85 | class TokenizerConfig(Coqpit): |
| 86 | enable_eos_bos_chars: bool = True |
| 87 | use_phonemes: bool = True |
| 88 | add_blank: bool = False |
| 89 | characters: str = field(default_factory=Characters) |
| 90 | phonemizer: str = "espeak" |
| 91 | phoneme_language: str = "tr" |
| 92 | text_cleaner: str = "phoneme_cleaners" |
| 93 | characters = field(default_factory=Characters) |
| 94 | |
| 95 | tokenizer_ph, _ = TTSTokenizer.init_from_config(TokenizerConfig()) |
| 96 | tokenizer_ph.phonemizer.backend = "espeak" |
| 97 | text = "Bu bir Örnek." |
| 98 | text_ph = "<BOS>" + self.ph.phonemize(text, separator="") + "<EOS>" |
| 99 | ids = tokenizer_ph.text_to_ids(text) |
| 100 | test_hat = tokenizer_ph.ids_to_text(ids) |
| 101 | self.assertEqual(text_ph, test_hat) |
nothing calls this directly
no test coverage detected