code: def f1_score(prediction, ground_truth, lang):
      prediction_tokens = normalize_answer(prediction, lang).split()
      ground_truth_tokens = normalize_answer(ground_truth, lang).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: import string
  import re
  import sys
  import unicodedata
  from collections import Counter
  from dataclasses import dataclass
  from jiant.tasks.lib.templates.squad_style import core
label_desc: Use image node_id 4 for calling a global function with example usage: f1_score(prediction, ground_truth, lang) and returns: f1, int