Chatbot: A Complete PyCharm App. Chatterbot, Django, Python and Pycharm… | by Jesko Rehberg | Feb, 2021
Chatterbot, Django, Python and Pycharm all unified in this ready to go Chatbot App
Are you looking for a completely ready to go chatbot, which you can easily adapt to your needs? Look no further, if you are willing to use Python, Pycharm, Django and Chatterbot all combined. Top of that, there is even a SQLite database added to this app, so you can analyze user’s input and Chatbot’s output.
This post focuses on how to get a FAQ chatbot up and running, without going into theoretical background of chatterbot, which will be the topic of another related post.
First of all please make sure you have PyCharm installed. If not, please do so now:
go to www.jetbrains.com and install the free community edition.
Afterwards, before starting a new project in PyCharm, please copy all files from my Google Drive folder: https://drive.google.com/drive/folders/1IXXJzNr8pbGFSIYpWj92fXnQX35eZOFT?usp=sharing
..and copy that into your PyCharm Projects folder (usually in your users folder):
Then open PyCharm and click on “New Project”:
Choose the ChatbotProject folder (which you have downloaded from my Google Cloud just before) as the location for your new virtual environment (virtualenv) project. Make also sure that the Python Interpreter is directed to Python 3.7:
After confirming you want to create from existing sources:
As a next step, add Configuration:
..and click on the plus symbol in the left top corner:
where these settings have to be entered:
1. How Chatbots and Email Marketing Integration Can Help Your Business
2. Why Chatbots could be the next big thing for SMEs
3. My Journey into Conversation Design
4. Practical NLP for language learning
From now on you can simply start Manage.py by clicking the Run button:
..and click on the localhost link which will be started after a few seconds:
In case there are now import errors popping up, similar to this:
..all you have to do is to go to settings and import the necessary packages in the Python Interpreter section:
Please make sure that Django 2.2 and Chatterbot 1.0.2. is installed. That will ensure to work well with Python 3.7 for our chatterbot:
If you now run “manage.py” again, you might receive this message the first time you want to start your chatbot:
In this case please go to your Terminal and enter:
python manage.py migrate
Now run manage.py again and your Chatbot should work in your browser:
You enter a question and our bot will hopefully give us the right answer:
You can enter a question and your chatbot will give you an answer to this question. The reason the chatbot might know the right answer is due to your chats.txt, which you can adapt here:
If you prefer yaml files instead of the chats.txt, you can also adapt any of these corpus files:
Please note that all of them are chatterbot modules, except the FAQ. That one has been created by myself, for learning purposes:
Chatterbot is an extremely interesting chatbot which uses machine learning techniques. Please have a look at the Chatterbot website if you are looking for more details behind chatterbot.
Anything more to add?
Everything is now working well. But wouldn’t it be cool to even add a database connectivity, so we can analyze chatbot’s output to that user’s input?
Therefore we have to go to settings again, but this time we will install in the Plugin sector. Search for Database Navigator and install that plugin:
Then enter a new DB Connection:
Choose SQLite and add db.sqlite3 as Database file:
Looking into the table “statement”, we can see all trained conversations, after we have run our Chatbot the first time after we have installed Database Navigator:
Congratulations, we have a complete chatbot running! We will discuss the chatterbot learning in detail in another post which is yet to come. For the time being, many thanks for reading, hope this was supportive! Any questions, please let me know. You can connect with me on LinkedIn or Twitter.
Originally published on my website DAR-Analytics.
Credit: Source link