code: def trans_Dataset(config, examples: List[InputExample]):
      D = []
      for example in examples:
          span_infos = []
          sentence, label, d = (
              example.text_a.split(" "),
              example.label,
              [],
          )
          if len(sentence) > config.max_seq_len:
              continue
          assert len(sentence) == len(label)
          i = 0
          while i < len(sentence):
              flag = label[i]
              if flag[0] == "B":
                  start_index = i
                  i += 1
                  while i < len(sentence) and label[i][0] == "I":
                      i += 1
                  d.append([start_index, i, flag[2:]])
              elif flag[0] == "I":
                  start_index = i
                  i += 1
                  while i < len(sentence) and label[i][0] == "I":
                      i += 1
                  d.append([start_index, i, flag[2:]])
              else:
                  i += 1
          for s_e_flag in d:
              start_span, end_span, flag = (
                  s_e_flag[0],
                  s_e_flag[1],
                  s_e_flag[2],
              )
              span_infos.append(
                  {
                      "index": list(range(start_span, end_span)),
                      "type": flag,
                  }
              )
          D.append({"sentence": sentence, "ner": span_infos})
  
      return D
  
file_path: DeepKE/example/ner/standard/w2ner/predict.py
imports: import os.path
  from deepke.name_entity_re.standard.w2ner import *
  import numpy
  import hydra
  from hydra import utils
  import pickle
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: trans_Dataset(config, examples) and returns: D