3

I am making a chatbot using the chatterbot library on python, I am using the mathematical evaluation logic adapter. when I use the chat bot can use the addition and division functions but not the multiplication and subtraction. any fixes would be greatly appreciated.

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)
    
  • do you get error message or what? always put full error message (starting at word "Traceback") in question (not comment) as text (not screenshot, not link to external portal). There are other useful information. – furas Apr 18 '21 at 03:16
  • sorry, when I do the multiplication and subtraction it just outputs "the current time is..." – Jackson Pike Apr 19 '21 at 10:09
  • You should show what text you write in bot - and put it in question not comment - more people will see it and more people may help you. Maybe your text really better match to time then to math - some countries use `/` in dates - ie. `2021/04/19`. Maybe you should check documentation for adapters - maybe you have to use some options to change it. – furas Apr 19 '21 at 16:59

0 Answers0