【发布时间】:2018-11-15 00:57:51
【问题描述】:
以下是我调用 LUIS api 端点时的 JSON。
{
"query": "How do I install citrix?",
"topScoringIntent": {
"intent": "Setup Instructions",
"score": 0.9999997
},
"intents": [
{
"intent": "Setup Instructions",
"score": 0.9999997
},
{
"intent": "OS Availability",
"score": 0.0000021111066
},
{
"intent": "Service Guide",
"score": 8.18181149e-7
},
{
"intent": "Service Description",
"score": 5.55555232e-7
},
{
"intent": "None",
"score": 9e-9
},
{
"intent": "Greeting",
"score": 1.41666667e-9
},
{
"intent": "Compassion",
"score": 8.1e-10
},
{
"intent": "Images",
"score": 8.1e-10
}
],
"entities": [
{
"entity": "citrix",
"type": "Service",
"startIndex": 17,
"endIndex": 22,
"resolution": {
"values": [
"Citrix Receiver"
]
},
"role": ""
}
],
"sentimentAnalysis": {
"label": "positive",
"score": 0.7695234
}
}
我正在尝试从下面获取字符串“Citrix Receiver”。
下面是我的代码
LuisResult result
var strEntity = result.Entities[0].Resolution.Values[0]
但我无法将索引应用于ICollection<object> 类型的表达式。看起来resolution 似乎被定义为字典,并且在研究后,我看到其他带有resolution 的JSON 主体具有多个键值对。是否有可能主体已更改但 MS Bot Builder 框架中的 Luis 扩展没有?
谢谢。
【问题讨论】:
-
为了解决同样的问题:从
"resolution": { "values": ["xxxxxxxxx"]}中提取数据,我使用的是var resval = result.Entities[0].Resolution.Values.Select(s => ((List)s)[0]).FirstOrDefault();
标签: c# .net botframework bots azure-language-understanding