code: def _f1_score(target, prediction):
      """Computes token f1 score for a single target and prediction."""
      prediction_tokens = prediction.split()
      target_tokens = target.split()
      common = collections.Counter(
          prediction_tokens
      ) & collections.Counter(target_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(target_tokens)
      f1 = (2 * precision * recall) / (precision + recall)
      return f1
  
file_path: text-to-text-transfer-transformer/t5/evaluation/qa_utils.py
imports: import collections
  import re
  import string
  from absl import logging
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: _f1_score(target, prediction) and returns: f1, int