code: def string_f1_score(prediction, ground_truth):
      """Compute normalized token level F1
      From official ReCoRD eval script
      """
      prediction_tokens = normalize_answer(prediction).split()
      ground_truth_tokens = normalize_answer(ground_truth).split()
      common = collections.Counter(
          prediction_tokens
      ) & collections.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
  
file_path: DeepPavlov/deeppavlov/metrics/record_metrics.py
imports: import re
  import string
  import collections
  from typing import List
  import numpy
  from deeppavlov.models.preprocessors.torch_transformers_preprocessor import RecordNestedExample
  from deeppavlov.core.common.metrics_registry import register_metric
label_desc: Use image node_id 4 for calling a global function with example usage: string_f1_score(prediction, ground_truth) and returns: f1, int