Enhancing Student Talk Therapy : An Implmentation and Analysis of Natural Language Processing for Effective Mental Health Support

DOI : 10.17577/IJERTV12IS060152

Download Full-Text PDF Cite this Publication

Text Only Version

Enhancing Student Talk Therapy : An Implmentation and Analysis of Natural Language Processing for Effective Mental Health Support

Bhargav C N B Sumanth Reddy

Student, Dept. of CSE, Student, Dept. of CSE,

AMC College of Engineering, Bengaluru AMC College of Engineering, Bengaluru

Harshavardhan M S Annappa Swamy H

Student, Dept. of CSE, Student, Dept. of CSE,

AMC College of Engineering, Bengaluru AMC College of Engineering, Bengaluru

Abstract Education has a vital role in the in development and ability of students. It is important that students concentrate on their mental health. Talk Therapy is the initial stage of counseling where counselor talks with student to know him better for further counseling sessions. Talk Therapy is designed to facilitate student achievement, improve student behavior and help the student to overcome his/her problems.

The model described in the paper implements talk therapy for students using natural language processing. The model uses a set of tailored questions framed by expert counselors to conduct the session. The questions are categorized based on environment in day to day activities of the student like parent, teacher, etc.

The replies from student are considered by the system to frame the report which is sent to counselor and conclude the session by giving advice to the student. The Talk Therapy system proposed in the paper is designed to take up the session and counsel the student to get know about his daily activities and the environment in which he lives.

