使用聊天机器人的BestMatchAdapter,它混淆了两个问题和相同的答案。例如,培训ai.yml。
艾是什么? 人工智能是工程学和科学的分支,致力于制造思考的机器。 什么是笑话? 人工智能是工程学和科学的分支,致力于制造思考的机器。
另一方面,以下类似的问题在机器人回答中很有意义:
你能弯腰吗? 不,我可以无限期地延续下去。 你会撒谎吗? 不,我可以无限期地延续下去。
发布于 2017-08-29 12:39:47
@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使用的默认语句比较算法是距离
在您的示例中,场景如下所示
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.
,我认为您尝试了您的bot,ai conversations
,其他您可能会得到准确的结果。
但是,通过使用将置信度设置为0.90,您可以获得更多的粒度结果。
同样的答案也适用于第二个问题。让我知道你对这个问题的建议/改进。
发布于 2017-08-29 13:45:55
这一调整让它发挥作用@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.'
},
],
https://stackoverflow.com/questions/45910997
复制相似问题