apichatbotrasarasa-core

Rasa with wildcard entity


I'm using Rasa 2.6 and am trying to find a way for a user to search for recipes without having a ridiculous list of entities. So instead of:

- intent: cooking_baking
  examples: |
  - show me a recipie for [cake](cookingAndBaking)
  - show me a recipie for [pizza](cookingAndBaking)
  - show me a recipie for [pie](cookingAndBaking)

The user should be able to specify the recipe they are looking for with this:

- intent: cooking_baking
  examples: |
  - show me a recipie for [*](cookingAndBaking)

and have their recipe still be returned.


Solution

  • The entity extraction is using machine learning, where a model is 'trained' to do the extraction by looking at example sentences.

    You do not need to provide a very long list of example sentences. As long as you provide sufficient examples, typically between 5-20, the model will learn to extract the entity value, even if it was not provided in a training example.

    When creating the example sentences, it is recommended to use a wide variety of ways that users talk to your bot, like in your example:

    - intent: cooking_baking
      examples: |
      - show me a recipie for [cake](cookingAndBaking)
      - do you have a recipie for [pizza](cookingAndBaking)
      - Can you help me bake a [pie](cookingAndBaking)?
      - etc.
    

    It is recommended to apply Conversation-Driven Development. This means that you should not try to come up with too many sentences by yourself. Just enough so it kind of works, and then let some other people talk to your bot. You then selectively add their sentences to your training data.