Chatterbot not working properly
See original GitHub issueHi,
I’m trying to create a chatterbot using flask. I got it but unfortunately I face few issues.
- 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
- 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:
- Created 5 years ago
- Comments:17 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@FathimaFirdhouse glad to hear your problem was resolved.
@swathy06 This might give an idea https://chatterbot.readthedocs.io/en/stable/conversations.html#statement-response-relationship
an example https://github.com/gunthercox/chatterbot-corpus/blob/master/chatterbot_corpus/data/english/greetings.yml