Version: 2.0.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

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"

Build 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"]]

Get all sparse features for the given attribute that are coming from the given 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"]]

Get all dense features for the given attribute that are coming from the given 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.

features_present

| features_present(attribute: Text, featurizers: Optional[List[Text]] = None) -> bool

Check if there are any features present for the given 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_message

| is_core_message() -> bool

Checks whether the message is a core message or not.

E.g. a core message is created from a story, not from the NLU data.

Returns:

True, if message is a core message, false otherwise.