# How to handle multiple similar intents

**URL:** <https://forum.rasa.com/t/how-to-handle-multiple-similar-intents/51057>\
**Category:** Rasa Open Source\
**Created:** [February 1, 2022, 3:51pm UTC](https://forum.rasa.com/t/how-to-handle-multiple-similar-intents/51057 "2022-02-01T15:51:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nortuirea](https://avatars.discourse-cdn.com/v4/letter/n/838e76/32.png) [@Nortuirea](https://forum.rasa.com/u/Nortuirea)\
**Post date:** [February 1, 2022, 3:51pm UTC](https://forum.rasa.com/t/how-to-handle-multiple-similar-intents/51057/1 "2022-02-01T15:51:38Z")

</div>

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:

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

```

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** ”.

```auto
intents:
  - ...
  - ask_lesson:
    use_entities:
      - lesson

entities:
  - lesson

response:
  utter_answer/math:
    - text: foo/bar
  utter_answer/physics:
    - text: foo/bar
  etc...

```

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

```auto
- synonym: math
  examples: |
    - mathematics
    - mathematic
- synonym: phys
  examples: |
    - physics
    - phy
etc...

```

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

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [February 1, 2022, 6:51pm UTC](https://forum.rasa.com/t/how-to-handle-multiple-similar-intents/51057/2 "2022-02-01T18:51:43Z")

</div>

Hello @Nortuirea. I hope you have seen this documentation : [Tuning Your NLU Model](https://rasa.com/docs/rasa/tuning-your-model/#doing-multi-intent-classification) . 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](https://rasa.com/blog/how-to-handle-multiple-intents-per-input-using-rasa-nlu-tensorflow-pipeline/) 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 🙂

---

<div class="post-metadata">

**Author:** ![Nortuirea](https://avatars.discourse-cdn.com/v4/letter/n/838e76/32.png) [@Nortuirea](https://forum.rasa.com/u/Nortuirea)\
**Post date:** [February 2, 2022, 4:30am UTC](https://forum.rasa.com/t/how-to-handle-multiple-similar-intents/51057/3 "2022-02-02T04:30:07Z")

</div>

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”.

```auto
{
  "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.

```auto
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._
