Python text.cleaners() Examples

The following are 14 code examples of text.cleaners(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module text , or try the search function .
Example #1
Source File: __init__.py    From Tacotron-Wavenet-Vocoder-Korean with MIT License 6 votes vote down vote up
def sequence_to_text(sequence, skip_eos_and_pad=False, combine_jamo=False):
    '''Converts a sequence of IDs back to a string'''
    cleaner_names=[x.strip() for x in hparams.cleaners.split(',')]
    if 'english_cleaners' in cleaner_names and isEn==False:
        convert_to_en_symbols()
        
    result = ''
    for symbol_id in sequence:
        if symbol_id in _id_to_symbol:
            s = _id_to_symbol[symbol_id]
            # Enclose ARPAbet back in curly braces:
            if len(s) > 1 and s[0] == '@':
                s = '{%s}' % s[1:]

            if not skip_eos_and_pad or s not in [EOS, PAD]:
                result += s

    result = result.replace('}{', ' ')

    if combine_jamo:
        return jamo_to_korean(result)
    else:
        return result 
Example #2
Source File: __init__.py    From Tacotron2-Wavenet-Korean-TTS with MIT License 6 votes vote down vote up
def sequence_to_text(sequence, skip_eos_and_pad=False, combine_jamo=False):
    '''Converts a sequence of IDs back to a string'''
    cleaner_names=[x.strip() for x in hparams.cleaners.split(',')]
    if 'english_cleaners' in cleaner_names and isEn==False:
        convert_to_en_symbols()
        
    result = ''
    for symbol_id in sequence:
        if symbol_id in _id_to_symbol:
            s = _id_to_symbol[symbol_id]
            # Enclose ARPAbet back in curly braces:
            if len(s) > 1 and s[0] == '@':
                s = '{%s}' % s[1:]

            if not skip_eos_and_pad or s not in [EOS, PAD]:
                result += s

    result = result.replace('}{', ' ')

    if combine_jamo:
        return jamo_to_korean(result)
    else:
        return result 
Example #3
Source File: __init__.py    From vae_tacotron with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
  for name in cleaner_names:
    cleaner = getattr(cleaners, name)
    if not cleaner:
      raise Exception('Unknown cleaner: %s' % name)
    text = cleaner(text)
  return text 
Example #4
Source File: __init__.py    From Transformer-TTS with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
  for name in cleaner_names:
    cleaner = getattr(cleaners, name)
    if not cleaner:
      raise Exception('Unknown cleaner: %s' % name)
    text = cleaner(text)
  return text 
Example #5
Source File: __init__.py    From arabic-tacotron-tts with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
  for name in cleaner_names:
    cleaner = getattr(cleaners, name)
    if not cleaner:
      raise Exception('Unknown cleaner: %s' % name)
    text = cleaner(text)
  return text 
Example #6
Source File: __init__.py    From MelNet with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
    
    for name in cleaner_names:
        cleaner = getattr(cleaners, name)
        if not cleaner:
            raise Exception('Unknown cleaner: %s' % name)
        text = cleaner(text) # '존경하는' --> ['ᄌ', 'ᅩ', 'ᆫ', 'ᄀ', 'ᅧ', 'ᆼ', 'ᄒ', 'ᅡ', 'ᄂ', 'ᅳ', 'ᆫ', '~']

    return text 
Example #7
Source File: __init__.py    From Tacotron-Wavenet-Vocoder-Korean with MIT License 5 votes vote down vote up
def text_to_sequence(text, as_token=False):    
    cleaner_names = [x.strip() for x in hparams.cleaners.split(',')]
    if ('english_cleaners' in cleaner_names) and isEn==False:
        convert_to_en_symbols()
    return _text_to_sequence(text, cleaner_names, as_token) 
Example #8
Source File: __init__.py    From Tacotron-Wavenet-Vocoder-Korean with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
    
    for name in cleaner_names:
        cleaner = getattr(cleaners, name)
        if not cleaner:
            raise Exception('Unknown cleaner: %s' % name)
        text = cleaner(text) # '존경하는' --> ['ᄌ', 'ᅩ', 'ᆫ', 'ᄀ', 'ᅧ', 'ᆼ', 'ᄒ', 'ᅡ', 'ᄂ', 'ᅳ', 'ᆫ', '~']
    return text 
Example #9
Source File: __init__.py    From LightSpeech with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
    for name in cleaner_names:
        cleaner = getattr(cleaners, name)
        if not cleaner:
            raise Exception('Unknown cleaner: %s' % name)
        text = cleaner(text)
    return text 
Example #10
Source File: __init__.py    From tacotron with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
  for name in cleaner_names:
    cleaner = getattr(cleaners, name)
    if not cleaner:
      raise Exception('Unknown cleaner: %s' % name)
    text = cleaner(text)
  return text 
Example #11
Source File: __init__.py    From FastSpeech with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
    for name in cleaner_names:
        cleaner = getattr(cleaners, name)
        if not cleaner:
            raise Exception('Unknown cleaner: %s' % name)
        text = cleaner(text)
    return text 
Example #12
Source File: __init__.py    From Tacotron2-PyTorch with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
  for name in cleaner_names:
    cleaner = getattr(cleaners, name)
    if not cleaner:
      raise Exception('Unknown cleaner: %s' % name)
    text = cleaner(text)
  return text 
Example #13
Source File: __init__.py    From Tacotron2-Wavenet-Korean-TTS with MIT License 5 votes vote down vote up
def text_to_sequence(text, as_token=False):    
    cleaner_names = [x.strip() for x in hparams.cleaners.split(',')]
    if ('english_cleaners' in cleaner_names) and isEn==False:
        convert_to_en_symbols()
    return _text_to_sequence(text, cleaner_names, as_token) 
Example #14
Source File: __init__.py    From Tacotron2-Wavenet-Korean-TTS with MIT License 5 votes vote down vote up
def _clean_text(text, cleaner_names):
    
    for name in cleaner_names:
        cleaner = getattr(cleaners, name)
        if not cleaner:
            raise Exception('Unknown cleaner: %s' % name)
        text = cleaner(text) # '존경하는' --> ['ᄌ', 'ᅩ', 'ᆫ', 'ᄀ', 'ᅧ', 'ᆼ', 'ᄒ', 'ᅡ', 'ᄂ', 'ᅳ', 'ᆫ', '~']
    return text