class_docstr: Taken from the official evaluation script for v1.1 of the SQuAD dataset
class_docstr_tok: ["Taken","from","the","official","evaluation","script","for","v1.1","of","the","SQuAD","dataset"]
code: def f1_score(self, prediction, ground_truth):
      prediction_tokens = self.normalize(prediction).split()
      ground_truth_tokens = self.normalize(ground_truth).split()
      common = Counter(prediction_tokens) & Counter(ground_truth_tokens)
      num_same = sum(common.values())
      if num_same == 0:
          return 0.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: import logging
  import re
  import string
  from collections import Counter
  from typing import List, Union
  import torch
  from torchmetrics import Metric
label_desc: Use image node_id 4 for calling the TokenF1Score obj's underlying member method code with example usage: obj.f1_score(prediction, ground_truth) and returns: f1, int