当前位置: 首页>>代码示例>>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;未经允许,请勿转载。