class_docstr: Base class for all the templates.
  Most of methods are abstract, with some exceptions to hold the common methods for all template, such as ``loss_ids``, ``save``, ``load``.
  
  Args:
      tokenizer (:obj:`PreTrainedTokenizer`): A tokenizer to appoint the vocabulary and the tokenization strategy.
      placeholder_mapping (:obj:`dict`): A place holder to represent the original input text.
class_docstr_tok: ["Base","class","for","all","the","templates",".","Most","of","methods","are","abstract",",","with","some","exceptions","to","hold","the","common","methods","for","all","template",",","such","as","``","loss_ids","``",",","``","save","``",",","``","load","``",".","Args",":","tokenizer","(",":","obj",":","`","PreTrainedTokenizer","`",")",":","A","tokenizer","to","appoint","the","vocabulary","and","the","tokenization","strategy",".","placeholder_mapping","(",":","obj",":","`","dict","`",")",":","A","place","holder","to","represent","the","original","input","text","."]
code: def incorporate_text_example(
      self,
      example: InputExample,
      text=None,
  ):
      if text is None:
          text = self.text.copy()
      else:
          text = text.copy()
  
      for i, d in enumerate(text):
          if not callable(d.get("post_processing")):
              d["post_processing"] = eval(
                  d.get("post_processing", "lambda x:x")
              )
          if "placeholder" in d:
              text[i] = d["add_prefix_space"] + d.get(
                  "post_processing"
              )(getattr(example, d["placeholder"]))
          elif "meta" in d:
              text[i] = d["add_prefix_space"] + d.get(
                  "post_processing"
              )(example.meta[d["meta"]])
          elif "soft" in d:
              text[i] = d["soft"]
              # unused
          elif "mask" in d:
              text[i] = "<mask>"
          elif "special" in d:
              text[i] = d["special"]
          elif "text" in d:
              text[i] = d["add_prefix_space"] + d["text"]
          else:
              raise ValueError(f"can not parse {d}")
      return text
  
imports: from abc import abstractmethod
  import json
  from transformers.file_utils import ModelOutput
  from openprompt.config import convert_cfg_to_dict
  from transformers.utils.dummy_pt_objects import PreTrainedModel
  from openprompt.utils.utils import signature
  from yacs.config import CfgNode
  from openprompt.data_utils import InputFeatures, InputExample
  import torch
  import torch.nn
  from typing import *
  from transformers.tokenization_utils import PreTrainedTokenizer
  from openprompt.utils.logging import logger
  import numpy
  import torch.nn.functional
label_desc: Use image node_id 5 for calling the Template obj's underlying member method code with example usage: obj.incorporate_text_example(example, text) and returns: text