【问题标题】:Display entities in a given order按给定顺序显示实体
【发布时间】:2018-08-22 07:36:37
【问题描述】:

以下是我的示例话语 - 哪个产品在总体销售不佳的城市的销售表现更好。我希望实体以发布的顺序显示。

"entities": [
    {
      "entity": "city",
      "type": "entitylistgeographyrelated",
      "startIndex": 52,
      "endIndex": 55,
      "resolution": {
        "values": [
          "city"
        ]
      }
    },
    {
      "entity": "sales",
      "type": "entitylistmeasurevalues",
      "startIndex": 37,
      "endIndex": 41,
      "resolution": {
        "values": [
          "Sales $,amount"
        ]
      }
    },
    {
      "entity": "sales",
      "type": "entitylistmeasurevalues",
      "startIndex": 81,
      "endIndex": 85,
      "resolution": {
        "values": [
          "Sales $,amount"
        ]
      }
    },
    {
      "entity": "product",
      "type": "entitylistproductrelated",
      "startIndex": 6,
      "endIndex": 12,
      "resolution": {
        "values": [
          "product"
        ]
      }
    },
    {
      "entity": "best",
      "type": "entitymaximum",
      "startIndex": 65,
      "endIndex": 68,
      "score": 0.9999881
    },
    {
      "entity": "worst",
      "type": "entityminimum",
      "startIndex": 28,
      "endIndex": 32,
      "score": 0.9999083
    },
    {
      "entity": "product is performing worst at sales from",
      "type": "productgeocomposite",
      "startIndex": 6,
      "endIndex": 46,
      "score": 0.6175548
    }
  ],

不是在给定的订单中,所以我很难绘制产品或城市的最大销售额,仅此而已

【问题讨论】:

  • 是的,当然。以下是我的示例话语。 “哪个产品在总体销售不佳的城市的销售表现更好”。当我检查 Luis 中的响应时,我可以看到以下 JSON 响应,
  • LUIS 不会改变它返回数据的方式。您是在询问如何在收到 JSON 后映射/重新排列它——在 Node 或 Python 中?
  • 是的,我想重新排列它,luis 中是否有可用的功能
  • Saranraj K 如果您能更好地准确定义需要什么,我可以帮助您实现它。
  • @SaranrajK 我也无法理解你想要什么。您能否再澄清一点,或者提供一个期望结果的例子?

标签: node.js python-3.x azure-language-understanding


【解决方案1】:

LUIS 不会更改 JSON 中实体的顺序。他们应该是无关紧要的。如果您依靠元素的顺序来确定您的用户指的是哪个实体,我建议您重新考虑您的模型。

例如,在以下话语中:

“为我预订从伦敦到巴黎的航班”

如果您有一个名为“City”的实体并像这样标记实体,那么您做错了:

“为我预订从{city}到{city}的航班”

这不会让您知道哪个是始发城市,哪个是目的地城市。尝试依赖实体的顺序是一种非常脆弱的技术,可能会让您陷入困境。

在这种情况下,您应该有两个实体,一个用于起点,一个用于目的地,并相应地标记它们,如下所示:

“为我预订从 {originCity} 到 {destinationCity} 的航班”

这样,LUIS 将根据您提供的训练话语,能够根据句子中实体的上下文区分这两个实体,并为您提供无需依赖即可使用的类型根据实体的顺序。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-31
    • 1970-01-01
    • 2018-03-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多