According to Forbes, about 60% of the millennium has been spent chatbots, and more than 70 percent of them had a positive experience. In addition, Accenture reported that 57% of their executives surveyed noticed it chatbots there was a huge return on investment with minimal effort. Finally, chat robots have tremendous potential for scale and personal experience.
What made me think, to expand my knowledge in the field of artificial intelligence and chat robots, what problems can I solve with the power of technology?
See, mental health awareness chatbot.
Before we start the technical specification of chatbot, I actually want to give some mental health context.
First, mental disorders and problems affect those assessed 792 million people global.
It is basically one of the top ten people worldwide.
In Canada, where I come from, the problem is even worse, with one in five Canadians experiencing a mental health or addiction problem each year, and one in two experiencing one by the time he or she reaches the age of 40.
70% of mental health problems have also started in childhood or adolescence, and young people experience other age groups the most. The reason this is such a big problem is that mental health can reduce life expectancy by 10 to 20 years.
In Canada alone, the negative economic impact is estimated at about $ 51 billion per year due to “health care costs, lost productivity, and declining health-related quality of life.” 
At the end of the day, based on my analysis and research, some of the root causes of the existing problems can be considered to be related to:
- lack of access to services (lack of funding, lack of availability / lack of inadequate care)
- a mental health stamp that makes it impossible to express concerns and prevents people from getting the help they need
- lack of systems for those in need of support and assistance
In my project, I decided to address the last 2 of the 3 root causes and try to develop a solution to fill the gaps.
That’s how I did it.
👋 Step 0: Preparation and learning resources
Because I was just building chatbots, to start myself, I got to know a few key resources:
These were absolutely golden and very useful along the way.
Once I had properly understood the theoretical perspectives, I began to divide the project into a few key steps, which are broken down in detail below.
Phase 1: Transforming discussion purposes and definitions into a Pytorch model
Step 2: Building a chatbot framework for processing a response
Step 3: Creating a graphical user interface
Once the theoretical understanding was in place, I started by opening the Visual Studio Code and creating a few kernel files that I knew I needed.
- app.py (graphical user interface)
- chat.py (for building a chatbot frame)
- intents.json (helps the computer understand the purposes)
- model.py (a few lines of code integrating in-depth learning components)
- nltk_utils.py (for handling natural language with nltk and other libraries)
- train.py (for the program itself!)
If you want to check the code, the entire archive can be found on Github by following this link!
🚇 Step 1: The purpose and definitions of the discussion are converted to a Pytorch model
The chatbot framework requires structures in which chat modes are defined. A simple and clean way to go about this is to use a JSON file:
Each purpose includes:
- tag (label / name of your choice)
- patterns (sentence characters for neural network classifier)
- answers (the answer you want the machine to give when it is ready)
Now that we have processed all the conversations through the intents.json file, we can move on to the next step where we will deal with the initial preprocessing of NLP.
The first thing is to bring the essential.
Once done, the next task is to organize the documents, words, and classification categories.
Throughout the process, I created a list of sentences that can then be further broken down into a list arm words, and each sentence is related to a purpose (category).
Once the natural language processing was taken care of, I followed the curriculum and continued to build in-depth learning with Pytorch. For more information on Pytorch’s operations and the Deep Learning concepts it can apply, see this series of articles.
Once the model was built, I continued the tutorial to continue and build the training code as shown below.
The purpose of the code below is to download the intents.json file, apply the natural language processing code, create the exercise data, and begin model training.
Now that the hard part is done, we move on to the next partition where I break down the chatbot response frame.
🏗 Step 2: Create a chatbot frame to process the response
The next step is to build a chatbot frame using the code below:
Based on the tutorial and other resources I used, I built the code and wrote my model in a way that solved the classification problem to collect the intention from the user’s intention through classification (the identifier to which the expression belongs and thus selects the answer from it).
💻 Step 3: Create a graphical user interface
As a final bonus, the last part of the puzzle included creating a quick graphical user interface with Python and Tkinter, combining code into a place that the user can click directly to open.
While this was one of my first natural language processing projects, this was definitely a blast! I was able to play with my new virtual friend Aura a few times, and I definitely want to build on this, hopefully turning this into a real startup to address the huge gaps in mental health.
Finally, I wanted to end a few quick cries Darien Schettler, Victor Sami, winner falleiros, Bryan Horowitzand Afshin nensi, who were all very helpful throughout the process, giving feedback on my work and / or sharing some of their thoughts on the mental chatbot.
The whole video is coming really soon, so keep your eyes out for it!