code: def with_coref(dataset, person_names):
      for data_name, content in dataset.items():
          for cur_m in content:
              coref = find_coref(cur_m, content, person_names)
              if coref is not None and len(coref) > 0:
                  cur_cands = {}
                  for m in coref:
                      for c, p in m["candidates"]:
                          cur_cands[c] = cur_cands.get(c, 0) + p
                  for c in cur_cands.keys():
                      cur_cands[c] /= len(coref)
                  cur_m["candidates"] = sorted(
                      list(cur_cands.items()), key=lambda x: x[1]
                  )[::-1]
  
file_path: BLINK/blink/candidate_retrieval/dataset.py
imports: import re
  import pickle
  import os
  import time
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: with_coref(dataset, person_names) without return types