Hotel Reviews Sentiment Analysis with Python

Whenever we are looking for hotels for vacation or travel, we always prefer a hotel known for its services. The best way to find out whether a hotel is right for you or not is to find out what people are saying about the hotel who have stayed there before. Now it is very difficult to read the experience of each person who has given their opinion on the services of the hotel. This is where the task of sentiment analysis comes in. In this article, I will walk you through the task of Hotel Reviews Sentiment Analysis with Python.

Hotel Reviews Sentiment Analysis with Python

The dataset that I am using for the task of Hotel Reviews sentiment analysis is collected from Kaggle. It contains data about 20,000 reviews of people about the services of hotels they stayed in for a vacation, business trip, or any kind of trip. This dataset only contains two columns as Reviews and Ratings of the customers. So let’s get started with the task of Hotel Reviews sentiment analysis with Python by importing the necessary Python libraries and the dataset:

                                              Review  Rating
0  nice hotel expensive parking got good deal sta...       4
1  ok nothing special charge diamond member hilto...       2
2  nice rooms not 4* experience hotel monaco seat...       3
3  unique, great stay, wonderful time hotel monac...       5
4  great stay great stay, went seahawk game aweso...       5

This dataset is very large and luckily there are no missing values so without wasting any time let’s take a quick look at the distribution of customer ratings:

Hotel Reviews Sentiment Analysis

It can be seen that most of the guests rated the hotel services with 5 stars and 4 stars. So according to the above ratings, we can say that most of the guests are satisfied with the services of the hotel they stayed. Now let’s move forward by analyzing the sentiments of hotel reviews. To analyze the sentiment of the hotel reviews, I’ll add three additional columns to this dataset as Positive, Negative, and Neutral by calculating the sentiment scores of the reviews:

                                              Review  Rating  Positive  Negative  Neutral
0  nice hotel expensive parking got good deal sta...       4     0.285     0.072    0.643
1  ok nothing special charge diamond member hilto...       2     0.189     0.110    0.701
2  nice rooms not 4* experience hotel monaco seat...       3     0.219     0.081    0.700
3  unique, great stay, wonderful time hotel monac...       5     0.385     0.060    0.555
4  great stay great stay, went seahawk game aweso...       5     0.221     0.135    0.643

According to the reviews, hotel guests seem satisfied with the services, now let’s take a look at how most people think about hotel services based on the sentiment of their reviews:

Neutral 🙂

Thus, most people feel neutral about the hotel services. Now let’s take a closer look at sentiment scores:

Positive:  6359.91000000002
Negative:  1473.4750000000038
Neutral:  12657.627999999937

Thus, according to the above results, more than 12,000 reviews are classified as neutral, more than 6,000 reviews are classified as positive. So it can be said that people are really happy with the services of the hotels they have stayed in as the negative reviews are below 1500.

Summary

This is how you can analyze the sentiments of hotel reviews. The best way to know if a hotel is right for you or not is to find out what people are saying about the hotel who have stayed there before. This is where the task of hotel reviews sentiment analysis can help you decide whether or not a hotel is suitable for your trip. Hope you liked this article on sentiment analysis of hotel reviews with Python. Please feel free to ask your valuable questions in the comments section below.

Default image
Aman Kharwal
Coder with the ♥️ of a Writer || Data Scientist | Solopreneur | Founder
Articles: 1132

Leave a Reply