Better WA for glottal stop: now works also for multiple sentences in a single input text

This commit is contained in:
Jindrich Matousek 2022-04-06 14:37:51 +02:00
parent aae77dac07
commit 51d7ad161c
1 changed files with 14 additions and 6 deletions

View File

@ -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.