dureader#

Official evaluation script for SQuAD version 2.0.

In addition to basic functionality, we also compute additional statistics and plot precision-recall curves if an additional na_prob.json file is provided. This file is expected to map question ID’s to the model’s predicted probability that a question is unanswerable.

compute_predictions(all_examples, all_features, all_results, n_best_size, max_answer_length, do_lower_case, verbose, tokenizer)[source]#

Write final predictions to the json file and log-odds of null if needed.

get_final_text(pred_text, orig_text, tokenizer, verbose)[source]#

Project the tokenized prediction back to the original text.

normalize(s)[source]#

Normalize strings to space joined chars. :param s: a list of strings.

Returns:

A list of normalized strings.