もっと細かい制御が必要な場合は、Wit APIを直接使用して、すべてを一緒にスキップすることができます。
function getIntent(message) {
var serviceResult = {};
var url = 'https://api.wit.ai/message?v=20161006&q='+message;
var options = {
uri: url,
qs: {},
method: 'POST',
headers: {},
auth: {'bearer': process.env.WIT_TOKEN},
json: true
};
request(options, function(error, response, body) {
if(!error) {
serviceResult.result = "success";
// Check for entities
if(body.entities.contact) {
serviceResult.entity = body.entities.contact[0].value;
serviceResult.entityConfidence = body.entities.contact[0].confidence;
}
// Check for intent
if(body.entities.intent) {
serviceResult.intent = body.entities.intent[0].value;
serviceResult.intentConfidence = body.entities.intent[0].confidence;
}
}
else {
serviceResult.result = "fail";
}
});
}
あなたのボットは、信頼値に基づいて何をしたいかを決めることができます。
@ SLee編集のおかげで –