dialoguekit.nlu.intent_classifier¶
Abstract interface for intent classification.
This interface assumes a single intent per utterance, i.e., approaches the task as a single-label classification problem. The generalization to multi-label classification is left to future work.
Classes¶
Initializes the intent classifier. |
Module Contents¶
- class dialoguekit.nlu.intent_classifier.IntentClassifier(intents: List[dialoguekit.core.intent.Intent])¶
Bases:
abc.ABC
Initializes the intent classifier.
- Parameters:
intents – List of allowed intents.
- abstract train_model(utterances: List[dialoguekit.core.utterance.Utterance], labels: List[dialoguekit.core.intent.Intent]) None ¶
Trains a model based on a set of labeled utterances.
- Parameters:
utterances – List of Utterance instances.
labels – List of associated intent labels.
- Raises:
NotImplementedError – If not implemented in derived class.
- abstract classify_intent(utterance: dialoguekit.core.utterance.Utterance) dialoguekit.core.intent.Intent ¶
Classifies the intent of an utterance.
- Parameters:
utterance – An utterance.
- Returns:
Predicted intent.
- Raises:
NotImplementedError – If not implemented in derived class.
- abstract save_model(file_path: str) None ¶
Saves the trained model to a file.
- Parameters:
file_path – File path.
- Raises:
NotImplementedError – If not implemented in derived class.
- abstract load_model(file_path: str) None ¶
Loads a model from a file.
- Parameters:
file_path – File path.
- Raises:
NotImplementedError – If not implemented in derived class.