The goal of this project is to analyze the conversations of my team to ensure they are happy ๐.
How?
(L1) Writing an API in Flask just to store chat messages in mySQL
(L2) Extracting sentiment from chat messages and perform a report over a whole conversation
(L3) Recommending friends to a user based on the contents from chat documents using a recommender system with NLP analysis
(L4) Creating an image of the API with Docker --> In process
(L5) Heroku --> In process
API endpoints
@app.route('/')
- Returns all data of MySQL database
@app.route('/add', methods=['POST'])
- Add new user: Username, text, idChat, idUser, idMessage
@app.route('/edit/<string:idMessage>')
- To edit users
@app.route('/update/<string:idMessage>', methods = ['POST']')
- To confirm user update successfully
@app.route('/delete/<string:idMessage>')
- To delete users (you will have to confirm to continue with user deletion)
@app.route('/analyze/<string:idChat>')
- Returns the sentiment analysis of the idChat. There are 3 values, positive, negative and neutral, whose sum is 1.
@app.route('/sentiment/<idUser>')
- Returns the sentiment analysis of the idUser.
@app.route('/friendship/<name>')
- Gives you a recommended friendship
-
Python 3.6
-
LAMP: It is used to create and deploy dynamic web applications. To install LAMP in ubuntu 19.10
- Linux --> operating system for the web application
- Apache --> web server
- Mysql --> database
- Php --> to process dynamic content
- Flask: Framework that allows you to create web applications quickly and with a minimum number of lines of code.
- Flask 1.1.1
- Flask-MySQLdb 0.2.0 (to connect to Mysql)
- NLTK 3.4.5: set of libraries and programs for the processing of symbolic natural language and statistics for the Python programming language.
-
When you have everything installed, - I also installed MySQL Worckbench - you have to import the database that is in the input folder. How to do it? Very easy: in scheme, you create a new scheme, you click on it with the right button, and in the drop-down you select Table Data Import, and there you already select your file. It allows you to import both in .csv and .json format.
-
You've to have a MySQL password. Save it in an .env under the name of the SECRET_KEY variable. E.g: SECRET_KEY = "your-password"