Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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 chatterbot数学求值次数和负数不起作用_Python_Chatterbot - Fatal编程技术网

Python chatterbot数学求值次数和负数不起作用

Python chatterbot数学求值次数和负数不起作用,python,chatterbot,Python,Chatterbot,我正在使用python上的chatterbot库制作一个聊天机器人,我正在使用数学求值逻辑适配器。当我使用聊天机器人时,可以使用加法和除法功能,但不能使用乘法和减法。任何修复都将不胜感激 from chatterbot import ChatBot from chatterbot.trainers import ListTrainer from chatterbot.trainers import ChatterBotCorpusTrainer import chatterbot_corpus

我正在使用python上的chatterbot库制作一个聊天机器人,我正在使用数学求值逻辑适配器。当我使用聊天机器人时,可以使用加法和除法功能,但不能使用乘法和减法。任何修复都将不胜感激

from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
import chatterbot_corpus

bot = ChatBot(
    'IKO',  
    logic_adapters=[
        'chatterbot.logic.BestMatch',
        'chatterbot.logic.TimeLogicAdapter',
        'chatterbot.logic.MathematicalEvaluation'],
    storage_adapter='chatterbot.storage.SQLStorageAdapter',
    database_uri='sqlite:///databasea.sqlite3'
)

list_trainer = ListTrainer(bot)
list_trainer = ListTrainer(bot)
corpus_trainer = ChatterBotCorpusTrainer(bot)

corpus_trainer.train(
    "chatterbot.corpus.english.greetings",
    "chatterbot.corpus.english.ai"
)

list_trainer.train([
    "what is your name",
    "my name is IKO",
    "is your name IKO",
    "yes"
])

list_trainer.train([
    "turn on the light",
    "ok turning the light on"
])

name = input("Enter Your Name: ")
print("Welcome to the Bot Service! Let me know how can I help you?")
while True:
    request=input(name+':')
    if request=='Bye' or request =='bye':
        print('Bot: Bye')
        break
    elif "turn" in request and "on" in request and "light" in request:
        sig = "light on"
        print(sig)
    else:
        response=bot.get_response(request)
        print('Bot:',response)
    

你收到错误信息了吗?始终将完整的错误消息(从单词“Traceback”开始)作为文本(不是屏幕截图,也不是指向外部门户的链接)进行讨论(不是评论)。还有其他有用的信息。对不起,当我做乘法和减法运算时,它只输出“当前时间是…”你应该显示你在bot中写的文本-并对其提出质疑,而不是评论-更多的人会看到它,更多的人可能会帮助你。也许你的文字比数学更符合时间——有些国家在日期上使用
/
,例如
2021/04/19
。也许您应该检查适配器的文档,也许您必须使用一些选项来更改它。