【发布时间】:2018-02-02 10:51:17
【问题描述】:
按照这个例子:
https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-quickstart-cs-add-utterance
我正在尝试向我的 LUIS 应用发送话语。 它继续失败并显示此响应消息:
{
"error": {
"code": "BadArgument",
"message": "Failed to parse example labeling objects. Parameter name: exampleLabelObjects"
}
}
我的输入正文是:
{
"text": "hi, what can I help you with?",
"intentName": "Help",
"entityLabels": []
}
如果您发送的话语没有任何实体标签,那么根据链接也是正确的。
entityLabels 字段是必需的。如果您不想标记任何 实体,请提供一个空列表,如下例所示:
[
{
"text": "go to Seattle",
"intentName": "BookFlight",
"entityLabels": [
{
"entityName": "Location::LocationTo",
"startCharIndex": 6,
"endCharIndex": 12
}
]
},
{
"text": "book a flight",
"intentName": "BookFlight",
"entityLabels": []
}
]
构建对象的C#如下:
public class LUISUtterItem
{
public string utterances;
public string text;
public string intentName;
public List<exampleLabelObjects> entityLabels;
}
public class exampleLabelObjects
{
public string entityName;
public int startCharIndex;
public int endCharIndex;
}
我称之为:
LUISUtterItem itm = new LUISUtterItem();
//itm.utterances = materialArray[1];
itm.text = materialArray[1];
itm.intentName = materialArray[2];
itm.entityLabels = new List<exampleLabelObjects>();
我也尝试过不包含“entityLabels”对象,以及刚刚以相同结果启动的字符串列表。
我们将不胜感激。
【问题讨论】:
标签: c# json azure-language-understanding