speechbrain.utils.text_to_sequence module

from https://github.com/keithito/tacotron

Summary

Functions:

basic_cleaners

Basic pipeline that lowercases and collapses whitespace without transliteration.

collapse_whitespace

Replaces whitespace by " " in the text

convert_to_ascii

Converts text to ascii

english_cleaners

Pipeline for English text, including number and abbreviation expansion.

expand_abbreviations

expand abbreviations pre-defined

lowercase

lowercase the text

sequence_to_text

Converts a sequence of IDs back to a string

text_to_sequence

Returns a list of integers corresponding to the symbols in the text.

transliteration_cleaners

Pipeline for non-English text that transliterates to ASCII.

Reference

speechbrain.utils.text_to_sequence.valid_symbols = ['AA', 'AA0', 'AA1', 'AA2', 'AE', 'AE0', 'AE1', 'AE2', 'AH', 'AH0', 'AH1', 'AH2', 'AO', 'AO0', 'AO1', 'AO2', 'AW', 'AW0', 'AW1', 'AW2', 'AY', 'AY0', 'AY1', 'AY2', 'B', 'CH', 'D', 'DH', 'EH', 'EH0', 'EH1', 'EH2', 'ER', 'ER0', 'ER1', 'ER2', 'EY', 'EY0', 'EY1', 'EY2', 'F', 'G', 'HH', 'IH', 'IH0', 'IH1', 'IH2', 'IY', 'IY0', 'IY1', 'IY2', 'JH', 'K', 'L', 'M', 'N', 'NG', 'OW', 'OW0', 'OW1', 'OW2', 'OY', 'OY0', 'OY1', 'OY2', 'P', 'R', 'S', 'SH', 'T', 'TH', 'UH', 'UH0', 'UH1', 'UH2', 'UW', 'UW0', 'UW1', 'UW2', 'V', 'W', 'Y', 'Z', 'ZH']

Defines the set of symbols used in text input to the model. The default is a set of ASCII characters that works well for English. For other data, you can modify _characters. See TRAINING_DATA.md for details.

speechbrain.utils.text_to_sequence.expand_abbreviations(text)[source]

expand abbreviations pre-defined

speechbrain.utils.text_to_sequence.lowercase(text)[source]

lowercase the text

speechbrain.utils.text_to_sequence.collapse_whitespace(text)[source]

Replaces whitespace by ” ” in the text

speechbrain.utils.text_to_sequence.convert_to_ascii(text)[source]

Converts text to ascii

speechbrain.utils.text_to_sequence.basic_cleaners(text)[source]

Basic pipeline that lowercases and collapses whitespace without transliteration.

speechbrain.utils.text_to_sequence.transliteration_cleaners(text)[source]

Pipeline for non-English text that transliterates to ASCII.

speechbrain.utils.text_to_sequence.english_cleaners(text)[source]

Pipeline for English text, including number and abbreviation expansion.

speechbrain.utils.text_to_sequence.text_to_sequence(text, cleaner_names)[source]

Returns a list of integers corresponding to the symbols in the text. Converts a string of text to a sequence of IDs corresponding to the symbols in the text. The text can optionally have ARPAbet sequences enclosed in curly braces embedded in it. For example, “Turn left on {HH AW1 S S T AH0 N} Street.”

Parameters
  • text (str) – string to convert to a sequence

  • cleaner_names (list) – names of the cleaner functions to run the text through

speechbrain.utils.text_to_sequence.sequence_to_text(sequence)[source]

Converts a sequence of IDs back to a string