question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chatterbot not working properly

See original GitHub issue

Hi,

I’m trying to create a chatterbot using flask. I got it but unfortunately I face few issues.

  1. I have 10 YML files, If I ask a question, the chatterbot is getting the answer from some other file and not where it should fetch, basically not answering properly
  2. Secondly when I run the chatterbot for the second time, the first time question that I asked which chatterbot could not reply for the first time is stored and it is asking me back when I ask a known question.

I used the following code:

from flask import Flask, render_template, request
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.response_selection import get_first_response
from chatterbot.comparisons import levenshtein_distance
import os

app = Flask(__name__)

english_bot = ChatBot("Chatterbot", storage_adapter="chatterbot.storage.SQLStorageAdapter",
                        preprocessors=['chatterbot.preprocessors.clean_whitespace'],
				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.65,
            'default_response': 'I am sorry, but I do not understand.'
        } 
    ],
    trainer='chatterbot.trainers.ListTrainer'
)

english_bot.set_trainer(ListTrainer)

for files in os.listdir('../mytraining/'):
		data = open('../mytraining/' + files, 'r').readlines()
		english_bot.train(data)

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

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


if __name__ == "__main__":
    app.run()
Please help me as early as possible 
![not_working](https://user-images.githubusercontent.com/39655998/40579319-774fa1fa-6142-11e8-8bd3-d066c7a4f830.JPG)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Error while installing chatterBot - Stack Overflow
I tried to install in admin mode, I got this error (C:\Anaconda2) C:\Users\Admin\Desktop\ChatterBot-master>python setup.py install Download ...
Read more >
Installation — ChatterBot 1.0.8 documentation - Read the Docs
The recommended method for installing ChatterBot is by using pip. ... To install ChatterBot from PyPi using pip run the following command in...
Read more >
Chatterbot installation error resolved - YouTube
ChatterBot is a Python library that makes it easy to generate automated ... Installing Chatterbot | Chatterbot installation error resolved.
Read more >
Chat bot using Python - Error Trouble Shooting - YouTube
Chat bot using Python - Error Trouble Shooting ... This video trouble shoots the errors "Set_trainer" due to the Chatterbot Package upgrade.
Read more >
5 Typical Chatbot Fails + Prevention Tips - Userlike
“Sorry, I don't understand.” “Oops, didn't quite get that.” “Beep boop, can't compute. Try again?” If you've never received a chatbot error ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found