當前位置: 首頁>>代碼示例>>Python>>正文


Python text.cleaners方法代碼示例

本文整理匯總了Python中text.cleaners方法的典型用法代碼示例。如果您正苦於以下問題:Python text.cleaners方法的具體用法?Python text.cleaners怎麽用?Python text.cleaners使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在text的用法示例。


在下文中一共展示了text.cleaners方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sequence_to_text

# 需要導入模塊: import text [as 別名]
# 或者: from text import cleaners [as 別名]
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 
開發者ID:hccho2,項目名稱:Tacotron-Wavenet-Vocoder-Korean,代碼行數:25,代碼來源:__init__.py

示例2: _clean_text

# 需要導入模塊: import text [as 別名]
# 或者: from text import cleaners [as 別名]
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 
開發者ID:yanggeng1995,項目名稱:vae_tacotron,代碼行數:9,代碼來源:__init__.py

示例3: _clean_text

# 需要導入模塊: import text [as 別名]
# 或者: from text import cleaners [as 別名]
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 
開發者ID:Deepest-Project,項目名稱:MelNet,代碼行數:11,代碼來源:__init__.py

示例4: text_to_sequence

# 需要導入模塊: import text [as 別名]
# 或者: from text import cleaners [as 別名]
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) 
開發者ID:hccho2,項目名稱:Tacotron-Wavenet-Vocoder-Korean,代碼行數:7,代碼來源:__init__.py

示例5: _clean_text

# 需要導入模塊: import text [as 別名]
# 或者: from text import cleaners [as 別名]
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 
開發者ID:hccho2,項目名稱:Tacotron-Wavenet-Vocoder-Korean,代碼行數:10,代碼來源:__init__.py

示例6: _clean_text

# 需要導入模塊: import text [as 別名]
# 或者: from text import cleaners [as 別名]
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 
開發者ID:xcmyz,項目名稱:LightSpeech,代碼行數:9,代碼來源:__init__.py


注:本文中的text.cleaners方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。