如何在 wit.ai 中制作 'i dont understant' 个故事
how to make 'i dont understant' story in wit.ai
我的故事很少,但如果我尝试输入类似 blah
的内容,wit.ai 使用 hello
故事。
但我需要类似 *wildcard
回复 I don't understant
的故事。
使用 witbot 和 intences 很容易,但我不知道如何在 node-wit 和故事.
我遇到了类似的问题并决定调整 wit.js 代码以在下一步的置信度低于我设置的预定义阈值时调用特殊的 lowConfidence 方法。
在我的机智操作文件中:
// Setting up our wit client
const witClient = new Wit({
accessToken: WIT_TOKEN,
actions: witActions,
lowConfidenceThreshold: LOW_CONFIDENCE_THRESHOLD,
logger: new log.Logger(log.DEBUG)
});
以后
lowConfidence({context}) {
console.log("lowConfidenceConversationResponse");
return new Promise(function(resolve) {
context.lowConfidence=true;
context.done=true;
// now create a low_confidence story in wit.ai
// and have the bot response triggered always
// when context.lowConfidence is set
return resolve(context);
});
}
并且在wit.js
else if (json.type === 'action') {
let action = json.action;
// json.confidence is confidence of next step and NOT
// wit.ai intent identification confidence
const confidence = json.entities && json.entities.intent &&
Array.isArray(json.entities.intent) &&
json.entities.intent.length > 0 &&
json.entities.intent[0].confidence;
if ( confidence && confidence<lowConfidenceThreshold)
action = 'lowConfidence' ;
我的故事很少,但如果我尝试输入类似 blah
的内容,wit.ai 使用 hello
故事。
但我需要类似 *wildcard
回复 I don't understant
的故事。
使用 witbot 和 intences 很容易,但我不知道如何在 node-wit 和故事.
我遇到了类似的问题并决定调整 wit.js 代码以在下一步的置信度低于我设置的预定义阈值时调用特殊的 lowConfidence 方法。
在我的机智操作文件中:
// Setting up our wit client
const witClient = new Wit({
accessToken: WIT_TOKEN,
actions: witActions,
lowConfidenceThreshold: LOW_CONFIDENCE_THRESHOLD,
logger: new log.Logger(log.DEBUG)
});
以后
lowConfidence({context}) {
console.log("lowConfidenceConversationResponse");
return new Promise(function(resolve) {
context.lowConfidence=true;
context.done=true;
// now create a low_confidence story in wit.ai
// and have the bot response triggered always
// when context.lowConfidence is set
return resolve(context);
});
}
并且在wit.js
else if (json.type === 'action') {
let action = json.action;
// json.confidence is confidence of next step and NOT
// wit.ai intent identification confidence
const confidence = json.entities && json.entities.intent &&
Array.isArray(json.entities.intent) &&
json.entities.intent.length > 0 &&
json.entities.intent[0].confidence;
if ( confidence && confidence<lowConfidenceThreshold)
action = 'lowConfidence' ;