使用Chatterbot的BestMatchAdapter,它会将两个问题混淆为相同的答案。例如,训练ai.yml。
什么是ai?
人工智能是工程和科学的一个分支,致力于构建思考的机器。
什么是笑话?
人工智能是工程和科学的一个分支,致力于构建思考的机器。
另一方面,以下类似的问题在机器人答案中非常有意义:
你能弯腰吗?
不,我可以无限期地永久存在。
你能说谎吗?不,我可以无限期地永久存在。
答案 0 :(得分:1)
@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
Chatterbot使用默认语句比较算法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.77,大于0.65 ,您将得到答案Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.
我认为您尝试过机器ai conversations
其他可能会得到准确的结果。< / p>
但是,通过使用low-confidence-response-adapter将置信度设置为 0.90 ,您可以获得更精细的结果。
同样的答案也适用于第二个问题。让我知道你对这个问题的建议/改进
答案 1 :(得分: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.'
},
],