【发布时间】:2017-03-23 16:37:22
【问题描述】:
我正在学习使用 LUIS 的 Microsoft Bot Framework。我正在尝试制作一个能够理解数学短语的简单数学机器人。当用户键入“什么是二加三”或类似内容时,LUIS 了解该人想要将二加三相加。结果是一个 LuisResult,如下所示:
{
"query": "what is one plus three",
"topScoringIntent": {
"intent": "addition",
"score": 0.999997139
},
"intents": [
{
"intent": "addition",
"score": 0.999997139
},
{
"intent": "None",
"score": 0.03979478
}
],
"entities": [
{
"entity": "one",
"type": "builtin.number",
"startIndex": 8,
"endIndex": 10,
"resolution": {
"value": "1"
}
},
{
"entity": "three",
"type": "builtin.number",
"startIndex": 17,
"endIndex": 21,
"resolution": {
"value": "3"
}
}
]
}
我需要从实体列表中提取两个“值”字段。目前我只知道如何通过做来提取第一个实体“一个”
string numberResult = "";
EntityRecommendation rec;
if(result.TryFindEntity("builtin.number", out rec))
{
numberResult = rec.Entity;
this.number = Int32.Parse(numberResult);
}
有什么方法可以从中提取值字段“1”和“3”?
【问题讨论】:
标签: c# json botframework azure-language-understanding