add ```unique``` argument to make_symbols to fix the incompat. issue of the

SC-Glow models
This commit is contained in:
Eren Gölge 2021-04-21 13:12:35 +02:00
parent d08888e603
commit e97126314c
1 changed files with 11 additions and 3 deletions

View File

@ -8,9 +8,15 @@ through Unidecode. For other data, you can modify _characters. See TRAINING_DATA
def make_symbols(
characters, phonemes=None, punctuations="!'(),-.:;? ", pad="_", eos="~", bos="^", unique=True,
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
@ -18,7 +24,9 @@ def make_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))) if unique else sorted(list(phonemes)) # this is to keep previous models compatible.
_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: