simple_intent_classifier#

class besser.bot.nlp.intent_classifier.simple_intent_classifier.SimpleIntentClassifier(nlp_engine, state)[source]#

Bases: IntentClassifier

A Simple Intent Classifier.

It works using a simple Keras Neural Network (the prediction model) for text classification.

Parameters:
  • nlp_engine (NLPEngine) – the NLPEngine that handles the NLP processes of the bot

  • state (State) – the state the intent classifier belongs to

_tokenizer#

The intent classifier tokenizer

Type:

Tokenizer

_model#

The intent classifier language model

Type:

Sequential

__intent_label_mapping#

A mapping of the intent labels and their corresponding intents.

__total_labels_training_sentences#

The label (identifying the intent) of all training sentences.

__total_training_sentences#

All the processed training sentences of all intents of the intent classifier’s state.

__total_training_sequences#

All the training sequences of all intents of the intent classifier’s state.

_abc_impl = <_abc._abc_data object>#
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:

list[IntentClassifierPrediction]

train()[source]#

Train the intent classifier.