code: def clear_wrong_tokens(words, labels, tokenizer, max_len):
      tokens_cleaned = []
      labels_cleaned = []
      trigger_start = None
  
      for idx, word, label in zip(range(len(words)), words, labels):
          token = tokenizer.tokenize(word)
          if label != "O" and trigger_start == None:
              trigger_start = idx
          if len(token) == 0:
              continue
          tokens_cleaned.extend(token)
          labels_cleaned.append(label)
  
      if len(tokens_cleaned) > max_len:
          tokens_cleaned = tokens_cleaned[:max_len]
          labels_cleaned = labels_cleaned[:max_len]
  
      return tokens_cleaned, labels_cleaned, trigger_start
  
file_path: DeepKE/src/deepke/event_extraction/standard/bertcrf/utils_ee.py
imports: import hashlib
  from transformers import XLMRobertaTokenizer, BertTokenizer, RobertaTokenizer
  from torch.nn.utils.rnn import pad_sequence
label_desc: Use image node_id 8 for calling a global function with example usage: clear_wrong_tokens(words, labels, tokenizer, max_len) and returns: tokens_cleaned,  labels_cleaned,  trigger_start