class_docstr: Generates contexts shown to crowdsourced workers when collecting BST conversations.
  
  This generator was used to generate the context information shown to workers at the
  beginning of a conversation, when crowdsourcing the conversations that make up the
  BST dataset.
class_docstr_tok: ["Generates","contexts","shown","to","crowdsourced","workers","when","collecting","BST","conversations",".","This","generator","was","used","to","generate","the","context","information","shown","to","workers","at","the","beginning","of","a","conversation",",","when","crowdsourcing","the","conversations","that","make","up","the","BST","dataset","."]
docstr: Initialize the context generator.
  
  opt: only a 'datapath' key is required, to specify the ParlAI data folder
code: def __init__(
      self, opt, datatype: str = "train", seed: Optional[int] = None
  ):
      """
      Initialize the context generator.
  
      opt: only a 'datapath' key is required, to specify the ParlAI data folder
      """
  
      if seed is not None:
          self.rng = random.Random(seed)
      else:
          self.rng = random.Random()
  
      convai2_opt = Opt(
          {"datapath": opt["datapath"], "datatype": datatype}
      )
      self.convai2_teacher = BothTeacher(convai2_opt)
  
      ed_opt = Opt(
          {
              "datapath": opt["datapath"],
              "datatype": datatype,
              "train_experiencer_only": True,
          }
      )
      # Specify train_experiencer_only = True because we want to ensure that the text
      # will correspond to a Speaker utterance and the label to a Listener response
      self.ed_teacher = EmpatheticDialoguesTeacher(ed_opt)
  
      wow_opt = Opt({"datapath": opt["datapath"], "datatype": datatype})
      self.wow_teacher = WizardDialogKnowledgeTeacher(wow_opt)
  
      self.topic_to_persona_path = _topic_to_persona_path(opt)
      self.wow_topics_to_episode_idxes = (
          self._setup_topics_to_episodes()
      )
      self.persona_strings_to_wow_topics = (
          self._setup_personas_to_topics()
      )
  
imports: import copy
  import os
  import random
  import re
  from collections import defaultdict
  from typing import List, Optional, Dict, Tuple
  from parlai.core.opt import Opt
  from parlai.core.teachers import ParlAIDialogTeacher, create_task_agent_from_taskname
  from parlai.tasks.convai2.agents import BothTeacher
  from parlai.tasks.empathetic_dialogues.agents import EmpatheticDialoguesTeacher
  from parlai.tasks.wizard_of_wikipedia.agents import WizardDialogKnowledgeTeacher
  from parlai.utils.misc import warn_once
  from parlai.utils.io import PathManager
  from .build import build
label_desc: Use image node_id 1 to create a new ContextGenerator object  with example: obj = ContextGenerator(opt, datatype, seed)