dialoguekit.utils.annotation_converter_dialoguekit_to_rasa

Convert annotations to be compatible with the rasa models.

Attributes

converter

Classes

LiteralString

Initialize self. See help(type(self)) for accurate signature.

AnnotationConverterRasa

Converts annotations to be compatible with rasa.

Module Contents

class dialoguekit.utils.annotation_converter_dialoguekit_to_rasa.LiteralString

Bases: str

Initialize self. See help(type(self)) for accurate signature.

class dialoguekit.utils.annotation_converter_dialoguekit_to_rasa.AnnotationConverterRasa(filepath: str | None = '', save_to_path: str | None = None)

Bases: dialoguekit.utils.annotation_converter.AnnotationConverter

Converts annotations to be compatible with rasa.

Parameters:
  • filepath – Training data path.

  • save_to_path – Path to store the converted annotations.

rasa_string(v: List[str]) str

Reformats string to be compatible with rasa.

Parameters:

v – strings to be reformated.

Returns:

String containing the original items to be inserted into the rasa training data.

change_style(style: str, representer: Callable) Callable[[Any, Any], Any]

Used to change the python yaml data representation.

Parameters:
  • style – Style used to represent type

  • representer – ScalerNode representer

Returns:

Representer used for rasa formatting.

read_original() None

Reads the original training data.

run() Dict[str, str]

Generates 4 conversions of DialogueKit to Rasa compatible files.

The generated files are saved in the self._save_to_path.

Generated files:
  1. <originalname>_reformat.yaml

    The original file saved as a yaml

  2. <originalname>_types_w_examples.yaml

    The entity types with the corresponding entities identified in the text. Used to debug and give an overview

  3. <originalname>_rasa_user.yaml

    Conversion of the annotation file to a rasa nlu doc. This file represents the USER utterances with intents

  4. <originalname>_rasa_agent.yaml

    Conversion of the annotation file to a rasa nlu doc. This file represents the AGENT utterances with intents

Returns:

path to file pairs

Return type:

Filename

dialoguekit_to_rasa(utterances: List[dialoguekit.core.utterance.Utterance], intents: List[dialoguekit.core.intent.Intent]) str

Converts utterances to be rasa compatible.

Parameters:
  • utterances – Utterances to convert.

  • intents – The intents of the utterances.

Returns:

Rasa string with the utterances.

dialoguekit.utils.annotation_converter_dialoguekit_to_rasa.converter