def load_answers(question_ids, filename, vocab):
  """Load gold answers from file.

  Wordpieces are converted back (approximately) into PTB-style tokens.

  Args:
    question_ids: Question ids to load.
    filename: Path to answer file.
    vocab: Instance of text_utils.Vocab.

  Returns:
    answers: Dictionary of image_id --> question_id --> set(answer).
  """
  with tf.io.gfile.GFile(filename, "r") as f:
    vqa = json.load(f)

  answers = collections.defaultdict(lambda: collections.defaultdict(list))
  for image_id, entry in vqa.items():
    for question_id, qa in entry.items():
      image_id = int(image_id)
      question_id = int(question_id)
      if question_id in question_ids:
        for answer in qa["answers"]:
          answer = vocab.detokenize(answer.split(" "))
          answer = clean_tokens(nltk_utils.word_tokenize(answer))
          answers[image_id][question_id].append(" ".join(answer))

  return answers
Load gold answers from file.

  Wordpieces are converted back (approximately) into PTB-style tokens.

  Args:
    question_ids: Question ids to load.
    filename: Path to answer file.
    vocab: Instance of text_utils.Vocab.

  Returns:
    answers: Dictionary of image_id --> question_id --> set(answer).
  
language/capwap/utils/metric_utils.py