Skip to content

bidaf

allennlp_models.rc.predictors.bidaf

[SOURCE]


ReadingComprehensionPredictor#

@Predictor.register("reading_comprehension")
class ReadingComprehensionPredictor(Predictor)

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

predict#

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

Make a machine comprehension prediction on the supplied input. See https://rajpurkar.github.io/SQuAD-explorer/ 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.

predictions_to_labeled_instances#

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