code: def process(
      src_path,
      tgt_path,
      schema_path,
      language="zh",
      task="RE",
      sample=-1,
      neg_ratio=0.1,
      neg_schema=0.8,
      random_sort=True,
  ):
      if os.path.exists(
          schema_path
      ):  # 加载该数据集的schema, schema_path文件内容参见utils.py FullSampler.read_from_file
          neg_sampler = Sampler.read_from_file(schema_path, negative=-1)
      else:  # 未指定schema_path, 则从数据集中统计得到schema
          type_list, role_list, type_role_dict = get_schema(
              src_path, task
          )
          neg_sampler = Sampler(
              type_list, role_list, type_role_dict, negative=-1
          )
  
      if task == "EE":
          converter = EEConverter(language, NAN="NAN", prefix="")
          neg_sampler.set_negative(
              max(
                  1, round(neg_schema * len(neg_sampler.type_role_dict))
              )
          )
      elif task == "RE":
          converter = REConverter(language, NAN="NAN", prefix="")
          neg_sampler.set_negative(
              max(1, round(neg_schema * len(neg_sampler.role_list)))
          )
      elif task == "NER":
          converter = NERConverter(language, NAN="NAN", prefix="")
          neg_sampler.set_negative(
              max(1, round(neg_schema * len(neg_sampler.type_list)))
          )
      elif task == "EET":
          converter = EETConverter(language, NAN="NAN", prefix="")
          neg_sampler.set_negative(
              max(1, round(neg_schema * len(neg_sampler.type_list)))
          )
      elif task == "EEA":
          converter = EEAConverter(language, NAN="NAN", prefix="")
          neg_sampler.set_negative(
              max(1, round(neg_schema * len(neg_sampler.role_list)))
          )
      else:
          raise KeyError
  
      writer = open(tgt_path, "w", encoding="utf-8")
      with open(src_path, "r", encoding="utf-8") as reader:
          for line in reader:
              record = json.loads(line)
              sinstruct, output_text = convert_ie(
                  record,
                  sample,
                  task,
                  neg_sampler,
                  converter,
                  neg_ratio=neg_ratio,
                  input_text="input",
                  random_sort=random_sort,
              )
              new_record = {
                  "id": stable_hash(record["input"]),
                  "instruction": sinstruct,
                  "input": record["input"],
                  "output": output_text,
              }
              writer.write(
                  json.dumps(new_record, ensure_ascii=False) + "\n"
              )
  
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 3 for calling a global function with example usage: process(src_path, tgt_path, schema_path, language, task, sample, neg_ratio, neg_schema, random_sort) without return types