notice
This is unreleased documentation for Rasa Documentation Main/Unreleased version.
For the latest released documentation, see the latest version (3.x).
rasa.shared.core.training_data.structures
EventTypeError Objects
Represents an error caused by a Rasa Core event not being of the expected type.
Checkpoint Objects
Represents places where trackers split.
This currently happens if
- users place manual checkpoints in their stories
- have
or
statements for intents in their stories.
__init__
Creates Checkpoint
.
Arguments:
name
- Name of the checkpoint.conditions
- Slot conditions for this checkpoint.
filter_trackers
Filters out all trackers that do not satisfy the conditions.
StoryStep Objects
A StoryStep is a section of a story block between two checkpoints.
NOTE: Checkpoints are not only limited to those manually written in the story file, but are also implicitly created at points where multiple intents are separated in one line by chaining them with "OR"s.
__init__
Initialise StoryStep
default attributes.
as_story_string
Returns a story as a string.
is_action_unlikely_intent
Checks if the executed action is a action_unlikely_intent
.
is_action_session_start
Checks if the executed action is a action_session_start
.
explicit_events
Returns events contained in the story step including implicit events.
Not all events are always listed in the story dsl. This includes listen actions as well as implicitly set slots. This functions makes these events explicit and returns them with the rest of the steps events.
RuleStep Objects
A Special type of StoryStep representing a Rule.
get_rules_condition
Returns a list of events forming a condition of the Rule.
get_rules_events
Returns a list of events forming the Rule, that are not conditions.
add_event_as_condition
Adds event to the Rule as part of its condition.
Arguments:
event
- The event to be added.
Story Objects
from_events
Create a story from a list of events.
StoryGraph Objects
Graph of the story-steps pooled from all stories in the training data.
__hash__
Return hash for the story step.
Returns:
Hash of the story step.
fingerprint
Returns a unique hash for the stories which is stable across python runs.
Returns:
fingerprint of the stories
ordered_steps
Returns the story steps ordered by topological order of the DAG.
cyclic_edges
Returns the story steps ordered by topological order of the DAG.
merge
Merge two StoryGraph together.
overlapping_checkpoint_names
Find overlapping checkpoints names.
with_cycles_removed
Create a graph with the cyclic edges removed from this graph.
order_steps
Topological sort of the steps returning the ids of the steps.
topological_sort
Creates a top sort of a directed graph. This is an unstable sorting!
The function returns the sorted nodes as well as the edges that need to be removed from the graph to make it acyclic (and hence, sortable).
The graph should be represented as a dictionary, e.g.:
>>> example_graph = { ... "a": set("b", "c", "d"), ... "b": set(), ... "c": set("d"), ... "d": set(), ... "e": set("f"), ... "f": set()} >>> StoryGraph.topological_sort(example_graph) (deque([u'e', u'f', u'a', u'c', u'd', u'b']), [])
is_empty
Checks if StoryGraph
is empty.
__repr__
Returns text representation of object.
generate_id
Generate a random UUID.
Arguments:
prefix
- String to prefix the ID with.max_chars
- Maximum number of characters.
Returns:
Generated random UUID.