notice

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

Version: Master/Unreleased

rasa.shared.core.generator

TrackerWithCachedStates Objects

class TrackerWithCachedStates(DialogueStateTracker)

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

past_states_for_hashing

def 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

def 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

def clear_states() -> None

Reset the states.

init_copy

def init_copy() -> "TrackerWithCachedStates"

Create a new state tracker with the same initial values.

copy

def 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

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

Modify the state of the tracker according to an Event.

TrainingDataGenerator Objects

class TrainingDataGenerator()

Generates trackers from training data.

__init__

def __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

def generate() -> List[TrackerWithCachedStates]

Generate trackers from stories and rules.

Returns:

The generated trackers.

generate_story_trackers

def generate_story_trackers() -> List[TrackerWithCachedStates]

Generate trackers from stories (exclude rule trackers).

Returns:

The generated story trackers.