def _create_validation_examples(self, *, claim_json,
                                  scrape_type,
                                  n_inference_candidates):
    """Create validation examples for fever task.

    This function follows these steps/guidelines:
    1. Get up to the top n_inference_documents rated documents
    2. Return up to the first thirty sentences in each document
    3. In total, return n_inference_candidates, obtaining the max by iteratively
      getting the 1st sentence of each doc, then second etc.
    4. For debugging, include gold examples not retrieved with these, but mark
      tfidf_candidate False so that they can be filtered out

    Args:
      claim_json: The fever claim to get examples for
      scrape_type: The scrape type to use
      n_inference_candidates: Number of candidates to return

    Returns:
      Examples for validation on fever
    """
    used_wikipedia_urls = set()
    claim_id = claim_json['id']
    claim_label = claim_json['label']

    # Seed examples with gold documents as positives, negs will be added
    examples, gold_used_wikipedia_urls = self._get_gold_examples(
        claim_json=claim_json,
        scrape_type=scrape_type,
    )
    for key in examples:
      examples[key]['sentence_score'] = -examples[key]['sentence_id']
    used_wikipedia_urls = used_wikipedia_urls.union(gold_used_wikipedia_urls)

    # Add retrieved documents as negatives
    # For inference, we generate the input documents for each type of way
    # to get them, the scoring script handles separating this out to create
    # metrics for each method so we can compare
    documents = self._get_retrieved_documents(
        claim_id,
        scrape_type=scrape_type,
    )
    documents = documents[:self._n_inference_documents]
    candidates: List[types.Json] = []
    for wikipedia_url, ir_score in documents:
      parsed_page = self._wiki_db.get_page(wikipedia_url)
      used_wikipedia_urls.add(wikipedia_url)
      if parsed_page is None:
        self._n_missing_pages.inc()
      else:
        for sentence_id in range(self._max_inference_sentence_id):
          if sentence_id in parsed_page.sentences:
            sentence_struct = parsed_page.sentences[sentence_id]
            sentence_with_title = underscore_to_whitespace(
                wikipedia_url) + ' ' + sentence_struct.text
            example = {
                'evidence_text': sentence_struct.text,
                'evidence_text_with_title': sentence_with_title,
                'evidence_label': constants.NOT_MATCHING,
                'claim_label': claim_label,
                'gold': False,
                'retrieved': True,
                'background': False,
                'wikipedia_url': wikipedia_url,
                'sentence_id': sentence_id,
                'doc_score': ir_score,
                'scrape_type': scrape_type,
                # This sorts examples with smallest sentence_id to the top
                'sentence_score': -sentence_id
            }
            candidates.append(example)

    return merge_validation_gold_and_candidate(examples, candidates,
                                               n_inference_candidates)
Create validation examples for fever task.

    This function follows these steps/guidelines:
    1. Get up to the top n_inference_documents rated documents
    2. Return up to the first thirty sentences in each document
    3. In total, return n_inference_candidates, obtaining the max by iteratively
      getting the 1st sentence of each doc, then second etc.
    4. For debugging, include gold examples not retrieved with these, but mark
      tfidf_candidate False so that they can be filtered out

    Args:
      claim_json: The fever claim to get examples for
      scrape_type: The scrape type to use
      n_inference_candidates: Number of candidates to return

    Returns:
      Examples for validation on fever
    
language/serene/fever_tfds.py