How to map multiple items and their quantities rasa x

I have one use case to take multiple orders in one request.

but I won’t have any way to know which number stands for the which item

I want to map itemName with their quantity but rasa giving a response like below

Below is the input "I want one towel, pillow, and two dental kit"

    "text": "I want one towel, pillow, and two dental kits",

    "intent": {

        "id": 3738579166790568417,

        "name": "AMINITIES",

        "confidence": 0.9974870681762695


    "entities": [


            "entity": "aminityItem",

            "value": "bathing towel",


            "entity": "aminityItem",

            "value": "pillow",


            "entity": "aminityItem",

            "value": "dental kit",



            "text": "one",

            "value": 1,

            "entity": "number",



            "text": "two",

            "value": 2,

            "entity": "number",


How to map itemName with their quantity like this [ {itemName: towel, quantity: 1}, {itemName: pillow. quantity:1 //default}, {itemName: dental kit, quantity: Two}


Hi @Juste . I have this problem, please help me

Hi @JiteshGaikwad . I have this problem, please help me

Hi @souvikg10 . I have this problem, please help me

Hi @akelad . I have this problem, please help me

I also have the same problem where my user wants to order two items at the same time… “One pizza and two coke please”… In this case how can I know one is related to pizza and two is related to coke


1 Like

i think there should also be the start and end token position of the entities. you could potentially use that to map them. but it requires custom action to map them as quantity. i dont have anything else coming on how to map them.


Hello @sairam

To solve this kind of problem, we introduced entity groups. E.g. your training data could contain things like

I want [one]{"entity": "amount", "group": "1", "value": 1} [towel]{"entity": 
"aminityItem", "group": "1"}, [pillow]{"entity": "aminityItem", "group": "1"}, 
and [two]{"entity": "amount", "group": "2", "value": 2} [dental kit]{"entity": 
"aminityItem", "group": "2"}

The entity group distinguishes what amount is related to which items. Note, that you may have to give many examples so that the DIET classifier can learn this.


Thank you @j.mosig. But ’

entity number

extracting from duckling extractor. It’s predefined.

Do i need to take number as like custom entity using DIET

I’m proposing an alternative. It should be said that what I am proposing here is a bit advanced, but it might work. You could use spaCy in a custom action to parse the grammatical dependencies.

Here’s the main gist;

import spacy
from spacy import displacy

nlp = spacy.load("en_core_web_md")
doc = nlp("I want one towel, pillow, and two dental kits")

The doc object represents a parsed document, and here’s a visual.

Notice how there are numeric modifiers detected nummod. You can access this from spaCy to retrieve these. It would be some custom work, but if this is useful I might consider writing a component for something like this at the nlu-examples repo. I would try out @j.mosig’s suggestion first though since it’s much more straightforward. Should it not be enough then this option might be of aid.

1 Like

tq @souvikg10. Means do I need to write complex logic for this. Is there any another method for this

@sairam Ah, yes. Adding roles and groups to entities that were extracted by Duckling is still on our ToDo list and not yet supported. So yes, you’d have to use Rasa directly, instead of Duckling, for the number entities.

1 Like

tq @j.mosig for you support

Thanks for sharing the information vmware