使用微信小程序插件chatbot进行文本或者句子的相似度计算,返回的结果是空的
// app.json
"plugins": {
"WechatSI": {
"version": "0.3.3",
"provider": "wx069ba97219f66d99"
},
"chatbot": {
"version": "1.1.15",
"provider": "wx8c631f7e9f2465e1"
}
}
// app.js
var chatbot = requirePlugin("chatbot");
App({
onLaunch: function () {
chatbot.init({
appid: "P5Ot9PHJDechCYqDFAW1AiK6OtG3Ja",
openid: "oev0I0bmB5lnoKzW_4KUXIvrQWe8",
success: res => {
console.log("init successs", res);
},
fail: error => {
console.log("init fail", error);
}
});
var text = "今天天气怎么样";
// 文档连接 https://developers.weixin.qq.com/doc/aispeech/nlpapi/sentencesim.html
chatbot.api.sentenceSim("你是谁", "你睡睡")
.then(res => {
console.log("sentenceSim result:", res)
});
//文档连接 https://developers.weixin.qq.com/doc/aispeech/miniprogram/rank.html
chatbot.api.nlp("rank", {
q: text,
candidates: [{
question: "今天天气很不错"
},
{
question: "明天天气怎么样"
}
]
}).then(res => console.log("rank result:", res));
// 词法分析 该功能正常,就是文本或者句子相识度计算没有返回值
chatbot.api.nlp("tokenize", {
q: text
}).then(res => {
console.log("tokenize result : ", res)
});
}
})
查看log输出只有词法分析有结果
请问这是什么原因呢?