2019-04-24 11:58:55 +02:00
|
|
|
import os
|
2021-04-12 11:47:39 +02:00
|
|
|
import unittest
|
2019-04-24 11:58:55 +02:00
|
|
|
|
2021-04-12 11:47:39 +02:00
|
|
|
from tests import get_tests_input_path
|
2021-05-31 10:07:12 +02:00
|
|
|
from TTS.tts.datasets.formatters import common_voice
|
2019-04-24 11:58:55 +02:00
|
|
|
|
|
|
|
|
|
2022-02-11 23:03:43 +01:00
|
|
|
class TestTTSFormatters(unittest.TestCase):
|
2021-04-12 11:47:39 +02:00
|
|
|
def test_common_voice_preprocessor(self): # pylint: disable=no-self-use
|
2019-04-24 11:58:55 +02:00
|
|
|
root_path = get_tests_input_path()
|
|
|
|
|
meta_file = "common_voice.tsv"
|
|
|
|
|
items = common_voice(root_path, meta_file)
|
2022-02-11 23:03:43 +01:00
|
|
|
assert items[0]["text"] == "The applicants are invited for coffee and visa is given immediately."
|
|
|
|
|
assert items[0]["audio_file"] == os.path.join(get_tests_input_path(), "clips", "common_voice_en_20005954.wav")
|
2019-04-24 11:58:55 +02:00
|
|
|
|
2022-02-11 23:03:43 +01:00
|
|
|
assert items[-1]["text"] == "Competition for limited resources has also resulted in some local conflicts."
|
|
|
|
|
assert items[-1]["audio_file"] == os.path.join(get_tests_input_path(), "clips", "common_voice_en_19737074.wav")
|