【问题标题】:Luis Test Tool Datetime different than Locally Resolved DatetimeLuis 测试工具日期时间与本地解析的日期时间不同
【发布时间】:2020-01-06 16:49:09
【问题描述】:

我有一个为机器人技能创建的 Luis 模型。我正在使用预构建的 datetime 实体作为日期。

当我在 Luis 门户网站的测试工具上给出示例语句,例如 “Sell 5k [jargon] for this week at [jargon]”,我得到了我期望的响应(如下所示)。 timex 是 2020-W02-WE 并解析为 1/11 - 1/13。

请注意,对于下面的示例,我使用“本周末”作为查询,但无论我输入的话语是否符合我的技能意图,它都会解决相同的问题。为了简单起见,示例中使用了“本周末”。

预期:

{
  "query": "this weekend",
  "prediction": {
    "normalizedQuery": "this weekend",
    "topIntent": "None",
    "intents": {
      "None": {
        "score": 0.8771556
      }
    },
    "entities": {
      "datetimeV2": [
        {
          "type": "daterange",
          "values": [
            {
              "timex": "2020-W02-WE",
              "start": "2020-01-11",  *** Saturday ***
              "end": "2020-01-13"     ***  Monday  ***
            }
          ]
        }
      ],
      "$instance": {
        "datetimeV2": [
          {
            "type": "builtin.datetimeV2.daterange",
            "text": "this weekend",
            "startIndex": 0,
            "length": 12,
            "modelTypeId": 2,
            "modelType": "Prebuilt Entity Extractor",
            "recognitionSources": [
              "model"
            ]
          }
        ]
      }
    }
  }
}

问题是,当我在本地使用相同的话语时,我得到的日期范围代表整周 2020 年 1 月 6 日 - 2020 年 1 月 13 日(星期一 - 星期一)。 Timex 也是一样。但是,当我解决它时,我得到了不同的价值。

Luis 使用“本周末”的话语回应模拟器:

{
  "recognizerResult": {
    "alteredText": null,
    "entities": {
      "$instance": {
        "datetime": [
          {
            "endIndex": 12,
            "startIndex": 0,
            "text": "this weekend",
            "type": "builtin.datetimeV2.daterange"
          }
        ]
      },
      "datetime": [
        {
          "timex": [
            "2020-W02-WE"
          ],
          "type": "daterange"
        }
      ]
    },
    "intents": {
      "None": {
        "score": 0.8771556
      }
    },
    "text": "this weekend"
  }
}
// 2020-W01-WE - This should resolve to weekend; doesn't work locally, works on Luis. 
Resolution resolution = 
  TimexResolver.Resolve(((List<string>)options.Entities.datetime[0].Expressions).ToArray());

var start = resolution.Values?[0].Start; // 01/06/2020
var end = resolution.Values?[0].End;     // 01/13/2020

关于我做错了什么以及如何解决它有什么想法吗?

【问题讨论】:

    标签: microsoft-cognitive azure-language-understanding timex


    【解决方案1】:

    你是对的,这看起来肯定可以工作。我认为这是 TimexResolver 中的一个错误,所以我编写了一个单元测试并提交了一个 PR 给团队 - 你可以看到它 here(讽刺的是它是 PR “2020”)。

    如果您非常迫切需要此修复,您可以将 my copy of TimexResolver 拉入您自己的项目中,并在我们等待 PR 审核并希望被接受时重命名它(例如 TimexResolve2)。

    [更新] PR 已经被接受并合并到 master 中(这很快!)。你可以看到它here - 现在我们只需要等待识别器文本的下一个版本,或者现在只需在本地下载/克隆项目,关注 GH 上的版本

    【讨论】:

      猜你喜欢
      • 2020-02-05
      • 1970-01-01
      • 2021-06-29
      • 2014-01-29
      • 2022-06-16
      • 2018-10-28
      • 1970-01-01
      • 2013-03-27
      • 1970-01-01
      相关资源
      最近更新 更多