0

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

什么是艾?

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

什么是笑话?

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

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

你能弯曲吗?

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

你会说谎吗?

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

4

2 回答 2

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,否则您可能会得到准确的结果。

但是,您可以通过使用low-confidence-response-adapter将置信度设置为0.90来获得更精细的结果。

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

于 2017-08-29T12:39:47.313 回答
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.'
                },

        ],
于 2017-08-29T13:45:55.143 回答