dialoguekit.nlg.template_from_training_data¶
Extract user response utterance templates from annotated training data.
Functions¶
|
Builds the NLG template. |
|
Extracts utterance templates for each intent. |
Module Contents¶
- dialoguekit.nlg.template_from_training_data.build_template_from_instances(utterances: List[dialoguekit.core.annotated_utterance.AnnotatedUtterance]) Dict[str, List[dialoguekit.core.annotated_utterance.AnnotatedUtterance]] ¶
Builds the NLG template.
The dialogue acts from the utterances will be used to build the templates. If an utterance has multiple dialogue acts, the intents will be concatenated with a semicolon. If an utterance does not have any dialogue acts, it will be skipped.
- Parameters:
utterances – List of utterances to build the template from.
- Returns:
Dictionary with intents as keys and lists of corresponding templates.
- dialoguekit.nlg.template_from_training_data.extract_utterance_template(annotated_dialogue_file: str, participant_to_learn: str = 'USER', satisfaction_classifier: None | dialoguekit.nlu.models.satisfaction_classifier.SatisfactionClassifier | None = None) Dict[str, List[dialoguekit.core.annotated_utterance.AnnotatedUtterance]] ¶
Extracts utterance templates for each intent.
If a Satisfaction Classifier is provided it will be used to classify the utterances. The classification logic is as follows:
Hold participant utterance.
Hold counter-participant utterance.
Concatenate participant and counter-participant utterance and classify satisfaction.
The next utterance from participant will be given the satisfaction from the concatenated utterance from the previous utterances. reflecting the satisfaction at that given point in time.
- Parameters:
annotated_dialog_file – Annotated dialogue json file.
participant_to_learn – Which participant we want to create a template on.
satisfaction_classifier – SatisfactionClassifier.
- Returns:
Dictionary with intents as keys and lists of corresponding templates.