notice

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

Version: 2.x

rasa.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: List[Dict[Text, 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

Returns:

Message

build_from_action

| @classmethod
| build_from_action(cls, action_text: Optional[Text] = "", action_name: Optional[Text] = "", **kwargs: Any, ,) -> "Message"

Build a Message from ActionExecuted data.

Arguments:

  • action_text - text of a bot's utterance
  • action_name - name of an action executed

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