video-dubbing / TTS /tests /text_tests /test_belarusian_phonemizer.py
artificialguybr's picture
Upload 650 files
45ee559
raw
history blame
903 Bytes
import os
import unittest
import warnings
from TTS.tts.utils.text.belarusian.phonemizer import belarusian_text_to_phonemes
_TEST_CASES = """
Π€Π°Π½Π΅Ρ‚Ρ‹Ρ‡Π½Ρ‹ ΠΊΠ°Π½Π²Π΅Ρ€Ρ‚Π°Ρ€/fanΚ²Ι›ΛˆtΙ¨tΝ‘Κ‚nΙ¨ kanˈvΚ²Ι›rtar
Гэтак ΠΌΡ‹ ΠΏΡ€Π°Ρ†Π°Π²Π°Π»Ρ–/ΛˆΙ£Ι›tak ˈmΙ¨ pratΝ‘saˈvalΚ²i
"""
class TestText(unittest.TestCase):
def test_belarusian_text_to_phonemes(self):
try:
os.environ["BEL_FANETYKA_JAR"]
except KeyError:
warnings.warn(
"You need to define 'BEL_FANETYKA_JAR' environment variable as path to the fanetyka.jar file to test Belarusian phonemizer",
Warning,
)
return
for line in _TEST_CASES.strip().split("\n"):
text, phonemes = line.split("/")
self.assertEqual(belarusian_text_to_phonemes(text), phonemes)
if __name__ == "__main__":
unittest.main()