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