Make style

This commit is contained in:
Eren Gölge 2021-11-24 18:46:48 +01:00
parent bb389479a4
commit 8c8093ce23
3 changed files with 18 additions and 20 deletions

View File

@ -141,4 +141,4 @@ class TestZH_CN_Phonemizer(unittest.TestCase):
self.assertIsInstance(self.phonemizer.version(), str)
def test_is_available(self):
self.assertTrue(self.phonemizer.is_available())
self.assertTrue(self.phonemizer.is_available())

View File

@ -1,14 +1,17 @@
import unittest
from TTS.tts.utils.text.punctuation import Punctuation, _DEF_PUNCS
from TTS.tts.utils.text.punctuation import _DEF_PUNCS, Punctuation
class PunctuationTest(unittest.TestCase):
def setUp(self):
self.punctuation = Punctuation()
self.test_texts = [("This, is my text ... to be striped !! from text?", "This is my text to be striped from text"),
("This, is my text ... to be striped !! from text", "This is my text to be striped from text"),
("This, is my text ... to be striped from text?", "This is my text to be striped from text"),
("This, is my text to be striped from text", "This is my text to be striped from text")
]
self.test_texts = [
("This, is my text ... to be striped !! from text?", "This is my text to be striped from text"),
("This, is my text ... to be striped !! from text", "This is my text to be striped from text"),
("This, is my text ... to be striped from text?", "This is my text to be striped from text"),
("This, is my text to be striped from text", "This is my text to be striped from text"),
]
def test_get_set_puncs(self):
self.punctuation.puncs = "-="
@ -26,5 +29,5 @@ class PunctuationTest(unittest.TestCase):
for text, gt in self.test_texts:
text_striped, puncs_map = self.punctuation.strip_to_restore(text)
text_restored = self.punctuation.restore(text_striped, puncs_map)
self.assertEqual(' '.join(text_striped), gt)
self.assertEqual(" ".join(text_striped), gt)
self.assertEqual(text_restored[0], text)

View File

@ -1,19 +1,19 @@
import unittest
from dataclasses import dataclass
from os import sep
import unittest
from TTS.tts.utils.text.tokenizer import TTSTokenizer
from TTS.tts.utils.text.characters import Graphemes, IPAPhonemes, _phonemes, _punctuations, _eos, _bos, _pad, _blank
from TTS.tts.utils.text.phonemizers import ESpeak
from coqpit import Coqpit
from TTS.tts.utils.text.characters import Graphemes, IPAPhonemes, _blank, _bos, _eos, _pad, _phonemes, _punctuations
from TTS.tts.utils.text.phonemizers import ESpeak
from TTS.tts.utils.text.tokenizer import TTSTokenizer
class TestTTSTokenizer(unittest.TestCase):
def setUp(self):
self.tokenizer = TTSTokenizer(use_phonemes=False, characters=Graphemes())
self.ph = ESpeak('tr')
self.ph = ESpeak("tr")
self.tokenizer_ph = TTSTokenizer(use_phonemes=True, characters=IPAPhonemes(), phonemizer=self.ph)
def test_encode_decode_graphemes(self):
@ -53,7 +53,6 @@ class TestTTSTokenizer(unittest.TestCase):
self.tokenizer_ph.print_logs()
def test_init_from_config(self):
@dataclass
class Characters(Coqpit):
characters: str = _phonemes
@ -80,9 +79,5 @@ class TestTTSTokenizer(unittest.TestCase):
text = "Bu bir Örnek."
text_ph = "<BOS>" + self.ph.phonemize(text, separator="") + "<EOS>"
ids = tokenizer_ph.text_to_ids(text)
test_hat = tokenizer_ph.ids_to_text(ids)
test_hat = tokenizer_ph.ids_to_text(ids)
self.assertEqual(text_ph, test_hat)