Skip to content

textual_entailment

allennlp_models.pair_classification.predictors.textual_entailment

[SOURCE]


TextualEntailmentPredictor#

@Predictor.register("textual_entailment")
class TextualEntailmentPredictor(Predictor)

Predictor for the DecomposableAttention model.

Registered as a Predictor with name "textual_entailment".

predict#

class TextualEntailmentPredictor(Predictor):
 | ...
 | def predict(self, premise: str, hypothesis: str) -> JsonDict

Predicts whether the hypothesis is entailed by the premise text.

Parameters

  • premise : str
    A passage representing what is assumed to be true.

  • hypothesis : str
    A sentence that may be entailed by the premise.

Returns

  • JsonDict
    A dictionary where the key "label_probs" determines the probabilities of each of [entailment, contradiction, neutral].

predictions_to_labeled_instances#

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