intent_classifier#
- class besser.bot.nlp.intent_classifier.intent_classifier.IntentClassifier(nlp_engine, state)[source]#
Bases:
ABC
The Intent Classifier abstract class.
An intent classifier is in charge of determining the intent of a user message. Given a text (a user message) and a set of intents, the intent classifier predicts the probability of each intent to be the actual message’s intent.
The intent classifier belongs to a specific bot state, thus the predicted intent will always be one of the state’s intents. Therefore, the state must have at least 1 intent.
This class serves as a template to implement intent classifiers.
- Parameters:
- _abc_impl = <_abc._abc_data object>#
- abstract predict(message)[source]#
Predict the intent of a given message.
Instead of returning only the intent with the highest likelihood, return all predictions. Predictions include not only the intent scores but other information extracted from the message.
- Parameters:
message (str) – the message to predict the intent
- Returns:
the list of predictions made by the intent classifier.
- Return type: