【问题标题】:Is there a way to check the confidence of Wit.ai intent response?有没有办法检查 Wit.ai 意图响应的置信度?
【发布时间】:2020-08-26 16:16:39
【问题描述】:

我正在尝试在我的 HTML 页面中检查我的 API 响应的可信度。 如果置信度为 0 {转到此页面} 如果置信度为 1 {转到此页面} 我可以检查其他事情,但不能检查意图信心我该怎么做?

fetch(`https://api.wit.ai/message?q=${transcript}`,
{
    headers: {
        Authorization: `Bearer ${token}`,
        'Content-Type': 'application/json',
    },
}).then(res => res.json())
.then(function (data){
    if (data.intents[0].value==[0]) {
        console.log("intent 1")
        //throw "Error";
    }
    else if (data.text==="pay"){
        console.log("works")
    }
    else {
        if(data.intents==="checkout"){
            console.log("intent 2");
        }
    }
})

【问题讨论】:

    标签: html wit.ai


    【解决方案1】:

    intents 属性是一个对象数组。

    您可以通过以下方式访问置信度分数;

    data.intents[0].confidence
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-21
      • 1970-01-01
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 2015-07-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多