# How to make a bot which detects product names from the nlu?

**URL:** <https://forum.rasa.com/t/how-to-make-a-bot-which-detects-product-names-from-the-nlu/52214>\
**Category:** Rasa Open Source\
**Created:** [March 28, 2022, 10:07am UTC](https://forum.rasa.com/t/how-to-make-a-bot-which-detects-product-names-from-the-nlu/52214 "2022-03-28T10:07:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nimish-tembhurne](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nimish-tembhurne/32/20008_2.png) [@nimish-tembhurne](https://forum.rasa.com/u/nimish-tembhurne)\
**Post date:** [March 28, 2022, 10:07am UTC](https://forum.rasa.com/t/how-to-make-a-bot-which-detects-product-names-from-the-nlu/52214/1 "2022-03-28T10:07:12Z")

</div>

How can I make a bot which detects product names. for example, if a user types - I want to buy classmate notebooks…I want my bot to detect ‘classmate notebooks’ from the sentence. Since the list of product names can be very big, how can I efficiently detect the product names? I have tried to use entities and i have included some similar training examples, but not all the products get detected. Has anyone done such similar thing? If yes then can you help me. I am new to rasa.

---

<div class="post-metadata">

**Author:** ![E-dC](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@E-dC](https://forum.rasa.com/u/E-dC)\
**Post date:** [March 28, 2022, 12:47pm UTC](https://forum.rasa.com/t/how-to-make-a-bot-which-detects-product-names-from-the-nlu/52214/2 "2022-03-28T12:47:43Z")

</div>

Hi,

I’ve done that with lookups and synonyms once, it was working okay, as I remember it:

```auto

nlu:

# Have some examples in your intent(s):
- intent: find_product
  examples: |
    - Where can I find [classmate notebooks](product)
    - I want to buy [foil](product)
# etc

# If the product name is in the list, it'll be captured as an entity
- lookup: product
  examples: |
    - aluminium foil
    - aluminum
    - foil
    - batteries
    - battery
    - bicycles
    - bike
    - books
    - book
    - textbooks
# etc

# Change the value of your entity "product" into something standardized
- synonym: "Aluminium foil"
  examples: |
    - aluminium foil
    - aluminum
    - foil

- synonym: "Batteries"
  examples: |
    - batteries
    - battery

- synonym: "Bicycles"
  examples: |
    - bicycles
    - bike

- synonym: "Books"
  examples: |
    - books
    - book
    - textbooks
# etc

```

You _might_ want to generate and/or update these lists automatically, though.

Hope that helps

---

<div class="post-metadata">

**Author:** ![nimish-tembhurne](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nimish-tembhurne/32/20008_2.png) [@nimish-tembhurne](https://forum.rasa.com/u/nimish-tembhurne)\
**Post date:** [March 28, 2022, 3:44pm UTC](https://forum.rasa.com/t/how-to-make-a-bot-which-detects-product-names-from-the-nlu/52214/3 "2022-03-28T15:44:26Z")

</div>

Thanks for replying. I had actually read about using lookup tables for that, but since I have more than a million products to detect, will using lookup tables be a good idea? By that I mean will that affect my model’s performance

---

<div class="post-metadata">

**Author:** ![E-dC](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@E-dC](https://forum.rasa.com/u/E-dC)\
**Post date:** [April 6, 2022, 1:35pm UTC](https://forum.rasa.com/t/how-to-make-a-bot-which-detects-product-names-from-the-nlu/52214/4 "2022-04-06T13:35:28Z")

</div>

It might affect performance, I’m not sure…

You could try with a subset of the products, see how it’s behaving, etc.

If you run into performance issues, you could still capture the entity `product`, but do the standardization with an action, for example calculating edit distances to figure out the closest standard form. This way you can optimize as much as you want.

Then you can use the action in the appropriate stories.
