notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.8.x).

Version: Master/Unreleased

rasa.shared.nlu.training_data.formats.readerwriter

TrainingDataReader Objects

class TrainingDataReader(abc.ABC)

Reader for NLU training data.

__init__

def __init__() -> None

Creates reader instance.

read

def read(filename: Union[Text, Path], **kwargs: Any) -> "TrainingData"

Reads TrainingData from a file.

reads

@abc.abstractmethod
def reads(s: Text, **kwargs: Any) -> "TrainingData"

Reads TrainingData from a string.

TrainingDataWriter Objects

class TrainingDataWriter()

A class for writing training data to a file.

dump

def dump(filename: Text, training_data: "TrainingData") -> None

Writes a TrainingData object to a file.

dumps

def dumps(training_data: "TrainingData") -> Text

Turns TrainingData into a string.

prepare_training_examples

@staticmethod
def prepare_training_examples(training_data: "TrainingData") -> OrderedDict

Pre-processes training data examples by removing not trainable entities.

generate_list_item

@staticmethod
def generate_list_item(text: Text) -> Text

Generates text for a list item.

generate_message

@staticmethod
def generate_message(message: Dict[Text, Any]) -> Text

Generates text for a message object.

generate_entity

@staticmethod
def generate_entity(text: Text, entity: Dict[Text, Any]) -> Text

Generates text for an entity object.

JsonTrainingDataReader Objects

class JsonTrainingDataReader(TrainingDataReader)

reads

def reads(s: Text, **kwargs: Any) -> "TrainingData"

Transforms string into json object and passes it on.

read_from_json

def read_from_json(js: Dict[Text, Any], **kwargs: Any) -> "TrainingData"

Reads TrainingData from a json object.