Data and stories speical syntax questions


(Ellery Leung) #1


In RasaDemo, there are some syntaxs I don’t quite understand, can you please help to clarify?

  • In data file that is used by RasaNLU to train model, there are something like below:

    ## intent:list_of_products
    - [My Product 1](product)
    - [My Product 2](product)
    - [My Product 3](product)
    • What is (product)? Is it an entity? Or just a parameter?
    • If it is a parameter, can it be passed to intent/action/utter below?
  • In, I often see something like this:

    ## ecommerce_purchase_path
    * INTENT_40
        - utter_greeting_from_ai
    * INTENT_27{"product_id": "0"}
        - utter_what_product_do_you_want
        - action_product_recommendation
    * list_of_products
        - utter_awesome
        - utter_are_you_sure
    * confirm
        - action_confirm_add_to_cart
        - slot{"product_id": "0"}
        - utter_product_added_to_cart
    • What is the {} after an intent?
    • What is the {} after a slot?
    • Can {} be added after an action or an utter?
    • What is the key in {} represent? Is key an entity, or just a parameter which is passed to an action?
    • What is the value in {} represent?
      • Is value here a default value? If yes,
      • What other data type I can use in this value field?
      • What if I want to pass a boolean value, and what if I want to pass an array?

(Tom Metcalfe) #2


(product) is the entity type here, correct! So a user message including this would be parsed as this: intent{"product": "My Product 1"}

On the other hand, an event like slot{"product_id": "0"} in a story signifies that the slot product_id was set with value 0. These slot setting events are important because they are used to predict next actions during real conversations.

(I see the confusion, just remember that {} is an entity when uttered by human and slot event otherwise)

You can’t append {} to an action name or utterance, no

All entities are parsed as strings since they come from user messages, you’d have to implement an action to map an entity to some boolean or array.

Slots, however, can be of many different types - you just need to specify what type they are in your domain. Hopefully this doc page clears it up more for you