Keywords-Natural Language Processing; Talk Therapy; RASA Framework; Text-to-speech; Speech-to-text;



    Talk therapy, also known as psychotherapy, is based on the core idea that talking about the things that are bothering you can help clarify them and put them in perspective. Some talk therapists follow a specific school of thought, such as cognitive theory or behaviorism. Others use a more eclectic approach, drawing techniques and principles from several different theories.

    For specific illness, a mental health professional (like a psychologist or psychiatrist) may use a combination of

    cognitive and behavioral strategies that includes exposure to the feared object or situation in their treatment plan.

    Chances are you're familiar with talk therapy – maybe you or someone you know has gone to see a therapist to talk out issues, whether they're stress, anxiety, depression or relationship problems. Talk therapy, more formally called 'psychotherapy,' refers to a range of treatments that involve discussing mental or emotional issues with a mental health practitioner, such as a psychiatrist or psychologist. People who undergo this therapy talk through their emotions, moods, thoughts and behaviors, and they learn about their mental health conditions as well as how to cope with those conditions.

    The ultimate goal of any type of therapy is to help the client deal more successfully with a disorder or a situation. The specific treatment goals depend on the individual client, the therapist's theories, and the situation at hand. Talk therapy begins with an initial appointment, often referred to as an intake interview. During this appointment, the client will describe what brings him or her to therapy. This is known as the presenting problem. We propose these phase using NLP model that interact with user in better way in getting exact problem. The therapist will then ask questions to help clarify the nature of the problem, and its duration and severity. He will also try to determine the client's goals for therapy. By the end of the first session, the therapist will have the beginnings of a treatment plan, although many therapists will wait until the second session to provide a more formalized plan to the client. Some therapists choose to maintain the treatment plan as a reference document for themselves but do not present it to the client unless requested. Our solution will be applied to only first session of counseling which is taken to talk therapy. Using the reference from the talk therapy session the

    counselor can continue to the next sessions

    Presently the counselors conduct the counseling sessions manually. Many schools and colleges hire expert counselors to take up the counselors to improve student's mental health for a good living and better results in academics. There is less automation in the existing system and most of the process is done manually. The purpose of this paper is to propose a system which advice and guide the students to help build a positive attitude, using aspect of Talk Therapy implemented by Natural Language Processing. The main contributions of this paper are summarized as follows:

    1. We propose a Natural language processing system which understands that is capable of taking a therapy session with the students .

    2. We provide a the code snippets and discuss critical implementation and details to illustrate the functionality of the prototype

    The rest of this paper is organized as follows. Section II introduces the background and related work. Section III presents the overall system architecture of our proposed solution. Section IV describes the essential aspects of the implementation. Finally, we conclude the article and outline the future work in Section V


    1. Background

      1. Natural Language Processing

        Natural Language Processing, usually shortened as NLP, is a branch of artificial intelligence that deals with the interaction between computers and humans using the natural language. The ultimate objective of NLP is to read, decipher, understand, and make sense of the human languages in a manner that is valuable. Most NLP techniques rely on machine learning to derive meaning from human languages. There are multiple techniques of the natural language processing like text summarization, speech recognition, sentiment analysis

      2. Talk Therapy

        Talk therapy, also known as psychotherapy, involves a person meeting with a therapist in a confidential environment to speak about their emotions, thoughts, behaviors and anything else that might be causing them emotional distress. Different types of talk therapy include humanist therapy, group counseling and motivational counseling; however, the two most common examples of talk therapy are psychoanalysis and cognitive behavioral therapy. The type of talk therapy that works best depends on the individual and his or her needs.

      3. Rasa Framework

      Rasa is an open source machine learning framework for building AI assistants and chat bots. It has two main modules:

      Rasa Core and Rasa NLU. Rasa Core is the module, where the framework tries to understand user messages to detect Intent and Entity in your message. Rasa NLU is the module, where the framework try to help you with contextual message flow. Based on user message, it can predict dialogue as a reply and can trigger Rasa Action.

    2. Related Work

    The field of conversation analysis was born in the 1960s out of a suicide prevention center (Sacks and Jefferson, 1995; Van Dijk, 1997). Since then conversation analysis has been applied to various clinical settings including psychotherapy (Labov and Fanshel, 1977). Work in psycholinguistics has demonstrated that the words people use can reveal important aspects of their social and psychological worlds (Pennebaker et al., 2003). Previous work also found that there are linguistic cues associated with depression (Ramirez-Esparza et al., 2008; Cmpbell and Pennebaker, 2003) as well as with suicide (Pestian et al., 2012). The approach presented in this paper uses all these aspects at the basic level and implements it to understand the conversation and analyze it with common techniques of Natural Language Processing.


    The Talk Therapy system is designed to take up the session and counsel the student to get know about his daily activities and the environment in which he lives. The Environment could have a positive or negative impact on the student which varies according to the actors which are present in the environment. Thus, the main influence of the students mental health is affected by the actors.

    The actors can in the environment of any student can be mainly classified as: Parents/Guardian, Friends, Teachers, Others. These categories are used to differentiate and form a set of questions. The Tailored set of questions for each category are prepared by professional counselor and fed into to the system. The system is then designed to ask the student these tailored set of questions for each category during the course of the session The High level view of the design process is as shown in Figure 1.The input to the system is speech input which is a reply for the question asked by the system. The audio input is taken by the system from the mic. The voice is recognized by voice recognition module of the system so that it makes sense. The recognized audio voice is converted to text by the speech-to-text module so that it can be used for further processing by the system's Natural Language Processing module. The Natural Language processing (NLP) module has various steps to undergo where the replied text is taken and processed. After processing the text ,the system frames up a text which is a reply for the conversation to proceed and is output to the user. The text is converted to speech by text-to-speech module which is output to the student using audio output device.

    Figure 1 High level design of the system.

    Figure 1 presents the overall design of the system we proposed. The system mainly consists of 4 parts: Student, Counselor Assistant, Google Text-to-speech, Rasa Server and Database. The function of each part is illustrated as follows:

    1. Student

      The student is the main source of input to the system. The student provides the input as speech which is the part of the conversation. The student provides input in speech as he speaks to the system and replies to the speech from the system.

    2. Counselor Assistant

      The counselor assistant is server which communicates with the student it receives the input from the student. It communicates with the other modules (like Google Text-to- speech engine, Rasa Server), convert text to speech to communicate the responses to the user.

    3. Google Text-to-speech

      The Google text-to-speech engine is a well known engine which is mainly responsible to convert the speech from the user to text.

    4. Rasa Server

      This is the heart of the system. It has all the logic which handles three main logics: Understand the context from the text, analyze the text by detecting intents with sentiments and frame the response based on the analysis. The server is trained based on the historical conversations. It is programmed to proceed with the conversation by asking questions each time and at the same time replying to the previous statements made by the student which is derived from the text. While nearing the end of the conversation it summarizes the conversation and frames a conclusive reply to the student. The server also stores the conversation in the database for future references and reports the scoring for the conversation to the counselor.

    5. Database

    Database stores the data of each conversation and the data

    includes information in the conversations like the student name and it also stores whole conversation. This data helps in summarization and provide the scoring for the student. It could be a any relation database like MySQL or Postgresql.

    All these functional part collectively converse with the student and help in forming the successful talk therapy session with the student.


    The solution we proposed builds the conversation starting from the initial prompt from the student. The core implementation proposed resides mainly in the natural language processing stage of the system which is achieved using Rasa Framework. It is designed in a way to proceed with the conversation and extraction of the information based on the intents and emotions. The answers/replies received from the student are considered by the system to counsel the students and provide a report to the counselor. The talk therapy session goes into 4 main phases: Introduction Phase, Interaction Phase, Conclusion Phase and Reporting Phase.

    1. Introduction Phase

      Every start of a Talk Therapy session starts with the introduction of the counselor to student. This phase is important as student needs to be comfortable for the session to be effective. The Student need to introduce him/herself about his/her name, parents name, hobbies, Class etc. This phase is implemented with question which ask the student's information and collects basic details to proceed further in the conversation. This is done using intent analysis of the input text.

    2. Interaction Phase

      During the interaction phase the counselor asks questions to the student. The questions are based on actors in student's day to day environment which are categorized as: Students, Friends, Family, Others. Thus, the questions are tailored and made into sets for each category. For each question asked and the reply given there is emotion rating which can be positive or negative. This rating is added to the category to which the question belong.

      For example consider the following set of question, comment and score:

      Question: Is there any problem with your teacher? (teachers category) Negative comment: My math teacher is always arrogant and always complains. Sentiment Score: – 1.233288

      Question: Who makes you feel better? (Friends Category) Positive comment: I feel good when my friends are around. Sentiment Score: 0.2672612.

      Figure 2. Interaction phase and scores division.

      As shown in the figure 2, the interaction phase collects information about the students environment. The intent is collected and the sentiment is analyzed based on the students response. The scores of the sentiment analysis is used for determining the next question and also used to identify the student's area of problem as the intent is known by the system. The ambiguity in understanding the intent is handled by using the generic works or asking the student to reframe the reply as it is crucial to understand every aspect of this phase of the conversation.

    3. Conclusion Phase

      During conclusion phase, the reply is a choice of motivating sentences. These sentences are sets which are selected based on ranking of the student for each category. If there is any negative ranking for family and it falls under range 5-10 then it is less negative hence the conclusion may be set of sentences like :"Feel more connected to those who are close to you, such as your family members". The conclusion of the conversation is determined when there are enough information obtained from the student or if the threshold is reached for the student which is limited by time or number of questions.


      Figure 3 The tailored conclusion of conversation.

    4. Reporting Phase

      This phase is entered right after the conversation conclusion is obtained where the whole summary of the conversation is obtained using the text summarization and the report is stored in the database of the system for further analysis by the actual counselor. The summary is obtained by using the NLTK library which is well known for the text summarization.

      Moving phase by phase the whole conversation is completed and the first part of the talk therapy is implemented. The session information stored in the database can be used by the counselor to proceed with the detailed observation of the student for further sessions. The information in the database can be presented as a dashboard and with advanced features to help them assist more. Figure 4 shows a view of the dashboard with information about the conversation.

      Figure 4 The tailored conclusion of conversation.


In this paper, we proposed a model which implements talk therapy to students. Counseling takes place in many ways, the model address the student problem at the initial level, Since we solve the initial problem the counselor get to know how to proceed for the further counseling session. By this Talk Therapy Students can openly share their problems with the model that they cannot share with their parents, teachers, friends and others. It reliefs the student from his problem, anxiety or other mental health conditions and it gives the ability to change the self-defeating behaviors and makes him to be in a positive attitude. The main goal of the Talk Therapy is to facilitate academic, emotional and cognitive development of student to empower them in learning. Motivate to solve problem and change behavior patterns of the student. There can be many improvements to the model by having advanced methods to build the conversation flow and adapt to include various methods in identifying the problems accurately.


[1] Yuki Tsuburaya, Azusa Saito,Minetada osano, A Soothing Software Robot: Modeling Users Emotions from Utterances ,2009 International Conference on Biometrics and Kansei Engineering.

[2] DongKeon Lee,Kto-Joong Oh, The ChatBot Feels You Emotional Response Generation,IEEE paper of Counselling data for emotional response.

[3] Tim Alyhoff, Kevin Clark, Jure Leskovec , Large-scale Analysis of Counselling conversations using NLP,29/1/2017.

[4] Adrian B. R. Shatte1,2, Delyse M. Hutchinson2,3,4,5 and Samantha J. Teague, "A scoping review of methods and applications, 10/1/2019.

[5] Large-scale analysis of counseling conversations using NLP, Tim Alyhoff,Kevin Clark,Jure Leskovec, 29/1/2017.

[6] The ChatBot Feels you-Emotional Response Generation, Dongkeon Lee,Kyo- Joong Oh, 1/7/2017.