This Flask app takes as input a user comment and decides if it is positive or not.
We used as reference French comments on the reservation site, Booking.com.
We scraped more than 50k comments, fetching elements such as client name, accomodation, comments and ratings. You can use the machine-learning/scrap.py file in order to scrap one query results or several ones in parallel with multiprocessing.
We clean the data in the machine-learning/processing.ipynb. Common steps such as removing null values, dealing with missing or inconsistent data have been applied before doing more NLP-like steps. Not having enough computing power compelled us to reduce the dataset to 10 000 comments (5000 positive / 5000 negative). With a reduced dataset, we managed to tokenize, lemmatize and stem the comments.
We created a pipeline which enabled us to compare the combination between several feature transformations and models. Ensembling methods yield better results so we eventually used one of them for the Flask app.
Booking Sentiment Analysis App
docker pull nohossat1/booking-sentiment-analysis
docker run -it -p 5000:5000 --name booking-app nohossat1/booking-sentiment-analysis:latestThe app will run on this URL : 0.0.0.0:5000
git clone https://github.com/Nohossat/Comments-sentiment-analysis
cd Comments-sentiment-analysis
python -m venv venv/
source venv/bin/activate # Mac
source venv/Scripts/activate # Windows
pip install -r requirements.txt
# run scrap app on Booking.com
python machine_learning/scrap.py
# generate models
python machine_learning/modeling.py
# run app on local machine
export FLASK_APP=hotel_app
export FLASK_ENV=development
flask run
