From 99dc07a7dd50f4be1ccafa78b93c9ac493efc90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Fri, 16 Apr 2021 18:29:52 +0200 Subject: [PATCH] add ```unique``` param to keep scglow models compatible (they are duplicate symbols ins the character set) --- TTS/tts/utils/text/symbols.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TTS/tts/utils/text/symbols.py b/TTS/tts/utils/text/symbols.py index 6efe3920..8b9c683e 100644 --- a/TTS/tts/utils/text/symbols.py +++ b/TTS/tts/utils/text/symbols.py @@ -8,16 +8,17 @@ through Unidecode. For other data, you can modify _characters. See TRAINING_DATA def make_symbols( - characters, phonemes=None, punctuations="!'(),-.:;? ", pad="_", eos="~", bos="^" + characters, phonemes=None, punctuations="!'(),-.:;? ", pad="_", eos="~", bos="^", unique=True, ): # pylint: disable=redefined-outer-name - """ Function to create symbols and phonemes """ + """ Function to create symbols and phonemes + TODO: create phonemes_to_id and symbols_to_id dicts here.""" _symbols = list(characters) _symbols = [bos] + _symbols if len(bos) > 0 and bos is not None else _symbols _symbols = [eos] + _symbols if len(bos) > 0 and eos is not None else _symbols _symbols = [pad] + _symbols if len(bos) > 0 and pad is not None else _symbols _phonemes = None if phonemes is not None: - _phonemes_sorted = sorted(list(set(phonemes))) + _phonemes_sorted = sorted(list(set(phonemes))) if unique else sorted(list(phonemes)) # this is to keep previous models compatible. # Prepend "@" to ARPAbet symbols to ensure uniqueness (some are the same as uppercase letters): _arpabet = ["@" + s for s in _phonemes_sorted] # Export all symbols: