notice
This is documentation for Rasa Open Source Documentation v2.1.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (2.2.x).
rasa.core.featurizers.tracker_featurizers
InvalidStory Objects
Exception that can be raised if story cannot be featurized.
TrackerFeaturizer Objects
Base class for actual tracker featurizers.
__init__
Initialize the tracker featurizer.
Arguments:
state_featurizer
- The state featurizer used to encode the states.
training_states_and_actions
Transforms list of trackers to lists of states and actions.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A tuple of list of states and list of actions.
featurize_trackers
Featurize the training trackers.
Arguments:
trackers
- list of training trackersdomain
- the domaininterpreter
- the interpreter
Returns:
- a dictionary of state types (INTENT, TEXT, ACTION_NAME, ACTION_TEXT, ENTITIES, SLOTS, ACTIVE_LOOP) to a list of features for all dialogue turns in all training trackers
- the label ids (e.g. action ids) for every dialuge turn in all training trackers
prediction_states
Transforms list of trackers to lists of states for prediction.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A list of states.
create_state_features
Create state features for prediction.
Arguments:
trackers
- A list of state trackersdomain
- The domaininterpreter
- The interpreter
Returns:
A dictionary of state type (INTENT, TEXT, ACTION_NAME, ACTION_TEXT, ENTITIES, SLOTS, ACTIVE_LOOP) to a list of features for all dialogue turns in all trackers.
persist
Persist the tracker featurizer to the given path.
Arguments:
path
- The path to persist the tracker featurizer to.
load
Load the featurizer from file.
Arguments:
path
- The path to load the tracker featurizer from.
Returns:
The loaded tracker featurizer.
FullDialogueTrackerFeaturizer Objects
Creates full dialogue training data for time distributed architectures.
Creates training data that uses each time output for prediction. Training data is padded up to the length of the longest dialogue with -1.
training_states_and_actions
Transforms list of trackers to lists of states and actions.
Training data is padded up to the length of the longest dialogue with -1.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A tuple of list of states and list of actions.
prediction_states
Transforms list of trackers to lists of states for prediction.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A list of states.
MaxHistoryTrackerFeaturizer Objects
Slices the tracker history into max_history batches.
Creates training data that uses last output for prediction. Training data is padded up to the max_history with -1.
slice_state_history
Slice states from the trackers history.
If the slice is at the array borders, padding will be added to ensure the slice length.
Arguments:
states
- The statesslice_length
- The slice length
Returns:
The sliced states.
training_states_and_actions
Transforms list of trackers to lists of states and actions.
Training data is padded up to the length of the longest dialogue with -1.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A tuple of list of states and list of actions.
prediction_states
Transforms list of trackers to lists of states for prediction.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A list of states.