notice
This is documentation for Rasa Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).
rasa.nlu.training_data.training_data
TrainingData Objects
Holds loaded intent and entity training data.
merge
Return merged instance of this data with other training data.
filter_training_examples
Filter training examples.
Arguments:
condition
- A function that will be applied to filter training examples.
Returns:
TrainingData
- A TrainingData with filtered training examples.
sanitize_examples
Makes sure the training data is clean.
Remove trailing whitespaces from intent and response annotations and drop duplicate examples.
intents
Returns the set of intents in the training data.
retrieval_intents
Returns the total number of response types in the training data
number_of_examples_per_intent
Calculates the number of examples per intent.
number_of_examples_per_response
Calculates the number of examples per response.
entities
Returns the set of entity types in the training data.
entity_roles
Returns the set of entity roles in the training data.
entity_groups
Returns the set of entity groups in the training data.
number_of_examples_per_entity
Calculates the number of examples per entity.
sort_regex_features
Sorts regex features lexicographically by name+pattern
nlu_as_json
Represent this set of training examples as json.
nlg_as_markdown
Generates the markdown representation of the response phrases (NLG) of TrainingData.
nlg_as_yaml
Generates yaml representation of the response phrases (NLG) of TrainingData.
Returns:
responses in yaml format as a string
nlu_as_markdown
Generates the markdown representation of the NLU part of TrainingData.
persist
Persists this training data to disk and returns necessary information to load it again.
sorted_entities
Extract all entities from examples and sorts them by entity type.
sorted_intent_examples
Sorts the intent examples by the name of the intent and then response
validate
Ensures that the loaded training data is valid.
Checks that the data has a minimum of certain training examples.
train_test_split
Split into a training and test dataset, preserving the fraction of examples per intent.
split_nlu_examples
Split the training data into a train and test set.
Arguments:
train_frac
- percentage of examples to add to the training set.random_seed
- random seed
Returns:
Test and training examples.
is_empty
Checks if any training data was loaded.
without_empty_e2e_examples
Removes training data examples from intent labels and action names which were added for end-to-end training.
Returns:
Itself but without training examples which don't have a text or intent.