code: def filter_repeat_overlaps(tokens, pred_triples, pred_scores):
      all_pred_entities_pruned = []
      all_pred_scores_pruned = []
      mention_masked_utterance = {
          triple[0]: np.zeros(len(tokens)) for triple in pred_triples
      }
      # ensure well-formed-ness, prune overlaps
      # greedily pick highest scoring, then prune all overlapping
      for idx, mb in enumerate(pred_triples):
          if sum(mention_masked_utterance[mb[0]][mb[1] : mb[2]]) > 0:
              continue
          all_pred_entities_pruned.append(mb)
          all_pred_scores_pruned.append(pred_scores[idx])
          mention_masked_utterance[mb[0]][mb[1] : mb[2]] = 1
      return all_pred_entities_pruned, all_pred_scores_pruned
  
file_path: BLINK/scripts/tune_hyperparams_new.py
imports: import json
  import os
  import numpy
  import torch
  from elq.vcg_utils.measures import entity_linking_tp_with_overlap
  from tqdm import tqdm
  from transformers import BertTokenizer
label_desc: Use image node_id 4 for calling a global function with example usage: filter_repeat_overlaps(tokens, pred_triples, pred_scores) and returns: all_pred_entities_pruned,  all_pred_scores_pruned