我使用LUIS了解微软的Bot框架。我试图制作一个能理解数学短语的简单数学机器人。当用户键入"什么是2加3"或类似的东西,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"从这个?