dialoguekit.utils.dialogue_reader

Methods for reading dialogue exports.

Functions

json_to_annotated_utterance(...)

Converts an utterance from JSON format to AnnotatedUtterance.

json_to_dialogues(...)

Parses a JSON file containing dialogues.

Module Contents

dialoguekit.utils.dialogue_reader.json_to_annotated_utterance(json_utterance: Dict[Any, Any]) dialoguekit.core.annotated_utterance.AnnotatedUtterance

Converts an utterance from JSON format to AnnotatedUtterance.

Parameters:

json_utterance

JSON format of an utterance, e.g.,

{
    "participant": "USER",
    "utterance": "hello",
    "intent": "DISCLOSE.NON-DISCLOSE"
}

Returns:

An AnnotatedUtterance object representation of the json utterance.

dialoguekit.utils.dialogue_reader.json_to_dialogues(filepath: str, agent_ids: List[str] = None, user_ids: List[str] = None) List[dialoguekit.core.dialogue.Dialogue]

Parses a JSON file containing dialogues.

Parameters:
  • filepath – Path to JSON file containing the dialogues.

  • agent_ids – List of agents’ id to filter loaded dialogues. Defaults to None.

  • user_ids – List of users’ id to filter loaded dialogues. Defaults to None.

Returns:

A list of Dialogue objects.