dialoguekit.nlu.models.satisfaction_classifier

Satisfaction classification.

The SVM model and data it was trained on are based on: https://github.com/sunnweiwei/user-satisfaction-simulation

Classes

SatisfactionClassifier

Helper class that provides a standard way to create an ABC using

SatisfactionClassifierSVM

SVM Satisfaction classifier.

Module Contents

class dialoguekit.nlu.models.satisfaction_classifier.SatisfactionClassifier

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract classify_text(dialogue_text: str | List[str]) int | List[int]

Classifies text.

Allows for both list of string and a single string.

Parameters:

dialogue_text – Text to be classified.

Returns:

If the provided input is a list, a list will be returned. If the input is a string, the return will be a single int.

abstract classify_last_n_dialogue(dialogue: dialoguekit.core.dialogue.Dialogue, last_n: int | None | None = None) int

Classifies the last n utterances in a dialogue.

If last_n is None the whole dialogue will be classified.

Parameters:
  • dialogue – Dialogue to classify.

  • last_n – How many of the last utterances in the dialogue to use for the classification.

Raises:

TypeError – If last_n is greater then the length of the dialogue.

Returns:

Satisfaction classification.

class dialoguekit.nlu.models.satisfaction_classifier.SatisfactionClassifierSVM

Bases: SatisfactionClassifier

SVM Satisfaction classifier.

The SVM model is pre-trained on the english data from: https://github.com/sunnweiwei/user-satisfaction-simulation

It classifies the users overall satisfaction with the system. Based on the agents responses to the user.

The scale:

1: Very dissatisfied 2: Dissatisfied 3: Normal 4: Satisfied 5: Very Satisfied

classify_text(dialogue_text: str | List[str]) int | List[int]

Classifies satisfaction.

Parameters:

dialogue_text – Text to classify

Returns:

The classification score to the utterances.

classify_last_n_dialogue(dialogue: dialoguekit.core.dialogue.Dialogue, last_n: int | None | None = None) int

Classify n last dialogues.

Parameters:
  • dialogue – Dialogue object to classify.

  • last_n – Number of the last utterances to use for classification.

Returns:

Classification score.