dialoguekit.nlu.disjoint_dialogue_act_extractor¶
Dialogue act extractor with disjoint intent classification and slot filling.
It is assumed that the intent classifier assigns a single intent to the utterance that corresponds to the slot-value pairs extracted by the slot-value annotators.
Classes¶
Initializes the dialogue act extractor. |
Module Contents¶
- class dialoguekit.nlu.disjoint_dialogue_act_extractor.DisjointDialogueActExtractor(intent_classifier: dialoguekit.nlu.intent_classifier.IntentClassifier, slot_value_annotators: List[dialoguekit.nlu.slot_value_annotator.SlotValueAnnotator])¶
Bases:
dialoguekit.nlu.dialogue_acts_extractor.DialogueActsExtractor
Initializes the dialogue act extractor.
- Parameters:
intent_classifier – Intent classifier.
slot_value_annotators – List of slot-value annotators.
- classify_intent(utterance: dialoguekit.core.utterance.Utterance) dialoguekit.core.intent.Intent ¶
Classifies the intent of a given agent utterance.
- annotate_slot_values(utterance: dialoguekit.core.utterance.Utterance) List[dialoguekit.core.slot_value_annotation.SlotValueAnnotation] ¶
Annotates a given utterance with slot-value annotators.
- Parameters:
utterance – Utterance to annotate.
- Returns:
List of annotations.
- extract_dialogue_acts(utterance: dialoguekit.core.utterance.Utterance) List[dialoguekit.core.dialogue_act.DialogueAct] ¶
Extracts a single dialogue act from an utterance.
- Parameters:
utterance – Utterance.
- Returns:
List with one dialogue act.
- save(path: str) None ¶
Saves the intent classifier and slot-value annotators to a folder.
- Parameters:
path – Path to save the dialogue act extractor.
- classmethod load(path: str) DisjointDialogueActExtractor ¶
Loads the intent classifier and slot-value annotators from a folder.
- Parameters:
path – Path to folder with intent classifier and slot-value annotators.
- Raises:
FileNotFoundError – If the given folder does not exist.
- Returns:
Dialogue act extractor with loaded models.