library(dplyr)
library(tidytext)
library(ggplot2)
reviews <- tibble(
  review = 1:5,
  text = c(
    "I love the quality of this product. The price is reasonable, and delivery was fast.",
    "The product quality is excellent, but the shipping took too long.",
    "Great customer service! I would definitely recommend this product to my friends.",
    "The price is too expensive. However, the product looks beautiful.",
    "Fast delivery and excellent service. I am very satisfied with my purchase."
  )
)

Tokenization

tidy_reviews <- reviews %>%
  unnest_tokens(word, text)

head(tidy_reviews)
## # A tibble: 6 × 2
##   review word   
##    <int> <chr>  
## 1      1 i      
## 2      1 love   
## 3      1 the    
## 4      1 quality
## 5      1 of     
## 6      1 this
clean_reviews <- tidy_reviews %>%
  anti_join(stop_words)
word_counts <- clean_reviews %>%
  count(word, sort = TRUE)

word_counts
## # A tibble: 17 × 2
##    word           n
##    <chr>      <int>
##  1 product        4
##  2 delivery       2
##  3 excellent      2
##  4 fast           2
##  5 price          2
##  6 quality        2
##  7 service        2
##  8 beautiful      1
##  9 customer       1
## 10 expensive      1
## 11 friends        1
## 12 love           1
## 13 purchase       1
## 14 reasonable     1
## 15 recommend      1
## 16 satisfied      1
## 17 shipping       1
word_counts %>%
  filter(n > 1) %>%
  ggplot(aes(x = reorder(word, n), y = n)) +
  geom_col(fill = "steelblue") +
  coord_flip() +
  labs(x = "Word", y = "Count", title = "Most Common Words in Customer Reviews")

Findings

After removing stop words, the most frequent words were “product,” “quality,” “delivery,” “service,” and “price,” showing that customers focus mainly on product quality, delivery speed, and service. Marketers can use this to highlight these strengths in messaging while addressing concerns about shipping time and price.