Skip to content





class ReadingComprehensionPredictor(Predictor)

Predictor for the allennlp_rc.models.bidaf.BidirectionalAttentionFlow model, and any other model that takes a question and passage as input.


class ReadingComprehensionPredictor(Predictor):
 | ...
 | def predict(self, question: str, passage: str) -> JsonDict

Make a machine comprehension prediction on the supplied input. See for more information about the machine comprehension task.

Parametersquestion : ``str``

A question about the content in the supplied paragraph.  The question must be answerable by a
span in the paragraph.

passage : str A paragraph of information relevant to the question.

ReturnsA dictionary that represents the prediction made by the system. The answer string will be under the

"best_span_str" key.


class ReadingComprehensionPredictor(Predictor):
 | ...
 | def predictions_to_labeled_instances(
 |     self,
 |     instance: Instance,
 |     outputs: Dict[str, numpy.ndarray]
 | ) -> List[Instance]