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[dialoguekit.core.intent.Intent, List[dialoguekit.core.annotated_utterance.AnnotatedUtterance]] ¶
Builds the NLG template.
The Intent the Utterance comes with will be used. If no intent is present for an utterance it will be skipped.
- Parameters:
utterances – List of AnnotatedUtterance-s.
- Returns:
Dict with Intents and lists with corresponding AnnotatedUtterances.
- 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[dialoguekit.core.intent.Intent, 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:
Dict with Intents and lists with corresponding AnnotatedUtterances.