mirror of https://github.com/coqui-ai/TTS.git
Better WA for glottal stop: now works also for multiple sentences in a single input text
This commit is contained in:
parent
aae77dac07
commit
51d7ad161c
|
@ -156,12 +156,20 @@ class Synthesizer(object):
|
|||
List[str]: list of sentences.
|
||||
"""
|
||||
# JMa
|
||||
# WA: fix glottal stop (!): "ahoj, !", "ahoj." => "ahoj, !ahoj."
|
||||
# Exclamation mark (!) at the end of the sentence should not be affected.
|
||||
# return self.seg.segment(text)
|
||||
if "!" in self.tts_config.characters.characters:
|
||||
# Our proprietary phonetic mode enabled: the input text is assumed
|
||||
# to be a sequence of phones plus punctuations (without "!") and pauses (#, $).
|
||||
# (!) is a regular character, not a punctuation
|
||||
# WA: Glottal stop [!] is temporarily replaced with [*] to prevent
|
||||
# boundary detection.
|
||||
#
|
||||
# Example: "!ahoj, !adame." -> ["!ahoj, !", "adame."]
|
||||
# Fix: "!ahoj, !adame." -> ["!ahoj, !adame."]
|
||||
text = text.replace("!", "*")
|
||||
sents = self.seg.segment(text)
|
||||
split_text = " ".join(sents)
|
||||
return [split_text.replace("! ", "!")]
|
||||
return [s.replace("*", "!") for s in sents]
|
||||
else: # Original code
|
||||
return self.seg.segment(text)
|
||||
|
||||
def save_wav(self, wav: List[int], path: str) -> None:
|
||||
"""Save the waveform as a file.
|
||||
|
|
Loading…
Reference in New Issue