code: def record_f1_score(record_examples: List[RecordNestedExample]):
      """Calculate F1 score for given nested ReCoRD examples
  
      Args:
          record_examples: processed ReCoRD examples
  
      Returns:
          float: F1 score
      """
      if not record_examples:
          return 0.0
      f1_scores = []
      for example in record_examples:
          example_f1s = []
          for answer in example.answers:
              example_f1s.append(
                  exact_match_score(example.prediction, answer)
              )
          if example_f1s:
              f1_scores.append(max(example_f1s))
      return np.mean(f1_scores)
  
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 1 for calling a global function with example usage: record_f1_score(record_examples) and returns: np, int