BestMatchAdapter用相同的回答混淆了两个不同的问题

2024-09-30 22:10:14 发布

您现在位置:Python中文网/ 问答频道 /正文

使用Chatterbot的BestMatchAdapter,它混淆了两个问题的答案相同。例如,培训伊迈尔. 在

What is ai?

Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.

What is a joke?

Artificial Intelligence is the branch of engineering and science devoted to constructing machines that think.

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

Can you bend?

No I can be perpetuated indefinitely.

Can you lie?

No I can be perpetuated indefinitely.


Tags: andofthetobranchthatiswhat
2条回答

@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使用默认的语句比较算法是levenshtein_distance

在您的示例中,场景如下所示

^{pr2}$

在这个例子中,置信度是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否则你会得到准确的结果。在

但是,您可以通过使用low-confidence-response-adapter将confidence设置为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.'
                },

        ],

相关问题 更多 >