class_docstr: Safety Teacher for ProsocialDialog Data https://github.com/skywalker023/prosocial-dialog
  set --one-turn to true for just one turn without the context.
class_docstr_tok: ["Safety","Teacher","for","ProsocialDialog","Data","https",":","\/\/github.com\/skywalker023\/prosocial-dialog","set","--","one-turn","to","true","for","just","one","turn","without","the","context","."]
code: def setup_data(self, path):
      print("loading: " + path)
      f = open(path)
      self.json_data = json.load(f)
      f.close()
  
      for exs in self.json_data:
          texts = []
          for ex in exs:
              texts.append(ex["text"])
              if self.opt["one_turn"]:
                  x = ex["text"]
              else:
                  x = "\n".join(texts)
              texts.append(ex["labels"][0])
              y = ex["safety_label"]
              m = {"text": x, "labels": y}
              yield m, True
  
imports: import json
  import os
  from typing import Optional
  from parlai.core.opt import Opt
  from parlai.core.params import ParlaiParser
  from parlai.core.teachers import DialogTeacher
  from .build import build
label_desc: Use image node_id 3 for calling the ProsocialDialogSafetyTeacher obj's underlying member method code with example usage: obj.setup_data(path) without return types