rasa.shared.nlu.training_data.message
Message Objects
Container for data that can be used to describe a conversation turn.
The turn is described by a set of attributes such as e.g. TEXT and INTENT
when describing a user utterance or e.g. ACTION_NAME for describing a bot action.
The container includes raw information (self.data) as well as features
(self.features) for each such attribute.
Moreover, the message has a timestamp and can keep track about information
on a specific subset of attributes (self.output_properties).
__init__
Creates an instance of Message.
add_features
Add more vectorized features to the message.
add_diagnostic_data
Adds diagnostic data from the origin component.
Arguments:
origin- Name of the component that created the data.data- The diagnostic data.
set
Sets the message's property to the given value.
Arguments:
prop- Name of the property to be set.info- Value to be assigned to that property.add_to_output- Decides whether to addpropto theoutput_properties.
get
Retrieve message property.
as_dict_nlu
Get dict representation of message as it would appear in training data
as_dict
Gets dict representation of message.
__hash__
Calculate a hash for the message.
Returns:
Hash of the message.
fingerprint
Calculate a string fingerprint for the message.
Returns:
Fingerprint of the message.
build
Builds a Message from UserUttered data.
Arguments:
text- text of a user's utteranceintent- an intent of the user utteranceentities- entities in the user's utteranceintent_metadata- optional metadata for the intentexample_metadata- optional metadata for the intent example
Returns:
Message
get_full_intent
Get intent as it appears in training data
separate_intent_response_key
Splits intent into main intent name and optional sub-intent name.
For example, "FAQ/how_to_contribute" would be split into
("FAQ", "how_to_contribute"). The response delimiter can
take different values (not just "/") and depends on the
constant - RESPONSE_IDENTIFIER_DELIMITER.
If there is no response delimiter in the intent, the second tuple
item is None, e.g. "FAQ" would be mapped to ("FAQ", None).
get_sparse_features
Gets all sparse features for the attribute given the list of featurizers.
If no featurizers are provided, all available features will be considered.
Arguments:
attribute- message attributefeaturizers- names of featurizers to consider
Returns:
Sparse features.
get_sparse_feature_sizes
Gets sparse feature sizes for the attribute given the list of featurizers.
If no featurizers are provided, all available features will be considered.
Arguments:
attribute- message attributefeaturizers- names of featurizers to consider
Returns:
Sparse feature sizes.
get_dense_features
Gets all dense features for the attribute given the list of featurizers.
If no featurizers are provided, all available features will be considered.
Arguments:
attribute- message attributefeaturizers- names of featurizers to consider
Returns:
Dense features.
get_all_features
Gets all features for the attribute given the list of featurizers.
If no featurizers are provided, all available features will be considered.
Arguments:
attribute- message attributefeaturizers- names of featurizers to consider
Returns:
Features.
features_present
Checks if there are any features present for the attribute and featurizers.
If no featurizers are provided, all available features will be considered.
Arguments:
attribute- Message attribute.featurizers- Names of featurizers to consider.
Returns:
True, if features are present, False otherwise.
is_core_or_domain_message
Checks whether the message is a core message or from the domain.
E.g. a core message is created from a story or a domain action, not from the NLU data.
Returns:
True, if message is a core or domain message, false otherwise.
is_e2e_message
Checks whether the message came from an e2e story.
Returns:
True, if message is a from an e2e story, False otherwise.
find_overlapping_entities
Finds any overlapping entity annotations.
