code: def remove_overlap_entities(entities):
      """There are a few overlapping entities in the data set. We only keep the
      first one and map others to it.
      :param entities (list): a list of entity mentions.
      :return: processed entity mentions and a table of mapped IDs.
      """
      tokens = [None] * 1000
      entities_ = []
      id_map = {}
      for entity in entities:
          start, end = entity["start"], entity["end"]
          break_flag = False
          for i in range(start, end):
              if tokens[i]:
                  id_map[entity["id"]] = tokens[i]
                  break_flag = True
          if break_flag:
              continue
          entities_.append(entity)
          for i in range(start, end):
              tokens[i] = entity["id"]
      return entities_, id_map
  
imports: import json, logging, pickle
  from mimetypes import knownfiles
  from unittest.mock import NonCallableMagicMock
  import torch
  from torch.utils.data import Dataset
  from collections import namedtuple
label_desc: Use image node_id 1 for calling a global function with example usage: remove_overlap_entities(entities) and returns: entities_,  id_map