style and linter fixes

This commit is contained in:
Eren Gölge 2021-04-26 15:22:24 +02:00
parent 4cf211348d
commit b82daa5e86
3 changed files with 8 additions and 4 deletions

View File

@ -429,11 +429,13 @@ class AudioProcessor(object):
def dequantize(x, bits):
return 2 * x / (2 ** bits - 1) - 1
def _log(x, base):
if base == 10:
return np.log10(x)
return np.log(x)
def _exp(x, base):
if base == 10:
return np.power(10, x)

View File

@ -38,6 +38,8 @@ class Synthesizer(object):
If you have certain special characters in your text, you need to handle
them before providing the text to Synthesizer.
TODO: set the segmenter based on the source language
Args:
tts_checkpoint (str): path to the tts model file.
tts_config_path (str): path to the tts config file.
@ -152,7 +154,7 @@ class Synthesizer(object):
if use_cuda:
self.vocoder_model.cuda()
def _split_into_sentences(self, text) -> List[str]:
def split_into_sentences(self, text) -> List[str]:
"""Split give text into sentences.
Args:
@ -187,7 +189,7 @@ class Synthesizer(object):
"""
start_time = time.time()
wavs = []
sens = self._split_into_sentences(text)
sens = self.split_into_sentences(text)
print(" > Text splitted to sentences.")
print(sens)

View File

@ -35,8 +35,8 @@ class SynthesizerTest(unittest.TestCase):
def test_split_into_sentences(self):
"""Check demo server sentences split as expected"""
print("\n > Testing demo server sentence splitting")
# pylint: disable=attribute-defined-outside-init
self.seg = Synthesizer.get_segmenter("en")
# pylint: disable=attribute-defined-outside-init, protected-access
self.seg = Synthesizer._get_segmenter("en")
sis = Synthesizer.split_into_sentences
assert sis(self, "Hello. Two sentences") == ["Hello.", "Two sentences"]
assert sis(self, "He went to meet the adviser from Scott, Waltman & Co. next morning.") == [