code: def squad_eval(
      data_file, preds, na_probs, na_prob_thresh=0.0, revise=False
  ):
      """
  
      Parameters
      ----------
      data_file
          dataset(list) or data_file(str)
      preds
          predictions dictionary
      na_probs
          probabilities dictionary of unanswerable
      na_prob_thresh
          threshold of unanswerable
      revise
          Wether to get the final predictions with impossible answers replaced
          with null string ''
      Returns
      -------
      out_eval
          A dictionary of output results
      (preds_out)
          A dictionary of final predictions
      """
      if isinstance(data_file, str):
          with open(data_file) as f:
              dataset_json = json.load(f)
              dataset = dataset_json["data"]
      elif isinstance(data_file, list):
          dataset = data_file
      if na_probs is None:
          na_probs = {k: 0.0 for k in preds}
          # not necessary to revise results of SQuAD 1.1
          revise = False
      qid_to_has_ans = make_qid_to_has_ans(
          dataset
      )  # maps qid to True/False
      has_ans_qids = [k for k, v in qid_to_has_ans.items() if v]
      no_ans_qids = [k for k, v in qid_to_has_ans.items() if not v]
      exact_raw, f1_raw = get_raw_scores(dataset, preds)
      exact_thresh = apply_no_ans_threshold(
          exact_raw, na_probs, qid_to_has_ans, na_prob_thresh
      )
      f1_thresh = apply_no_ans_threshold(
          f1_raw, na_probs, qid_to_has_ans, na_prob_thresh
      )
      out_eval = make_eval_dict(exact_thresh, f1_thresh)
      if has_ans_qids:
          has_ans_eval = make_eval_dict(
              exact_thresh, f1_thresh, qid_list=has_ans_qids
          )
          merge_eval(out_eval, has_ans_eval, "HasAns")
      if no_ans_qids:
          no_ans_eval = make_eval_dict(
              exact_thresh, f1_thresh, qid_list=no_ans_qids
          )
          merge_eval(out_eval, no_ans_eval, "NoAns")
          find_all_best_thresh(
              out_eval,
              preds,
              exact_raw,
              f1_raw,
              na_probs,
              qid_to_has_ans,
          )
  
      if revise:
          thresh = (
              out_eval["best_exact_thresh"] + out_eval["best_f1_thresh"]
          ) * 0.5
          preds_out = revise_unanswerable(preds, na_probs, thresh)
          return out_eval, preds_out
      else:
          return out_eval, preds
  
file_path: gluon-nlp/scripts/question_answering/eval_utils.py
imports: import collections
  import json
  import copy
  import re
  import string
label_desc: Use image node_id 13 for calling a global function with example usage: squad_eval(data_file, preds, na_probs, na_prob_thresh, revise) and returns: out_eval,  preds_out, out_eval,  preds