code: def get_schema(src_path, task):  # 从数据集中统计类型列表形成schema
      type_set = set()
      role_set = set()
      type_role_dict = defaultdict(set)
      with open(src_path, "r", encoding="utf-8") as reader:
          for line in reader:
              record = json.loads(line)
              if task == "EE":
                  for event in record["event"]:
                      type_set.add(event["event_type"])
                      for arg in event["arguments"]:
                          role_set.add(arg["role"])
                          type_role_dict[event["event_type"]].add(
                              arg["role"]
                          )
              elif task == "RE":
                  for rel in record["relation"]:
                      role_set.add(rel["relation"])
              elif task == "NER":
                  for ent in record["entity"]:
                      type_set.add(ent["entity_type"])
              else:
                  raise KeyError
      return list(type_set), list(role_set), type_role_dict
  
file_path: DeepKE/example/llm/InstructKGC/kg2instruction/convert.py
imports: import sys
  import argparse
  import json
  import os
  from collections import defaultdict
  import random
  from typing import Dict
  from convert.sampler import Sampler, get_positive_type_role
  from convert.random_sort import rel_sort, ent_sort, ee_sort, eet_sort
  from convert.converter import NERConverter, REConverter, EEAConverter, EETConverter, EEConverter
  from utils import stable_hash
label_desc: Use image node_id 1 for calling a global function with example usage: get_schema(src_path, task) and returns: list,  list,  type_role_dict