Lez
Lez

Reputation: 161

How to get inputs as Intents using Rasa

How best to create my story to process inputs for the sequence:

  1. User greets
  2. Bot reply with greeting
  3. Bot asks user name
  4. User enters name
  5. Bot saves user name

How do I process the input without setting a pattern like "My name is Tom" but being able to process "Tom" as a username

Working with rasa-core and rasa-nlu on my local machine running python.

Upvotes: 1

Views: 2154

Answers (2)

randomal
randomal

Reputation: 6592

Update Rasa 2.2.9: in addition to what Tobias suggested, you also need to edit domain.yml and add the following lines:

slots:
  name: 
    type: text
    initial_value: "human"

entities:
  - name

Upvotes: 0

Tobias
Tobias

Reputation: 1910

You can use define an intent inform, which looks like that in your NLU training data (be sure to provide more examples (> 10) with names so that the entity recognition works reliable):

## intent:inform
- [Tom](name)
- [Lisa](name)
- It is [Tom](name)
- My name is [Bob](name)

and than have a story like:

## Ask name
* greet
  - utter_greet
  - utter_ask_name
* inform{"name": "A name"}
  - action_save_name

Upvotes: 2

Related Questions