lm_dialogue_act_extractor

Dialogue act extractor based on a language model.

Classes

LMDialogueActsExtractor

Initializes the dialogue act extractor.

Module Contents

class lm_dialogue_act_extractor.LMDialogueActsExtractor(config_file: str)

Bases: dialoguekit.nlu.dialogue_acts_extractor.DialogueActsExtractor

Initializes the dialogue act extractor.

Parameters:

config_file – YAML configuration file.

Raises:

FileNotFoundError – If the configuration or prompt file is not found.

filter_invalid_dialogue_acts(utterance: str, dialogue_acts: List[dialoguekit.core.dialogue_act.DialogueAct]) List[dialoguekit.core.dialogue_act.DialogueAct]

Filters out invalid dialogue acts.

This method should be used after inference to filter out dialogue acts with invalid intents, slots, or values.

Parameters:
  • utterance – Input utterance.

  • dialogue_acts – List of dialogue acts.

Returns:

List of valid dialogue acts.

extract_dialogue_acts(utterance: dialoguekit.core.utterance.Utterance) List[dialoguekit.core.dialogue_act.DialogueAct]

Extracts dialogue acts from an utterance.

Parameters:

utterance – Utterance.

Returns:

List of dialogue acts.

save(path: str) None

Saves the dialogue act extractor to a given path.

This method is not implemented for this dialogue act extractor as the model is externally hosted.

Parameters:

path – Path to save the dialogue act extractor.

classmethod load(path: str) LMDialogueActsExtractor

Loads the dialogue act extractor from a path.

This method is not implemented for this dialogue act extractor as the model is externally hosted.

Parameters:

path – Path to the dialogue act extractor.

Returns:

LMDialogueActsExtractor.