How to handle multiple similar intents

Hello, I’m having issue with this similar intents. I’ve read way is to have them into a single intent using entities to differentiate. Here is my case:

intent: ask_lesson
examples: |
  what is [mathematics]{entity: "lesson"}
  what does [physics]{entity: "lesson"} teach
  what is taught in [physical education](lesson) class

and in domain.yml, I have response for each lesson asked. I also declared the entity name “lesson” and declared the intent of “ask_lesson” to use entity called “lesson”.

  - ...
  - ask_lesson:
      - lesson

  - lesson

    - text: foo/bar
    - text: foo/bar

I’ve also added synonyms for the entity keywords, like

- synonym: math
  examples: |
    - mathematics
    - mathematic
- synonym: phys
  examples: |
    - physics
    - phy

I added stories to cover each entity and the respective response to train, but I ended up getting failed result when I tried chatting with the bot myself.

I made utter_default and it always sent me the default message whenever I sent ask_lesson intent. Also I don’t configure the config.yml, only let the system automatically choose the pipeline components for me, which are

  • Whitespace Tokenizer
  • Regex Featurizer
  • LexicalSyntacticFeaturizer
  • CountVectorsFeaturizer
  • DIETClassifier
  • EntitySynonymMapper
  • ResponseSelector
  • FallbackClassifier

Hello @Nortuirea. I hope you have seen this documentation : Tuning Your NLU Model . Even you can see this blog post on how to handle multiple intents: How to Handle Multiple Intents Using Rasa NLU TensorFlow Pipeline | The Rasa Blog | Rasa Note: This blog is quite old, but it’s still good to get the idea of dealing the multiple similar intents.

I hope this will help you :slight_smile:

Yes, I’ve read the pipeline components from the docs. I decided not to make any alterations because the automatically used components seem to have included what I need, or at least the minimum I can work around with.

As for TensorFlow pipeline for merged intents, that’s a new read for me and hopefully I would get a chance to use that in the future.

As of now, my issue is that I’ve tried to make it work as much as possible but it just doesn’t seem to work correctly with the response for entity-extracted intent.

This, you can see that I sent an ask_lesson intent, and it extracted the lesson entity with value “pik”.

  "text": "apa itu pik",
  "intent": {
    "name": "ask_lesson",
    "confidence": 0.9929700493812561
  "entities": [
      "entity": "lesson",
      "start": 8,
      "end": 11,
      "confidence_entity": 0.9917750358581543,
      "value": "pik",
      "extractor": "DIETClassifier"

So far it worked without issue until I tried chatting with the bot myself.

Your input ->  apa itu pik
Maaf, saya kurang mengerti apa yang anda sampaikan. Bisakah anda ulangi kembali?

it sent me utter_default instead of the appropriate response I’ve assigned from stories.yml. How to deal with this problem? Is there a way to set rules with entity as condition instead of slots?

If I remove the utter_default, the bot won’t send any response at all and just await my next input.