Skip to content

text_classifier

allennlp.predictors.text_classifier

[SOURCE]


TextClassifierPredictor#

@Predictor.register("text_classifier")
class TextClassifierPredictor(Predictor)

Predictor for any model that takes in a sentence and returns a single class for it. In particular, it can be used with the BasicClassifier model.

Registered as a Predictor with name "text_classifier".

predict#

class TextClassifierPredictor(Predictor):
 | ...
 | def predict(self, sentence: str) -> JsonDict

predictions_to_labeled_instances#

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