code: def proprocessing_graph_record(graph, schema_dict):
      """Mapping generated spot-asoc result to Entity/Relation/Event
      将抽取的Spot-Asoc结构，根据不同的 Schema 转换成 Entity/Relation/Event 结果
      """
      records = {
          "entity": list(),
          "relation": list(),
          "event": list(),
      }
  
      entity_dict = OrderedDict()
  
      # 根据不同任务的 Schema 将不同的 Spot 对应到不同抽取结果： Entity/Event
      # Mapping generated spot result to Entity/Event
      for record in graph["pred_record"]:
          if record["type"] in schema_dict["entity"].type_list:
              records["entity"] += [
                  {"text": record["spot"], "type": record["type"]}
              ]
              entity_dict[record["spot"]] = record["type"]
  
          elif record["type"] in schema_dict["event"].type_list:
              records["event"] += [
                  {
                      "trigger": record["spot"],
                      "type": record["type"],
                      "roles": record["asocs"],
                  }
              ]
  
          else:
              print("Type `%s` invalid." % record["type"])
  
      # 根据不同任务的 Schema 将不同的 Asoc 对应到不同抽取结果： Relation/Argument
      # Mapping generated asoc result to Relation/Argument
      for record in graph["pred_record"]:
          if record["type"] in schema_dict["entity"].type_list:
              for role in record["asocs"]:
                  records["relation"] += [
                      {
                          "type": role[0],
                          "roles": [
                              (record["type"], record["spot"]),
                              (
                                  entity_dict.get(
                                      role[1], record["type"]
                                  ),
                                  role[1],
                              ),
                          ],
                      }
                  ]
  
      if len(entity_dict) > 0:
          for record in records["event"]:
              if record["type"] in schema_dict["event"].type_list:
                  new_role_list = list()
                  for role in record["roles"]:
                      if role[1] in entity_dict:
                          new_role_list += [role]
                  record["roles"] = new_role_list
  
      return records
  
file_path: DeepKE/src/deepke/name_entity_re/cross/sel2record/sel2record.py
imports: from collections import defaultdict, OrderedDict
  import os
  from ..extraction.record_schema import RecordSchema
  from ..extraction.predict_parser import get_predict_parser
  from ..sel2record.record import EntityRecord, MapConfig, RelationRecord, EventRecord
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: proprocessing_graph_record(graph, schema_dict) and returns: records