__init__.py 438 B

123456789101112131415
  1. from text.symbols import *
  2. _symbol_to_id = {s: i for i, s in enumerate(symbols)}
  3. def cleaned_text_to_sequence(cleaned_text):
  4. '''Converts a string of text to a sequence of IDs corresponding to the symbols in the text.
  5. Args:
  6. text: string to convert to a sequence
  7. Returns:
  8. List of integers corresponding to the symbols in the text
  9. '''
  10. phones = [_symbol_to_id[symbol] for symbol in cleaned_text]
  11. return phones