class_docstr: Generates target sentence/ids using a base model.
  
  It generates target sentence/ids for a model (a pretrained transformer model or a function).
class_docstr_tok: ["Generates","target","sentence\/ids","using","a","base","model",".","It","generates","target","sentence\/ids","for","a","model","(","a","pretrained","transformer","model","or","a","function",")","."]
docstr: Calculates if special tokens are present in the beginning/end of the model generated output.
  
  Parameters
  ----------
  output: list
      A list of output token ids.
  
  Returns
  -------
  dict
      Dictionary of prefix and suffix lengths concerning special tokens in output ids.
docstr_tok: ["Calculates","if","special","tokens","are","present","in","the","beginning\/end","of","the","model","generated","output",".","Parameters","--","--","--","--","--","output",":","list","A","list","of","output","token","ids",".","Returns","--","--","--","-","dict","Dictionary","of","prefix","and","suffix","lengths","concerning","special","tokens","in","output","ids","."]
code: def parse_prefix_suffix_for_model_generate_output(self, output):
      """Calculates if special tokens are present in the beginning/end of the model generated output.
  
      Parameters
      ----------
      output: list
          A list of output token ids.
  
      Returns
      -------
      dict
          Dictionary of prefix and suffix lengths concerning special tokens in output ids.
      """
      keep_prefix, keep_suffix = 0, 0
      if (
          self.tokenizer.convert_ids_to_tokens(output[0])
          in self.tokenizer.special_tokens_map.values()
      ):
          keep_prefix = 1
      if (
          len(output) > 1
          and self.tokenizer.convert_ids_to_tokens(output[-1])
          in self.tokenizer.special_tokens_map.values()
      ):
          keep_suffix = 1
      return {"keep_prefix": keep_prefix, "keep_suffix": keep_suffix}
  
file_path: shap/shap/models/_text_generation.py
imports: import numpy
  from .._serializable import Deserializer, Serializer
  from ..utils import safe_isinstance
  from ._model import Model
label_desc: Use image node_id 5 for calling the TextGeneration obj's underlying member method code with example usage: obj.parse_prefix_suffix_for_model_generate_output(output) and returns: dict