notice
This is documentation for Rasa Open Source Documentation v2.3.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (2.5.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_actions_and_entities
Transforms list of trackers to lists of states, actions and entity data.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A tuple of list of states, list of actions and list of entity data.
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 interpreterbilou_tagging
- indicates whether BILOU tagging should be used or not
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 dialogue turn in all training trackers
- A dictionary of entity type (ENTITY_TAGS) to a list of features containing entity tag ids for text user inputs otherwise empty dict for all dialogue turns in all training trackers
prediction_states
Transforms list of trackers to lists of states for prediction.
Arguments:
trackers
- The trackers to transformdomain
- The domainuse_text_for_last_user_input
- Indicates whether to use text or intent label for featurizing last user input.
Returns:
A list of states.
create_state_features
Create state features for prediction.
Arguments:
trackers
- A list of state trackersdomain
- The domaininterpreter
- The interpreteruse_text_for_last_user_input
- Indicates whether to use text or intent label for featurizing last user input.
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_actions_and_entities
Transforms list of trackers to lists of states, actions and entity data.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A tuple of list of states, list of actions and list of entity data.
prediction_states
Transforms list of trackers to lists of states for prediction.
Arguments:
trackers
- The trackers to transformdomain
- The domain,use_text_for_last_user_input
- Indicates whether to use text or intent label for featurizing last user input.
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_actions_and_entities
Transforms list of trackers to lists of states, actions and entity data.
Arguments:
trackers
- The trackers to transformdomain
- The domain
Returns:
A tuple of list of states, list of actions and list of entity data.
prediction_states
Transforms list of trackers to lists of states for prediction.
Arguments:
trackers
- The trackers to transformdomain
- The domainuse_text_for_last_user_input
- Indicates whether to use text or intent label for featurizing last user input.
Returns:
A list of states.