2017-08-28 9 views
0

ChatterbotのBestMatchAdapterを使用すると、同じ答えで2つの質問が混乱します。例えば、ai.ymlを訓練する。BestMatchAdapterは同じ応答で2つの異なる質問を混同します

aiとは

人工知能は、考える機械を構築するための工学と科学の枝である。

冗談とは何ですか?

人工知能は、考える機械を構築するための工学と科学の枝である。 otherhandで

、以下同様の質問がボットの答えにあまり意味を成さ:

あなたは曲げることができますか?

私は無期限に永続化することはできません。

あなたは嘘をつきますか?

私は無期限に永続化することはできません。

答えて

1

@taiwotman私はあなたが訓練したコーパスファイルを知らない。要するに、ベストマッチアルゴリズムはこのように動作します。ボットは、ボットを訓練したすべてのステートメントを繰り返します。

closest_match.confidence = 0 

# Find the closest matching known statement 
for statement in statement_list: 
    confidence = self.compare_statements(input_statement, statement) 

    if confidence > closest_match.confidence: 
     statement.confidence = confidence 
     closest_match = statement 

会話ボットは、デフォルトの文の比較アルゴリズムを使用して、あなたの例ではlevenshtein_distance

で、シナリオはこの中で、この

confidence = self.compare_statements('What is ai?', 'what is ai') 

ように見える自信が1.0で、あなたは答えArtificial Intelligence is the branch of engineering and science devoted to constructing machines that think.を取得します

あなたはこのケースと混同していたと思います。チャッターボットdefault threshold values is 65%高い信頼度を持つすべての声明の中でそれは応答としてなります。この自信で

confidence = self.compare_statements('What is ai?', 'What is a joke?') 

を超える0.65で0.77であり、あなたが私はあなたがai conversations他のあなたが正確な結果を得ることができ、あなたのボットを試みたと思うArtificial Intelligence is the branch of engineering and science devoted to constructing machines that think.にお答えしてしまいます。

を使用して、信頼度を0.90に設定すると、より詳細な結果を得ることができます。

同じ答えが2番目の質問にも適用されます。

+0

ご返信ありがとうございました。私はai.ymlファイルを使ってトレーニングを行った。このアルゴリズムを勉強して、48時間以内に帰ることを許可してください。あなたが話しているのは、[levenshtein_distance](https://github.com/gunthercox/ChatterBot/blob/master/chatterbot/comparisons.py#L35)に対する重量計算です。 –

+0

'会話ボット= { '名称': 'テクニカルサポートボット' 'logic_adapters':[ { "import_path": "chatterbot.logic.BestMatch"、 "statement_comparison_function": "chatterbot.comparisons.levenshtein_distance"、 "response_selection_method": "chatterbot.response_selection.get_first_response" }、 { 'import_path': 'chatterbot.logic.LowConfidenceAdapter'、 'しきい値':0.90、 'default_responseの':「私は申し訳ありませんが、私理解していない。' }、 ]、 ' –

1

この調整は@Mallikarjunarao Kosuri(あなたの提案の多くのクレジット)を動作させるようにします。

CHATTERBOT = { 
     'name': 'Tech Support Bot', 
     'logic_adapters': [ 
      { 
       "import_path": "chatterbot.logic.BestMatch", 
       "statement_comparison_function": "chatterbot.comparisons.levenshtein_distance", 
       "response_selection_method": "chatterbot.response_selection.get_first_response" 
      }, 

       { 
        'import_path': 'chatterbot.logic.LowConfidenceAdapter', 
        'threshold': 0.90, 
        'default_response': 'I am sorry, but I do not understand.' 
       }, 

     ], 
関連する問題