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).

Version: 2.x

rasa.shared.core.generator

TrackerWithCachedStates Objects

class TrackerWithCachedStates(DialogueStateTracker)

A tracker wrapper that caches the state creation of the tracker.

past_states_for_hashing

| past_states_for_hashing(domain: Domain, omit_unset_slots: bool = False) -> Deque[FrozenState]

Generates and caches the past states of this tracker based on the history.

Arguments:

  • domain - a :class:rasa.shared.core.domain.Domain
  • omit_unset_slots - If True do not include the initial values of slots.

Returns:

A list of states

past_states

| past_states(domain: Domain, omit_unset_slots: bool = False, ignore_rule_only_turns: bool = False, rule_only_data: Optional[Dict[Text, Any]] = None) -> List[State]

Generates the past states of this tracker based on the history.

Arguments:

  • domain - The Domain.
  • omit_unset_slots - If True do not include the initial values of slots.
  • ignore_rule_only_turns - If True ignore dialogue turns that are present only in rules.
  • rule_only_data - Slots and loops, which only occur in rules but not in stories.

Returns:

a list of states

clear_states

| clear_states() -> None

Reset the states.

init_copy

| init_copy() -> "TrackerWithCachedStates"

Create a new state tracker with the same initial values.

copy

| copy(sender_id: Text = "", sender_source: Text = "") -> "TrackerWithCachedStates"

Creates a duplicate of this tracker.

A new tracker will be created and all events will be replayed.

update

| update(event: Event, skip_states: bool = False) -> None

Modify the state of the tracker according to an Event.

TrainingDataGenerator Objects

class TrainingDataGenerator()

__init__

| __init__(story_graph: StoryGraph, domain: Domain, remove_duplicates: bool = True, unique_last_num_states: Optional[int] = None, augmentation_factor: int = 50, tracker_limit: Optional[int] = None, use_story_concatenation: bool = True, debug_plots: bool = False)

Given a set of story parts, generates all stories that are possible.

The different story parts can end and start with checkpoints and this generator will match start and end checkpoints to connect complete stories. Afterwards, duplicate stories will be removed and the data is augmented (if augmentation is enabled).

generate

| generate() -> List[TrackerWithCachedStates]

Generate trackers from stories and rules.

Returns:

The generated trackers.

generate_story_trackers

| generate_story_trackers() -> List[TrackerWithCachedStates]

Generate trackers from stories (exclude rule trackers).

Returns:

The generated story trackers.