code: def get_positive_type_role(records, task):
      positive_type = set()
      positive_role = set()
      positive_type_role = defaultdict(set)
      if task == "NER":
          for record in records:
              positive_type.add(record["entity_type"])
      elif task == "RE":
          for record in records:
              positive_role.add(record["relation"])
      elif task == "EE":
          for record in records:
              positive_type.add(record["event_type"])
              for arg in record["arguments"]:
                  positive_role.add(arg["role"])
                  positive_type_role[record["event_type"]].add(
                      arg["role"]
                  )
          for it in positive_type:
              if it not in positive_type_role:
                  positive_type_role[it] = set()
      elif task == "EET":
          for record in records:
              positive_type.add(record["event_type"])
      return positive_type, positive_role, positive_type_role
  
file_path: DeepKE/example/llm/InstructKGC/kg2instruction/convert/sampler.py
imports: import json
  import os
  from collections import defaultdict
  import random
label_desc: Use image node_id 1 for calling a global function with example usage: get_positive_type_role(records, task) and returns: positive_type,  positive_role,  positive_type_role