Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python BestMatchAdapter将两个不同的问题与相同的回答混淆_Python_Chatterbot - Fatal编程技术网

Python BestMatchAdapter将两个不同的问题与相同的回答混淆

Python BestMatchAdapter将两个不同的问题与相同的回答混淆,python,chatterbot,Python,Chatterbot,使用Chatterbot的BestMatchAdapter,它将两个答案相同的问题混淆。例如,培训ai.yml 什么是人工智能 人工智能是工程学和科学的一个分支,致力于构造能够思考的机器 什么是笑话 人工智能是工程学和科学的一个分支,致力于构造能够思考的机器 另一方面,以下类似问题在机器人回答中很有意义: 你会弯腰吗 不,我可以无限期地延续下去 你会撒谎吗 不,我可以无限期地延续下去 @我不知道你训练过的语料库文件。简而言之,最佳匹配算法是这样工作的,Bot将迭代您训练Bot的所有语句 clos

使用Chatterbot的BestMatchAdapter,它将两个答案相同的问题混淆。例如,培训ai.yml

什么是人工智能

人工智能是工程学和科学的一个分支,致力于构造能够思考的机器

什么是笑话

人工智能是工程学和科学的一个分支,致力于构造能够思考的机器

另一方面,以下类似问题在机器人回答中很有意义:

你会弯腰吗

不,我可以无限期地延续下去

你会撒谎吗

不,我可以无限期地延续下去


@我不知道你训练过的语料库文件。简而言之,最佳匹配算法是这样工作的,Bot将迭代您训练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,您将得到答案
人工智能是工程和科学的一个分支,致力于构建思考机器。

我想你被这个案子弄糊涂了。chatterbot
默认阈值为65%
。在所有具有更大信心的陈述中,它将成为回应

confidence = self.compare_statements('What is ai?',  'What is a joke?')
在此情况下,置信度为0.77,大于0.65,您将得到答案
人工智能是工程和科学的一个分支,致力于构建思考机器。
我认为您尝试了机器人
人工智能对话
否则您可能会得到准确的结果

但是,通过使用将置信度设置为0.90,可以获得更精细的结果


同样的答案也适用于第二个问题。让我知道你对这个问题的建议/改进

@taiwotman我不知道你训练过的语料库文件。简而言之,最佳匹配算法是这样工作的,Bot将迭代您训练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,您将得到答案
人工智能是工程和科学的一个分支,致力于构建思考机器。

我想你被这个案子弄糊涂了。chatterbot
默认阈值为65%
。在所有具有更大信心的陈述中,它将成为回应

confidence = self.compare_statements('What is ai?',  'What is a joke?')
在此情况下,置信度为0.77,大于0.65,您将得到答案
人工智能是工程和科学的一个分支,致力于构建思考机器。
我认为您尝试了机器人
人工智能对话
否则您可能会得到准确的结果

但是,通过使用将置信度设置为0.90,可以获得更精细的结果


同样的答案也适用于第二个问题。让我知道你对这个问题的建议/改进

这项调整在Mallikarjunarao Kosuri(非常感谢你的建议)起到了作用


这一调整在Mallikarjunarao Kosuri(非常感谢你的建议)起作用


谢谢你的详细回复。我用ai.yml文件进行了培训。请允许我学习这个算法,并在48小时内返回。您所谈论的是相对于.
CHATTERBOT={'name':'Tech Support Bot','logic_adapters':[{“import_path”:“CHATTERBOT.logic.BestMatch”,“statement_comparison_函数”:“CHATTERBOT.comparison.levenshtein_distance”,“response_selection_method”:“chatterbot.response\u selection.get\u first\u response”},{'import\u path':'chatterbot.logic.LowConfidenceAdapter','threshold':0.90,'default\u response':'很抱歉,但我不明白。},],
感谢您的详细回复。我使用ai.yml文件进行了培训。请允许我学习此算法并在48小时内返回。您所谈论的是相对于的权重计算。
CHATTERBOT={'name':'Tech Support Bot','logic_adapters':[{“import_path”:”chatterbot.logic.BestMatch,“语句比较函数”:“chatterbot.comparison.levenshtein\u距离”,“响应选择方法”:“chatterbot.response\u selection.get\u first\u response”},{'import_path':'chatterbot.logic.LowConfidenceAdapter','threshold':0.90,'default_response':'很抱歉,但我不明白。},],