class_docstr: Processor for the DuEE data set.
code: def data_process(self, path, trigger_pred_list, model="role"):
      output = ["text_a\tlabel\ttrigger_tag\tindex"]
      with open(path) as f:
          raw = f.readlines()
          assert len(raw) == len(trigger_pred_list)
          for (
              idx,
              line,
              trigger_pred,
          ) in tqdm(zip(range(len(raw)), raw, trigger_pred_list)):
              d_json = json.loads(line.strip())
              text_a = [
                  "，" if t == " " or t == "\n" or t == "\t" else t
                  for t in list(d_json["text"].lower())
              ]
              text_a_cleaned = text_a
  
              if model == "role":
                  for event in d_json.get("event_list", []):
                      event_type = event["event_type"]
                      trigger_labels = ["O"] * len(text_a)
                      trigger_start = event["trigger_start_index"]
                      trigger = event["trigger"]
                      trigger_labels = label_data(
                          trigger_labels,
                          trigger_start,
                          len(trigger),
                          event_type,
                      )
  
                      (
                          text_a_cleaned,
                          trigger_labels_cleaned,
                          trigger_start,
                      ) = clear_wrong_tokens(
                          text_a,
                          trigger_labels,
                          self.tokenizer,
                          len(trigger_pred),
                      )
  
                      for i in range(
                          trigger_start, trigger_start + len(trigger)
                      ):
                          if i == len(trigger_pred):
                              break
                          trigger_labels_cleaned[i] = trigger_pred[i]
                          trigger_pred[i] = "O"
  
                      role_labels = ["O"] * len(text_a)
                      for arg in event["arguments"]:
                          role_type = arg["role"]
                          argument = arg["argument"]
                          role_start = arg["argument_start_index"]
                          role_labels = label_data(
                              role_labels,
                              role_start,
                              len(argument),
                              role_type,
                          )
  
                      (
                          text_a_cleaned,
                          role_labels_cleaned,
                          _,
                      ) = clear_wrong_tokens(
                          text_a,
                          role_labels,
                          self.tokenizer,
                          len(trigger_pred),
                      )
  
                      assert (
                          len(text_a_cleaned)
                          == len(role_labels_cleaned)
                          == len(trigger_labels_cleaned)
                      )
                      output.append(
                          "{}\t{}\t{}\t{}".format(
                              "\002".join(text_a_cleaned),
                              "\002".join(role_labels_cleaned),
                              "\002".join(trigger_labels_cleaned),
                              idx,
                          )
                      )
  
                  # print("trigger_pred_after:", trigger_pred)
                  trigger_remained_labels_list = (
                      process_remained_pred_trigger(trigger_pred)
                  )
  
                  for remained_labels in trigger_remained_labels_list:
                      assert len(text_a_cleaned) == len(remained_labels)
                      output.append(
                          "{}\t{}\t{}\t{}".format(
                              "\002".join(text_a_cleaned),
                              "\002".join(["O"] * len(text_a_cleaned)),
                              "\002".join(remained_labels),
                              idx,
                          )
                      )
  
      return output
  
imports: from __future__ import absolute_import, division, print_function
  import json
  import logging
  import os
  import sys
  from copy import deepcopy
  from io import open
  from transformers import XLMRobertaTokenizer, BertTokenizer, RobertaTokenizer, AutoTokenizer
  from .utils_ee import read_by_lines, write_by_lines, load_dict, label_data, process_remained_pred_trigger, clear_wrong_tokens
  from torch.nn.utils.rnn import pad_sequence
  from tqdm import tqdm
label_desc: Use image node_id 2 for calling the DUEEProcessor obj's underlying member method code with example usage: obj.data_process(path, trigger_pred_list, model) and returns: output