'Parsing' intent and filling slot?

let say i have the following story :

## code example
* example
 - utter_example
* explain
 - utter_explain
* gotit
 - utter_gotit

## intent: example
- [assign](etype) example
- [sum](etype) example
- [multiplication](etype) example
- [conditional](etype)
- [loop](etype) example
- [eqvseq2](etype) example

how can I fill a slot with the value of entity “etype” during the execution/recognition of the “*example” intent. So that I can use this slot type in the next actions to decide what to do/utter ??

Slots are filled automatically if they have the same name as the detected entities (Slots).

How it works?

  1. Define a slot and an entity in your domain file with the same name, e.g. etype
  2. When Rasa is parsing the message and detects the entity etype in the user’s message, the slot etype is set automatically
  3. The slot etype is persisted and can be used in the next action

Does that help?

1 Like

yes… i tested it … and works :wink: thanks…

Is there a way to set the slot with specific value every time … f.e. let say i have :

[conditional](etype)
[if](etype)
[if-then](etype)

can I force it to set etype=conditional in all 3 cases ?

You can use synonyms for that:

[conditional](etype)
[if](etype:conditional)
[if-then](etype:conditional)

If you define your training data like this and if is detected as etype, it is substituted by its synonym conditional. See Training Data Format.

1 Like