使用Chatterbot的BestMatchAdapter,它將兩個問題用相同的答案混淆。例如,培訓ai.yml。BestMatchAdapter以相同的響應混淆了兩個不同的問題
什麼是ai?
人工智能是工程和科學的一個分支,致力於構建思維機器。
什麼是笑話?
人工智能是工程和科學的一個分支,致力於構建思維機器。
在otherhand,以下類似的問題沒什麼意義的BOT答案:
可以彎曲?
不,我可以無限期地延續下去。
你能說謊嗎?
不,我可以無限期地延續下去。
使用Chatterbot的BestMatchAdapter,它將兩個問題用相同的答案混淆。例如,培訓ai.yml。BestMatchAdapter以相同的響應混淆了兩個不同的問題
什麼是ai?
人工智能是工程和科學的一個分支,致力於構建思維機器。
什麼是笑話?
人工智能是工程和科學的一個分支,致力於構建思維機器。
在otherhand,以下類似的問題沒什麼意義的BOT答案:
可以彎曲?
不,我可以無限期地延續下去。
你能說謊嗎?
不,我可以無限期地延續下去。
@taiwotman我不知道你已經訓練語料文件。簡而言之,最佳匹配算法就是這樣工作的,Bot會迭代你已經訓練過的所有語句。
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.
我想你對這種情況感到困惑。 chatterbot default threshold values is 65%
。在所有對有更大信心的聲明中,那麼它將成爲迴應。
confidence = self.compare_statements('What is ai?', 'What is a joke?')
在這個信心是0.77是大於0.65,您將得到回答Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.
我想你想你的機器人ai conversations
其它你可能會得到準確的結果。
但是你可以得到通過使用low-confidence-response-adapter設置信心0.90更細化的結果。
同樣的答案也適用於第二個問題。讓我知道你對這個問題的建議/改進
這個調整使得它的工作@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.'
},
],
感謝您的詳細回覆。我使用ai.yml文件進行了培訓。請允許我研究這個算法,並在48小時內回覆。你所說的是關於[levenshtein_distance]的權重計算(https://github.com/gunthercox/ChatterBot/blob/master/chatterbot/comparisons.py#L35)。 –
'聊天機器人= { '名稱': '技術支持博特', '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':「我很抱歉,但我不明白。' }, ],' –