def parse_fold(*, fold_name, model_predictions,
               tfds_examples):
  """Parse the examples in the model predictions.

  Args:
    fold_name: Name of fold that examples in rows are from
    model_predictions: Map from example_id to predictions
    tfds_examples: Examples from fever TFDS

  Returns:
    Dataframe merging the examples and predictions
  """
  output_rows = []
  for example in tqdm.tqdm(tfds_examples, mininterval=10):
    meta = json.loads(util.tf_to_str(example['metadata']))
    claim_id = meta['claim_id']
    scrape_type = util.tf_to_str(example['scrape_type'])
    wikipedia_url = util.tf_to_str(example['wikipedia_url'])
    sentence_id = util.tf_to_str(example['sentence_id'])
    ex_id = make_example_id(
        claim_id=claim_id,
        wikipedia_url=wikipedia_url,
        sentence_id=sentence_id,
        scrape_type=scrape_type,
    )
    model_score = get_match_score(model_predictions, ex_id)
    verify_scores = get_verify_scores(model_predictions, ex_id)
    # pyformat: disable
    output_rows.append({
        'evidence_label': constants.EVIDENCE_MATCHING_CLASSES[
            example['evidence_label'].numpy()],
        'claim_label': constants.FEVER_CLASSES[example['claim_label'].numpy()],
        'scrape_type': scrape_type,
        'wikipedia_url': wikipedia_url,
        'sentence_id': sentence_id,
        'retrieved': meta['retrieved'],
        'gold': meta['gold'],
        'background': meta['background'],
        'sentence_score': meta['sentence_score'],
        'doc_score': meta['doc_score'],
        'tfidf_candidate': meta['tfidf_candidate'],
        'claim_text': util.tf_to_str(example['claim_text']),
        'evidence_text': util.tf_to_str(example['evidence_text']),
        'claim_id': meta['claim_id'],
        'model_score': model_score,
        'refute_score': verify_scores.refute_probability,
        'support_score': verify_scores.support_probability,
        'nei_score': verify_scores.not_enough_info_probability,
        'fold': fold_name,
    })
    # pyformat: enable
  df = pd.DataFrame(output_rows)
  return df
Parse the examples in the model predictions.

  Args:
    fold_name: Name of fold that examples in rows are from
    model_predictions: Map from example_id to predictions
    tfds_examples: Examples from fever TFDS

  Returns:
    Dataframe merging the examples and predictions
  
language/serene/analysis.py