class_docstr: A pretrained model implementation for Grapheme-to-Phoneme (G2P) models
  that take raw natural language text as an input and
  
  Example
  -------
  >>> text = ("English is tough. It can be understood "
  ...         "through thorough thought though")
  >>> from speechbrain.inference.text import GraphemeToPhoneme
  >>> tmpdir = getfixture('tmpdir')
  >>> g2p = GraphemeToPhoneme.from_hparams('path/to/model', savedir=tmpdir) # doctest: +SKIP
  >>> phonemes = g2p.g2p(text) # doctest: +SKIP
docstr: Performs the Grapheme-to-Phoneme conversion
  
  Arguments
  ---------
  text: str or list[str]
      a single string to be encoded to phonemes - or a
      sequence of strings
  
  Returns
  -------
  result: list
      if a single example was provided, the return value is a
      single list of phonemes
docstr_tok: ["Performs","the","Grapheme-to-Phoneme","conversion","Arguments","--","--","--","--","-","text",":","str","or","list","[","str","]","a","single","string","to","be","encoded","to","phonemes","-","or","a","sequence","of","strings","Returns","--","--","--","-","result",":","list","if","a","single","example","was","provided",",","the","return","value","is","a","single","list","of","phonemes"]
code: def g2p(self, text):
      """Performs the Grapheme-to-Phoneme conversion
  
      Arguments
      ---------
      text: str or list[str]
          a single string to be encoded to phonemes - or a
          sequence of strings
  
      Returns
      -------
      result: list
          if a single example was provided, the return value is a
          single list of phonemes
      """
      single = isinstance(text, str)
      if single:
          text = [text]
  
      model_inputs = self.encode_input({"txt": text})
      self._update_graphemes(model_inputs)
      model_outputs = self.mods.model(**model_inputs)
      decoded_output = self.decode_output(model_outputs)
      phonemes = decoded_output["phonemes"]
      if single:
          phonemes = phonemes[0]
      return phonemes
  
imports: import torch
  from itertools import chain
  from speechbrain.inference.interfaces import Pretrained, EncodeDecodePipelineMixin
label_desc: Use image node_id 4 for calling the GraphemeToPhoneme obj's underlying member method code with example usage: obj.g2p(text) and returns: phonemes