intent_classifier_prediction#
- class besser.bot.nlp.intent_classifier.intent_classifier_prediction.IntentClassifierPrediction(intent, score=None, matched_sentence=None, matched_parameters=None)[source]#
Bases:
object
The prediction result of an Intent Classifier for a specific intent.
The intent classifier tries to determine the intent of a user message. For each possible intent, it will return an IntentClassifierPrediction containing the results, that include the probability itself and other information.
- Parameters:
intent (Intent) – the target intent of the prediction
score (float) – the probability that this is the actual intent of the user message
matched_sentence (str) – the sentence used in the intent classifier (the original user message is previously processed, is modified by the NER, etc.)
matched_parameters (list[MatchedParameter]) – the list of parameters (i.e. entities) found in the user message
- matched_sentence#
The sentence used in the intent classifier (the original user message is previously processed, is modified by the NER, etc.)
- Type:
- matched_parameters#
The list of parameters (i.e. entities) found in the user message
- Type:
- get_parameter(name)[source]#
Get a parameter from the intent classifier prediction.
- Parameters:
name (str) – the name of the parameter to get
- Returns:
the parameter if it exists, None otherwise
- Return type:
MatchedParameter or None
- besser.bot.nlp.intent_classifier.intent_classifier_prediction.fallback_intent_prediction(message)[source]#
Return a fallback intent prediction for when none of the possible intents is matched.
- Parameters:
message (str) – the user message
- Returns:
the fallback intent classifier prediction
- Return type: