code: def token_f1_score(prediction, ground_truth):
      """
      Taken from the official evaluation script for v1.1 of the SQuAD dataset.
      """
      prediction_tokens = normalize_answer(prediction).split()
      ground_truth_tokens = normalize_answer(ground_truth).split()
      common = Counter(prediction_tokens) & Counter(ground_truth_tokens)
      num_same = sum(common.values())
      if num_same == 0:
          return 0
      precision = 1.0 * num_same / len(prediction_tokens)
      recall = 1.0 * num_same / len(ground_truth_tokens)
      f1 = (2 * precision * recall) / (precision + recall)
      return f1
  
imports: from collections import Counter
  import re
  import string
  from lm_eval.base import rf, Task
  from lm_eval.metrics import f1_score, mean
label_desc: Use image node_id 3 for calling a global function with example usage: token_f1_score(prediction, ground_truth) and returns: f1, int