Project Title : AI therapist
Introduction: Input is user provided description about how his day went in two-three lines. Using natural language processing, our program detects how user is feeling. He may be feeling depressed, feared, angry etc. Then a recommender system is used to show him content based on his current emotions. For example if user is feeling depressed, program will show him motivational thoughts, blogs etc.
The project will be a combination of natural language processing and recommender system. The pipeline model built through NLP will put user input in any one of the classes ‘A’, ’B’, ’C’, ’D’ .
Class A: Anger
Class B: Minor Depression
Class C: Serious Depression
Class D: Fear
After this the recommender system will recommend quotes and speeches pertaining to a particular class in order to assist user.
import numpy as np import pandas as pd from pandas import Series, DataFrame import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline import string from nltk.corpus import stopwords #data is our input dataset containing user input lines and it has a column of emotional class. #The code will not work in IDE as no dataset has been provided #f unction to remove punctuations and stopwords def function_preprocess (mess): nopunc =  for char in mess : if char not in string.punctuation: nopunc.append(char) nopunc=''.join(nopunc) clean =  for word in nopunc.split(): word = word.lower() if word not in stopwords.words('english'): clean.append(word) return clean from sklearn.pipeline import Pipeline from sklearn.naive_bayes import MultinomialNB from sklearn.feature_extraction.text import CountVectorizer as cv from sklearn.feature_extraction.text import TfidfTransformer #building our NLP model using naive bayes as classifier pipeline = Pipeline([('bow', cv(analyzer=function_preprocess)), ('tfidf', TfidfTransformer()), ('classifier', MultinomialNB()), ]) pipeline.fit(data, emotional_class)
Recommender system will be created using neighbour based collaborative filtering techniques as it would suggest the things which were helpful for similar users.
1. Language used: Python
2. Algorithms : Collaborative filtering, Naive bayes, Natural Language Processing
1. Can be used to identify people suffering from depression, anxiety etc and at the same time help them too.
2. If user is suffering from depression, program will recommend him to visit a doctor and also inform his relatives about the same.
3. If user is often angry, program will suggest him tips for anger management.
4. This model will be helpful to psychiatrists and therapists for curing their clients.
1. Abhay Gupta
2. Abhinav Tripathi
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.