2
votes

I'm starting with bots using the Bot Framework and LUIS. Right now I'm having a little trouble understanding why should I use Composite Entities. What I got so far from the LUIS documentation is that Composite Entities are used to group regular entities under a "category".

If my bot allows to the user to order a pizza I would need, for example, three entities: The number of pizzas, the size, and the name of the pizza. I understand that I could group these entities under a composite entity called OrderInformation. But what do I gain from doing things like this? Performance on the LUIS side? Better learning?

I ask this because here is the JSON returned by LUIS. I still get all the regular entities, just like I would need them.

{
  "query": "I want to order 3 big pepperoni pizzas",
  "intents": [
    {
      "intent": "OrderFood",
      "score": 0.999999046
    },
    {
      "intent": "None",
      "score": 0.13833718
    },
    {
      "intent": "FindNews",
      "score": 0.0120750656
    }
  ],
  "entities": [
    {
      "entity": "3",
      "type": "Number",
      "startIndex": 16,
      "endIndex": 16,
      "score": 0.925765157
    },
    {
      "entity": "big",
      "type": "Size",
      "startIndex": 18,
      "endIndex": 20,
      "score": 0.926587939
    },
    {
      "entity": "pepperoni pizzas",
      "type": "Food",
      "startIndex": 22,
      "endIndex": 37,
      "score": 0.8726012
    },
    {
      "entity": "3 big pepperoni pizzas",
      "type": "Order",
      "startIndex": 16,
      "endIndex": 37,
      "score": 0.8385274
    }
  ],
  "compositeEntities": [
    {
      "parentType": "Order",
      "value": "3 big pepperoni pizzas",
      "children": [
        {
          "type": "Number",
          "value": "3"
        },
        {
          "type": "Food",
          "value": "pepperoni pizzas"
        },
        {
          "type": "Size",
          "value": "big"
        }
      ]
    }
  ]
}

How would the composite entity make my life easier on the bot side?

1

1 Answers

2
votes

Composite entities would be useful when capturing something like "two adult tickets to Paris"; you'd capture "two" and "Paris" are separate entities whereas "adult tickets" is a composite entity which not only defines "tickets" but the sub type "adult".

"Adult" wouldn't need to be an entity on its own, but exists as part of a composite entity.