notice

This is documentation for Rasa Open Source Documentation v2.2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (2.3.x).

Version: 2.2.x

rasa.shared.nlu.training_data.message

Message Objects

class Message()

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 utterance
  • intent - an intent of the user utterance
  • entities - entities in the user's utterance
  • intent_metadata - optional metadata for the intent
  • example_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 attribute
  • featurizers - names of featurizers to consider

Returns:

Sparse features.

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 attribute
  • featurizers - 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 attribute
  • featurizers - 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.