2

Hi I am reusing a code of chat bot which I found from internet in python. It basically uses 3 logic adapters. Mathematical, time and best match. Best match has a default response to respond to unknown queries which chat bot gets. But for some reason chat bot only responds "time" for any unknown queries. How can I make the chat bot respond the default response instead of time. Is it a bug with time adapter?

from chatterbot import *
from chatbot import chatbot
from flask import Flask, render_template, request
import sqlite3


import urllib.request

app = Flask(__name__)
app.static_folder = 'static'

@app.route("/")
def home():
return render_template("index.html")

@app.route("/get")
def get_bot_response():
userText = request.args.get('msg')
return str(chatbot.get_response(userText))

if __name__ == "__main__":
app.run()

#############################################

from chatterbot import *
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
import sqlite3

Creating ChatBot Instance

chatbot = ChatBot(
'CareBot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',

   logic_adapters=[
   'chatterbot.logic.MathematicalEvaluation',
    'chatterbot.logic.BestMatch',
    'chatterbot.logic.TimeLogicAdapter',
    {
        'import_path': 'chatterbot.logic.BestMatch',
        'default_response': 'I am sorry, but I do not understand. I am still learning.',
         'maximum_similarity_threshold': 0.90
    }


],
database_uri='sqlite:///database.sqlite3'

)

Training with Personal Ques & Ans

training_data_simple = 
open('training_data/normal.txt').read().splitlines()
 training_data_personal = 
 open('training_data/all.txt').read().splitlines()

  training_data = training_data_simple + training_data_personal

  trainer = ListTrainer(chatbot)
  trainer.train(training_data)

Training with English Corpus Data

 trainer_corpus = ChatterBotCorpusTrainer(chatbot)

0 Answers0