我有一个为机器人技能创建的 Luis 模型。我正在使用预建datetime
实体作为日期。
当我在 Luis 门户的测试工具上给出诸如“本周末在 [行话] 卖 5k [行话]”之类的示例话语时,我得到了我期望的响应(如下所示)。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
关于我在解决问题上做错了什么的任何想法?