无法从 Microsoft.Bot.Builder.Luis.Models 检索实体解析
Unable to retrieve entity resolution from Microsoft.Bot.Builder.Luis.Models
下午好。
我已经训练了一个 LUIS 应用程序来识别同义词列表中的特定名称(实体类型:列表)。
例如,["ada", "aDa", "lovelace"]
的规范化值为 "Ada Lovelace"
.
我正在使用 Enterprisebot demo 作为我的应用程序的起点,它非常有用。问题是,我无法从查询中检索规范化值(又名其分辨率之一)。
API 很好。问题是 Microsoft.Bot.Builder.Luis 包将分辨率放在 IDictionary < string, object >
结构中。
例如,API 正确识别了以下实体:
"entities": [
{
"entity": "lovelace",
"type": "Sala",
"startIndex": 16,
"endIndex": 23,
"resolution": {
"values": [
"Ada Lovelace"
]
}
}
]
但是当我尝试访问它的分辨率时,我无法从 IDictionary 对中读取值字段。
Console.Write( enttt.Entity );
// "lovelace"
Console.Write( enttt.Type );
// "Sala"
Console.Write( enttt.Resolution );
// System.Collections.Generic.Dictionary`2[System.String,System.Object]
Console.Write( enttt.Resolution.First() );
// [values, System.Collections.Generic.List`1[System.Object]]
Console.Write( enttt.Resolution.First().Key );
// "values"
Console.Write( enttt.Resolution.First().Value );
// System.Collections.Generic.List`1[System.Object]
Console.Write( enttt.Resolution.First().Value.toString() );
// System.Collections.Generic.List`1[System.Object]
Console.Write( enttt.Resolution.First().Value.First() );
// object does not contain a definition for 'First'
我也试过 enttt.Resolution.Values.First()
,但结果相同。
如何访问第一个 "value",以便检索规范化值 "Ada Lovelace"
?
据我所知,没有 string IDictionary.Get(string key)
方法,或者有吗?
使用以下内容:
var normalizedValue = result.Entities[0].Resolution.Values.Select(s => ((List<object>)s)[0]).FirstOrDefault();
下午好。
我已经训练了一个 LUIS 应用程序来识别同义词列表中的特定名称(实体类型:列表)。
例如,["ada", "aDa", "lovelace"]
的规范化值为 "Ada Lovelace"
.
我正在使用 Enterprisebot demo 作为我的应用程序的起点,它非常有用。问题是,我无法从查询中检索规范化值(又名其分辨率之一)。
API 很好。问题是 Microsoft.Bot.Builder.Luis 包将分辨率放在 IDictionary < string, object >
结构中。
例如,API 正确识别了以下实体:
"entities": [
{
"entity": "lovelace",
"type": "Sala",
"startIndex": 16,
"endIndex": 23,
"resolution": {
"values": [
"Ada Lovelace"
]
}
}
]
但是当我尝试访问它的分辨率时,我无法从 IDictionary 对中读取值字段。
Console.Write( enttt.Entity );
// "lovelace"
Console.Write( enttt.Type );
// "Sala"
Console.Write( enttt.Resolution );
// System.Collections.Generic.Dictionary`2[System.String,System.Object]
Console.Write( enttt.Resolution.First() );
// [values, System.Collections.Generic.List`1[System.Object]]
Console.Write( enttt.Resolution.First().Key );
// "values"
Console.Write( enttt.Resolution.First().Value );
// System.Collections.Generic.List`1[System.Object]
Console.Write( enttt.Resolution.First().Value.toString() );
// System.Collections.Generic.List`1[System.Object]
Console.Write( enttt.Resolution.First().Value.First() );
// object does not contain a definition for 'First'
我也试过 enttt.Resolution.Values.First()
,但结果相同。
如何访问第一个 "value",以便检索规范化值 "Ada Lovelace"
?
据我所知,没有 string IDictionary.Get(string key)
方法,或者有吗?
使用以下内容:
var normalizedValue = result.Entities[0].Resolution.Values.Select(s => ((List<object>)s)[0]).FirstOrDefault();