Chapter 36 Pai Northern Thai Kitchen

36.1 Word Cloud of business Pai Northern Thai Kitchen

#r_BrIgzYcwo1NAuG9dLbpg

createWordCloud(reviews %>%
  filter(business_id == "r_BrIgzYcwo1NAuG9dLbpg"))

36.2 Ten most common words used in reviews of business Pai Northern Thai Kitchen

We examine the Top Ten Most Common words and show them in a bar graph.

reviews %>%
  filter(business_id == "r_BrIgzYcwo1NAuG9dLbpg") %>%
  unnest_tokens(word, text) %>%
  filter(!word %in% stop_words$word) %>%
  filter(!word %in% c('food','restaurant')) %>%
  count(word,sort = TRUE) %>%
  ungroup() %>%
  mutate(word = factor(word, levels = rev(unique(word)))) %>%
  head(10) %>%
  
  ggplot(aes(x = word,y = n)) +
  geom_bar(stat='identity',colour="white", fill =fillColor) +
  geom_text(aes(x = word, y = 1, label = paste0("(",n,")",sep="")),
            hjust=0, vjust=.5, size = 4, colour = 'black',
            fontface = 'bold') +
  labs(x = 'Word', y = 'Word Count', 
       title = 'Word Count') +
  coord_flip() + 
  theme_bw()

36.3 Sentiment Analysis - Postive and Not So Postive Words of Pai Northern Thai Kitchen

We display the Positive and Not So Positive words used by reviewers for the business Pai Northern Thai Kitchen.We have used the AFINN sentiment lexicon, which provides numeric positivity scores for each word, and visualize it with a bar plot.

positiveWordsBarGraph(reviews %>%
                        filter(business_id == "r_BrIgzYcwo1NAuG9dLbpg"))

36.4 Calculate Sentiment for the reviews

We calculate the sentiment scores for all the reviews using the AFINN sentiment lexicon. We display the Top Six sentiments here.

pai_thai = reviews %>%
          filter(business_id == "r_BrIgzYcwo1NAuG9dLbpg")

sentiment_lines = calculate_sentiment(pai_thai)

head(sentiment_lines)

36.5 Negative Reviews

We examine the Top 10 most negative reviews.An analysis of the negative reviews reveals that the complaints were about Service. Now when we go deeper into the Service complaints, we can find out various aspects of the service complaints such as

  • why our waitress seemed to be in such a hurry to get us out of the place.

  • This restaurant was crowded and noisy. The tables were packed so closely that I was falling over other diners while maneuvering to my seat

  • but their service was God-awful. They rarely attended our table, It took 55 minutes for our food to arrive. They took our drink orders and did not deliver them

display_neg_sentiments(sentiment_lines,pai_thai)

36.6 Positive Reviews

We examine the Top Ten most postive reviews.

display_pos_sentiments(sentiment_lines,pai_thai)

36.7 Relationship among words in Pai Northern Thai Kitchen

We explore the different relationship among the various words in *Pai Northern Thai Kitchen here through a network graph

bigrams_thai <- reviews %>%
  filter(business_id == "r_BrIgzYcwo1NAuG9dLbpg") %>%
  count_bigrams()

bigrams_thai %>%
  filter(n > 50) %>%
  visualize_bigrams()

36.7.1 Relationship of words with thai

The following network diagram shows the words associated with the word thai

bigrams_thai %>%
  filter(word1 == "thai" | word2 == "thai" ) %>%
  filter(n > 5) %>%
  visualize_bigrams()