def evaluate_predictions(dataset, transformation,
                         train_data_path, test_data_path,
                         prediction_path):
  """Postprocesses predictions and calculates EM against gold programs."""
  train_examples, test_examples, predictions = io_utils.load_data(
      train_data_path, test_data_path, prediction_path)
  parser = dataset_parser_utils.get_parser(dataset)(train_examples,
                                                    test_examples)
  is_rir = True if transformation in ["rir", "lird_rir2", "lirind_rir2"
                                     ] else False
  predictions_postprocessed = parser.postprocess_full(predictions, is_rir)
  em = calc_exact_match(test_examples, predictions_postprocessed)
  return em
Postprocesses predictions and calculates EM against gold programs.
language/compir/evaluate/evaluate_predictions_utils.py