RASA Linking between entities

Hello All,

Is there a way t link between Entities? So I mean if I have a sentence like: I want 3 iPhones and 2 Laptops. How to inform rasa to link the number 3 to the iPhones and number 2 to the laptops.

This is an example, we might have I need three of the iPhones X and 4 of the iPhones X pro. Do we have a way to inform RASA how to link between the entities?

Your help will greatly be appreciated!

Hello!

You could try use entity groups as follows:

I want [3]{"entity": "number", "group": "1"} [iPhones]{"entity": "product", "group": "1"} and [2]{"entity": "number", "group": "2"} [Laptops]{"entity": "product", "group": "2"}

so the result is:

{
  "text": "I want 3 iPhones and 2 Laptops",
  "intent": "book_flight",
  "entities": [
    {
      "start": 7,
      "end": 8,
      "value": "3",
      "entity": "number",
      "group": "1",
      "extractor": "DIETClassifier",
    },
    {
      "start": 9,
      "end": 16,
      "value": "iPhones",
      "entity": "product",
      "group": "1",
      "extractor": "DIETClassifier",
    },
    {
      "start": 21,
      "end": 22,
      "value": "2",
      "entity": "number",
      "group": "2",
      "extractor": "DIETClassifier",
    },
    {
      "start": 23,
      "end": 30,
      "value": "Laptops",
      "entity": "product",
      "group": "2",
      "extractor": "DIETClassifier",
    }
  ]
}

The downsize is you have to set fixed number of groups before training NLU. In my experience in food domain user provides one group 80% of queries, two groups ~18% and more than 3 groups only ~2% of all queries per intent.

@artemsnegirev Thanks for your reply, yes it works properly. Best Regards,

1 Like