class_docstr: GenerationTeacher - dialogues are split into two episodes, one from
  each individual person's point of view.
  
  Used in the #dodecaDialogue task. (see https://parl.ai/projects/dodecadialogue/)
class_docstr_tok: ["GenerationTeacher","-","dialogues","are","split","into","two","episodes",",","one","from","each","individual","person","'s","point","of","view",".","Used","in","the","#","dodecaDialogue","task",".","(","see","https",":","\/\/parl.ai\/projects\/dodecadialogue\/",")"]
code: def __init__(self, opt: Opt, shared: TShared = None):
      if not shared:
          self.idx_to_ep = {}
      else:
          self.idx_to_ep = shared["idx_to_ep"]
      self.prepend_personality = opt.get("prepend_personality", True)
      self.include_dialogue_history = opt.get(
          "include_dialogue_history", True
      )
      self.category_frac = opt.get("category_frac", 0.0)
      super().__init__(opt, shared)
      self.num_eps = len(self.data) + len(
          [d for d in self.data if len(d["dialog"]) > 1]
      )
  
      # Replace personalities with polarity categories ("positive/neutral" or
      # "negative"), with probability self.category_frac
      if not shared:
          category_map = get_category_map(self.personalities)
          for i, d in enumerate(self.data):
              use_category_rand = random.random()
              if use_category_rand < self.category_frac:
                  self.data[i]["dialog"] = [
                      [category_map[personality], label]
                      for personality, label in d["dialog"]
                  ]
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  import json
  import os
  import random
  from typing import Tuple, Dict, List
  from parlai.core.message import Message
  from parlai.core.opt import Opt
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.core.image_featurizers import ImageLoader
  from parlai.utils.typing import TShared
  from parlai.utils.io import PathManager
  from .build import build
label_desc: Use image node_id 1 to create a new GenerationTeacher object from inherited base classes: ImageChatTeacher with example: obj = GenerationTeacher(opt, shared)