Introduction
In the hospitality industry, understanding customer opinions and sentiments is crucial for maintaining high levels of customer satisfaction and improving overall service quality. Sentiment analysis of hotel reviews provides valuable insights into customer preferences, opinions, and experiences, enabling hotel management to identify areas for improvement and make informed decisions.
In this project, I conduct sentiment analysis on a dataset of hotel reviews to understand the overall sentiment expressed by customers. I analyze the frequency of positive, negative, and neutral sentiments, as well as the distribution of specific emotions such as joy, trust, anger, and sadness. Additionally, I explore the most frequently mentioned words in the reviews to identify common themes and aspects of the hotel experience that are frequently mentioned by customers.
By analyzing hotel reviews using sentiment analysis techniques, I aim to provide actionable insights that can help hotel management enhance the customer experience, address areas of concern, and ultimately improve customer satisfaction and loyalty.
packages
Data Importation and Preparation
Code
data_nlp <- read.csv("Restaurant_Reviews.tsv",
sep = '\t',quote = '',stringsAsFactors = F)
#specifying the vector with text messages
corpus <- VCorpus(VectorSource(data_nlp$Review))
#transforming the content to lower case
corpus <- tm_map(corpus,content_transformer(tolower))
#removing numbers
corpus <- tm_map(corpus,removeNumbers)
#removing punctuation
corpus <- tm_map(corpus,removePunctuation)
#removing stopwords
corpus <- tm_map(corpus,removeWords,stopwords())
#getting root of the word
corpus <- tm_map(corpus, stripWhitespace)
corpus <- tm_map(corpus, stemDocument)
data <- DocumentTermMatrix(corpus)
#removing column with less words
data <- removeSparseTerms(data, 0.999)
dataset <- data.frame(as.matrix(data))
dataset$liked <- data_nlp$Liked
Data Analysis
Most Repeated Words
Code
food place good servic great back time like will realli
125 112 95 84 70 61 55 51 37 36
- Food (125 mentions)
The word “food” is the most frequently mentioned word in the reviews, with 125 mentions.This indicates that customers place a significant emphasis on the quality of food provided by the hotel.The frequency of this word suggests that food plays a crucial role in the overall experience of the customers.
- Place (112 mentions)
“Place” is the second most repeated word in the reviews, with 112 mentions.Customers often mention the hotel’s location or overall ambiance using this word.The frequency of this word indicates that customers consider the hotel’s location as an important factor in their experience.
- Good (95 mentions)
“Good” is frequently used by customers to describe various aspects of their experience, such as service, food, ambiance, etc.Its high frequency suggests that customers generally have positive opinions about different aspects of the hotel.
- Service (84 mentions)
Customers frequently mention “service” in their reviews, with 84 mentions. This indicates that the quality of service provided by the hotel staff is an important aspect of the customer experience. Customers often express their satisfaction or dissatisfaction with the service using this word.
- Great (70 mentions)
“Great” is often used by customers to express positive opinions about various aspects of the hotel, such as service, food, ambiance, etc.Its high frequency suggests that customers have a generally positive impression of the hotel.
- Back (61 mentions)
“Back” is frequently used by customers to express their intention to return to the hotel.Its frequency suggests that customers are satisfied with their experience and are likely to revisit the hotel in the future.
- Time (55 mentions)
Customers often mention “time” in the context of their experience at the hotel, such as the time spent dining, relaxing, etc.Its frequency suggests that customers value their time spent at the hotel and consider it an important aspect of their experience.
- Like (51 mentions)
“Like” is frequently used by customers to express positive opinions about various aspects of the hotel, such as food, service, ambiance, etc.Its frequency suggests that customers have a generally positive impression of different aspects of the hotel.
- Will (37 mentions)
“Will” is often used by customers to express their intention to revisit or recommend the hotel to others.Its frequency suggests that customers are satisfied with their experience and are likely to recommend the hotel to others.
- Really (36 mentions)
“Really” is often used by customers to emphasize their opinions or experiences. Its frequency suggests that customers often use this word to express strong positive opinions about various aspects of the hotel.
Graphical Representation of Most Repeated Word
Code
wordcloud(names(first_ten),first_ten,min.freq = 30,colors = brewer.pal(6,"Dark2"))
Sentiment Analysis
Code
The sentiment analysis indicates that the majority of customers have a positive experience at the hotel, with trust and joy being the most prevalent positive emotions expressed in the reviews. However, it’s important for the hotel management to address any negative sentiments expressed by customers and work towards improving customer satisfaction.
This analysis provides valuable insights into customer opinions and sentiments, which can be used by the hotel management to make informed decisions and improve the overall customer experience.