rasa.shared.nlu.training_data.message
You are viewing documentation for our open source project which is maintained by the community. If you want to get started building assistants with Rasa please check out our latest documentation here.
Message Objects #
classMessage()
add_features #
| add_features(features: Optional["Features"])->None
Adds the given features to the message.
Arguments:
features- the features to be added
add_diagnostic_data #
| add_diagnostic_data(origin: Text, data: Dict[Text, Any])->None
Adds diagnostic data from the origin component.
Arguments:
origin- Name of the component that created the data.data- The diagnostic data.
set #
|set(prop: Text, info: Any, add_to_output:bool=False)->None
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.
as_dict_nlu #
| as_dict_nlu()->dict
Get dict representation of message as it would appear in training data.
hash #
| hash()->int
Calculate a hash for the message.
Returns:
Hash of the message.
fingerprint #
| fingerprint()-> Text
Calculate a string fingerprint for the message.
Returns:
Fingerprint of the message.
build #
| @classmethod | build(cls, text: Text, intent: Optional[Text]=None, entities: Optional[List[Dict[Text, Any]]]=None, intent_metadata: Optional[Any]=None, example_metadata: Optional[Any]=None, **kwargs: Any)->"Message"
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_full_intent()-> Text
Get intent as it appears in training data.
get_combined_intent_response_key #
| get_combined_intent_response_key()-> Text
Get intent as it appears in training data.
get_sparse_features #
| get_sparse_features(attribute: Text, featurizers: Optional[List[Text]]=None)-> Tuple[Optional["Features"], Optional["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 #
| get_sparse_feature_sizes(attribute: Text, featurizers: Optional[List[Text]]=None)-> Dict[Text, List[int]]
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 #
| get_dense_features(attribute: Text, featurizers: Optional[List[Text]]=None)-> Tuple[Optional["Features"], Optional["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 #
| get_all_features(attribute: Text, featurizers: Optional[List[Text]]=None)-> List["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 #
| features_present(attribute: Text, featurizers: Optional[List[Text]]=None)->bool
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 #
| is_core_or_domain_message()->bool
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 #
| is_e2e_message()->bool
Checks whether the message came from an e2e story.
Returns:
True, if message is a from an e2e story, False otherwise.
find_overlapping_entities #
| find_overlapping_entities()-> List[Tuple[Dict[Text, Any], Dict[Text, Any]]]
Finds any overlapping entity annotations.