rasa.shared.core.training_data.story_writer.yaml_story_writer
YAMLStoryWriter Objects
Writes Core training data into a file in a YAML format.
dumps
Turns Story steps into an YAML string.
Arguments:
story_steps
- Original story steps to be converted to the YAML.is_appendable
- Specify if result should not contain high level keys/definitions and can be appended to the existing story file.is_test_story
- Identifies if the stories should be exported in test stories format.
Returns:
String with story steps in the YAML format.
dump
Writes Story steps into a target file/stream.
Arguments:
target
- name of the target file/stream to write the YAML to.story_steps
- Original story steps to be converted to the YAML.is_appendable
- Specify if result should not contain high level keys/definitions and can be appended to the existing story file.is_test_story
- Identifies if the stories should be exported in test stories format.
stories_to_yaml
Converts a sequence of story steps into yaml format.
Arguments:
story_steps
- Original story steps to be converted to the YAML.is_test_story
-True
if the story is an end-to-end conversation test story.
process_story_step
Converts a single story step into an ordered dict.
Arguments:
story_step
- A single story step to be converted to the dict.
Returns:
Dict with a story step.
process_event
Process an event or list of events.
stories_contain_loops
Checks if the stories contain at least one active loop.
Arguments:
stories
- Stories steps.
Returns:
True
if the stories
contain at least one active loop.
False
otherwise.
process_user_utterance
Converts a single user utterance into an ordered dict.
Arguments:
user_utterance
- Original user utterance object.is_test_story
- Identifies if the user utterance should be added to the final YAML or not.
Returns:
Dict with a user utterance.
process_action
Converts a single action into an ordered dict.
Arguments:
action
- Original action object.
Returns:
Dict with an action.
process_slot
Converts a single SlotSet
event into an ordered dict.
Arguments:
event
- OriginalSlotSet
event.
Returns:
OrderedDict with an SlotSet
event.
process_checkpoints
Converts checkpoints event into an ordered dict.
Arguments:
checkpoints
- List of original checkpoint.
Returns:
List of converted checkpoints.
process_or_utterances
Converts user utterance containing the OR
statement.
Arguments:
utterances
- User utterances belonging to the sameOR
statement.
Returns:
Dict with converted user utterances.
process_active_loop
Converts ActiveLoop event into an ordered dict.
Arguments:
event
- ActiveLoop event.
Returns:
Converted event.
process_rule_step
Converts a RuleStep into an ordered dict.
Arguments:
rule_step
- RuleStep object.
Returns:
Converted rule step.