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.
|
List[str]: list of sentences.
|
||||||
"""
|
"""
|
||||||
# JMa
|
# JMa
|
||||||
# WA: fix glottal stop (!): "ahoj, !", "ahoj." => "ahoj, !ahoj."
|
if "!" in self.tts_config.characters.characters:
|
||||||
# Exclamation mark (!) at the end of the sentence should not be affected.
|
# Our proprietary phonetic mode enabled: the input text is assumed
|
||||||
# return self.seg.segment(text)
|
# 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)
|
sents = self.seg.segment(text)
|
||||||
split_text = " ".join(sents)
|
return [s.replace("*", "!") for s in sents]
|
||||||
return [split_text.replace("! ", "!")]
|
else: # Original code
|
||||||
|
return self.seg.segment(text)
|
||||||
|
|
||||||
def save_wav(self, wav: List[int], path: str) -> None:
|
def save_wav(self, wav: List[int], path: str) -> None:
|
||||||
"""Save the waveform as a file.
|
"""Save the waveform as a file.
|
||||||
|
|
Loading…
Reference in New Issue