code: def present_sentence_mentions(sentence, mentions, output_file):
      if output_file != None:
          f = io.open(output_file, mode="a", encoding="utf-8")
          output = lambda s: f.write("{}\n".format(s))
      else:
          output = lambda s: print(s)
      output("Sentence: {}".format(sentence))
  
      mention_entity_pairs = []
      for mention in mentions:
          candidates = mention["candidates"]
          # prediction = mention.get('predicted_candidate_idx', 0)
          prediction = mention["predicted_candidate_idx"]
  
          if prediction < len(candidates):
              # print(type(mention['prob_assigned_to_candidate']))
              # print(mention['prob_assigned_to_candidate'])
              mention_rep = "{} ({}, {}) - {} (conf. {:.5f})".format(
                  mention["text"],
                  mention["start_pos"],
                  mention["end_pos"],
                  get_candidate_summary(candidates[prediction]),
                  mention["prob_assigned_to_candidate"],
              )
          else:
              mention_rep = "{} ({}, {}) - {}".format(
                  mention["text"],
                  mention["start_pos"],
                  mention["end_pos"],
                  "No candidate selected",
              )
  
          mention_entity_pairs.append(mention_rep)
  
      if len(mention_entity_pairs) != 0:
          output(
              "Mention-Entity pairs: \n{}".format(
                  "\n".join(mention_entity_pairs)
              )
          )
      else:
          output("No detected mentions")
  
      output("")
  
file_path: BLINK/blink/utils.py
imports: import io
  import json
  import os
  import pickle
  from segtok.segmenter import split_multi
label_desc: Use image node_id 3 for calling a global function with example usage: present_sentence_mentions(sentence, mentions, output_file) without return types