class_docstr: 🐸TTS tokenizer to convert input characters to token IDs and back.
  
  Token IDs for OOV chars are discarded but those are stored in `self.not_found_characters` for later.
  
  Args:
      use_phonemes (bool):
          Whether to use phonemes instead of characters. Defaults to False.
  
      characters (Characters):
          A Characters object to use for character-to-ID and ID-to-character mappings.
  
      text_cleaner (callable):
          A function to pre-process the text before tokenization and phonemization. Defaults to None.
  
      phonemizer (Phonemizer):
          A phonemizer object or a dict that maps language codes to phonemizer objects. Defaults to None.
  
  Example:
  
      >>> from TTS.tts.utils.text.tokenizer import TTSTokenizer
      >>> tokenizer = TTSTokenizer(use_phonemes=False, characters=Graphemes())
      >>> text = "Hello world!"
      >>> ids = tokenizer.text_to_ids(text)
      >>> text_hat = tokenizer.ids_to_text(ids)
      >>> assert text == text_hat
class_docstr_tok: ["\ud83d\udc38TTS","tokenizer","to","convert","input","characters","to","token","IDs","and","back",".","Token","IDs","for","OOV","chars","are","discarded","but","those","are","stored","in","`","self.not_found_characters","`","for","later",".","Args",":","use_phonemes","(","bool",")",":","Whether","to","use","phonemes","instead","of","characters",".","Defaults","to","False",".","characters","(","Characters",")",":","A","Characters","object","to","use","for","character-to-ID","and","ID-to-character","mappings",".","text_cleaner","(","callable",")",":","A","function","to","pre-process","the","text","before","tokenization","and","phonemization",".","Defaults","to","None",".","phonemizer","(","Phonemizer",")",":","A","phonemizer","object","or","a","dict","that","maps","language","codes","to","phonemizer","objects",".","Defaults","to","None",".","Example",":",">",">",">","from","TTS.tts.utils.text.tokenizer","import","TTSTokenizer",">",">",">","tokenizer","=","TTSTokenizer","(","use_phonemes=False",",","characters=Graphemes","(",")",")",">",">",">","text","=","``","Hello","world","!","''",">",">",">","ids","=","tokenizer.text_to_ids","(","text",")",">",">",">","text_hat","=","tokenizer.ids_to_text","(","ids",")",">",">",">","assert","text","==","text_hat"]
docstr: Init Tokenizer object from config
  
  Args:
      config (Coqpit): Coqpit model config.
      characters (BaseCharacters): Defines the model character set. If not set, use the default options based on
          the config values. Defaults to None.
docstr_tok: ["Init","Tokenizer","object","from","config","Args",":","config","(","Coqpit",")",":","Coqpit","model","config",".","characters","(","BaseCharacters",")",":","Defines","the","model","character","set",".","If","not","set",",","use","the","default","options","based","on","the","config","values",".","Defaults","to","None","."]
code: def init_from_config(
      config: "Coqpit", characters: "BaseCharacters" = None
  ):
      """Init Tokenizer object from config
  
      Args:
          config (Coqpit): Coqpit model config.
          characters (BaseCharacters): Defines the model character set. If not set, use the default options based on
              the config values. Defaults to None.
      """
      # init cleaners
      text_cleaner = None
      if isinstance(config.text_cleaner, (str, list)):
          text_cleaner = getattr(cleaners, config.text_cleaner)
  
      # init characters
      if characters is None:
          # set characters based on defined characters class
          if config.characters and config.characters.characters_class:
              CharactersClass = import_class(
                  config.characters.characters_class
              )
              characters, new_config = CharactersClass.init_from_config(
                  config
              )
          # set characters based on config
          else:
              if config.use_phonemes:
                  # init phoneme set
                  (
                      characters,
                      new_config,
                  ) = IPAPhonemes().init_from_config(config)
              else:
                  # init character set
                  characters, new_config = Graphemes().init_from_config(
                      config
                  )
  
      else:
          characters, new_config = characters.init_from_config(config)
  
      # set characters class
      new_config.characters.characters_class = get_import_path(
          characters
      )
  
      # init phonemizer
      phonemizer = None
      if config.use_phonemes:
          if (
              "phonemizer" in config
              and config.phonemizer == "multi_phonemizer"
          ):
              lang_to_phonemizer_name = {}
              for dataset in config.datasets:
                  if dataset.language != "":
                      lang_to_phonemizer_name[
                          dataset.language
                      ] = dataset.phonemizer
                  else:
                      raise ValueError(
                          "Multi phonemizer requires language to be set for each dataset."
                      )
              phonemizer = MultiPhonemizer(lang_to_phonemizer_name)
          else:
              phonemizer_kwargs = {"language": config.phoneme_language}
              if "phonemizer" in config and config.phonemizer:
                  phonemizer = get_phonemizer_by_name(
                      config.phonemizer, **phonemizer_kwargs
                  )
              else:
                  try:
                      phonemizer = get_phonemizer_by_name(
                          DEF_LANG_TO_PHONEMIZER[
                              config.phoneme_language
                          ],
                          **phonemizer_kwargs,
                      )
                      new_config.phonemizer = phonemizer.name()
                  except KeyError as e:
                      raise ValueError(
                          f"""No phonemizer found for language {config.phoneme_language}.
                              You may need to install a third party library for this language."""
                      ) from e
  
      return (
          TTSTokenizer(
              config.use_phonemes,
              text_cleaner,
              characters,
              phonemizer,
              config.add_blank,
              config.enable_eos_bos_chars,
          ),
          new_config,
      )
  
file_path: TTS/TTS/tts/utils/text/tokenizer.py
imports: from typing import Callable, Dict, List, Union
  from TTS.tts.utils.text import cleaners
  from TTS.tts.utils.text.characters import Graphemes, IPAPhonemes
  from TTS.tts.utils.text.phonemizers import DEF_LANG_TO_PHONEMIZER, get_phonemizer_by_name
  from TTS.tts.utils.text.phonemizers.multi_phonemizer import MultiPhonemizer
  from TTS.utils.generic_utils import get_import_path, import_class
label_desc: Use image node_id 11 for calling the TTSTokenizer obj's underlying member method code with example usage: obj.init_from_config(config, characters) and returns: TTSTokenizer,  new_config