2017-01-08 14 views
1

私はいくつかの物語しか持っていませんが、blahのようなものを試してみると、hello物語を使います。wit.aiで「私は控えめな」物語を作る方法

しかし、回答I don't understant*wildcardのようなものが必要です。 witbotintencesで簡単 、私はノード・ウィットに作る方法を知りません。

答えて

2

私は同様の問題がありました。次のステップの信頼度があらかじめ定義されたしきい値より低い場合、特別なlowConfidenceメソッドを呼び出すwit.jsコードを微調整することに決めました。

// 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' ; 
+0

中:私のウィットアクションはファイルに

。 :) –

関連する問題