首页 > 解决方案 > 如何为 python chatterbot 创建一个训练数据,以便它可以使用 ListTrainer 理解数值

问题描述

我正在寻找一种在一些数字数据上训练 Python Chaterbot ( https://chatterbot.readthedocs.io/en/stable/# ) 的方法,以便它可以使用 ListTrainer 理解用户输入。

例如:机器人:你需要多少张票?用户:500 机器人:这是一个巨大的数字。抱歉,我无法处理。

在上面的场景中,我可以创建一个对话让机器人明白 500 是一个大数字。但是,如果 510、600 或任何数字,机器人是否有办法根据规则做出自定义决策并回复用户。

任何建议都会有所帮助。

标签: pythontraining-datachatterbot

解决方案


If I understand the question correctly the problem is that you want the chatbot to estimates when a number is big or small and gives a specific response. For me, the best option is to find the number in the string, modify it to integer and then compare it with the given variable. Chatterbot can manage mathematical evaluation if you use the MathematicalEvaluation logic adapter instead of BestMatch. I don't think there is an embedded way in the library to give a combined text with strings and numbers and let the chatbot do the trick


推荐阅读