为什么在创建 LUIS 模型时应使用复合实体?

Why shoud I use composite entities when creating a LUIS model?

我从使用 Bot Framework 和 LUIS 的机器人开始。现在我有点难以理解为什么要使用复合实体。到目前为止,我从 LUIS 文档中了解到,复合实体用于将常规实体分组在 "category" 下。

如果我的机器人允许用户订购比萨饼,我将需要三个实体:比萨饼​​的数量、大小和比萨饼的名称。我知道我可以将这些实体分组到一个名为 OrderInformation 的复合实体下。但是我这样做有什么好处呢? LUIS 方面的性能?更好地学习?

我问这个是因为这是 LUIS 返回的 JSON。我仍然得到所有常规实体,就像我需要它们一样。

{
  "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"
        }
      ]
    }
  ]
}

复合实体如何让我在机器人端的生活更轻松?

复合实体在捕获类似 "two adult tickets to Paris" 的内容时会很有用;您将捕获 "two" 和 "Paris" 是单独的实体,而 "adult tickets" 是一个复合实体,它不仅定义了 "tickets",还定义了子类型 "adult".

"Adult" 本身不需要是一个实体,而是作为复合实体的一部分存在。