Sentiment Analysis of Sephora Skincare Reviews

Author

Ozge Gundogan

Published

November 14, 2026

1. Introduction

Sentiment analysis is a method used to identify positive and negative opinions in text. It helps us understand how people express their feelings in books, customer reviews, and other written content.

In this assignment, I will first reproduce the sentiment analysis examples from Chapter 2 of Text Mining with R: A Tidy Approach by Julia Silge and David Robinson. I will use Jane Austen’s novels and three sentiment lexicons (Bing, AFINN, and NRC) to examine sentiment patterns in literary texts.

Next, I will apply sentiment analysis to a different dataset containing 40,234 Sephora skincare reviews from Kaggle. I chose this dataset because customer reviews contain personal opinions about products, and I want to understand how these opinions relate to star ratings. After removing duplicate records, I will analyze 18,556 unique reviews using four sentiment lexicons: Bing, AFINN, NRC, and SentiWordNet.

My goal is to compare how these lexicons classify customer reviews and understand why they may produce different results.

2. Planned Approach

I will use R and the tidytext package to complete this analysis. First, I will load Jane Austen’s novels from the janeaustenr package and split the text into individual words using the unnest_tokens() function. Then, I will use Bing, AFINN, and NRC to identify sentiment words, calculate sentiment scores, and create charts to examine sentiment patterns throughout the novels.

Next, I will download the Sephora skincare reviews dataset from GitHub. I will check the dataset structure, missing values, and duplicate reviews. I will remove duplicate records, clean special characters, and split the review text into individual words.

After preparing the data, I will use the Bing lexicon to count positive and negative words and calculate net sentiment scores for each review. I will also use AFINN to calculate numerical sentiment scores and compare the results with customer star ratings.

Then, I will use NRC to examine different emotions, such as joy, trust, anger, and sadness. I will also use SentiWordNet as an additional sentiment lexicon to calculate sentiment scores based on positive and negative word scores.

Finally, I will compare the results from all four lexicons using tables and charts. I will also compare my analysis with the original Jane Austen example, discuss the main findings, and explain the limitations of sentiment analysis.

Data Source: https://www.kaggle.com/datasets/natashamessier/sephora-skincare-reviews-and-sentiment

3. Anticipated Challenges

One challenge may be cleaning the text data. Customer reviews may contain special characters, punctuation, spelling mistakes, and duplicate records. These problems may affect the accuracy of sentiment analysis.

Another challenge may be comparing different sentiment lexicons. Bing classifies words as positive or negative, while NRC also includes different emotion categories. AFINN and SentiWordNet use numerical scores to measure sentiment. Because these lexicons use different methods and vocabularies, they may produce different results for the same review.

Sentiment analysis also has some limitations. A word may have different meanings depending on its context. For example, a negative word may appear in a review that is generally positive. Lexicon-based methods may also have difficulty understanding sarcasm, negation, and skincare-specific expressions.

4. Code Base

4.1 Load Required Packages

I will load the R packages needed for this analysis. These packages will help me work with text data, analyze sentiment, and create visualizations.

library(tidytext)
Warning: package 'tidytext' was built under R version 4.6.2
library(janeaustenr)
Warning: package 'janeaustenr' was built under R version 4.6.2
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(stringr)
library(tidyr)
Warning: package 'tidyr' was built under R version 4.6.2
library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.6.2
library(wordcloud)
Warning: package 'wordcloud' was built under R version 4.6.2
Zorunlu paket yükleniyor: RColorBrewer
library(reshape2)

Attaching package: 'reshape2'
The following object is masked from 'package:tidyr':

    smiths
library(lexicon)
Warning: package 'lexicon' was built under R version 4.6.2

4.2 Reproduce the Original Example

In this section, I will reproduce the sentiment analysis examples from Chapter 2 of Text Mining with R: A Tidy Approach by Julia Silge and David Robinson (2017). I will follow the original code and analysis steps presented in the book.

4.2.1 The Sentiment Datasets

First, I will examine the three sentiment lexicons introduced in the book: AFINN, Bing, and NRC.

get_sentiments("afinn")
# A tibble: 2,477 × 2
   word       value
   <chr>      <dbl>
 1 abandon       -2
 2 abandoned     -2
 3 abandons      -2
 4 abducted      -2
 5 abduction     -2
 6 abductions    -2
 7 abhor         -3
 8 abhorred      -3
 9 abhorrent     -3
10 abhors        -3
# ℹ 2,467 more rows
get_sentiments("bing")
# A tibble: 6,786 × 2
   word        sentiment
   <chr>       <chr>    
 1 2-faces     negative 
 2 abnormal    negative 
 3 abolish     negative 
 4 abominable  negative 
 5 abominably  negative 
 6 abominate   negative 
 7 abomination negative 
 8 abort       negative 
 9 aborted     negative 
10 aborts      negative 
# ℹ 6,776 more rows
get_sentiments("nrc")
# A tibble: 13,872 × 2
   word        sentiment
   <chr>       <chr>    
 1 abacus      trust    
 2 abandon     fear     
 3 abandon     negative 
 4 abandon     sadness  
 5 abandoned   anger    
 6 abandoned   fear     
 7 abandoned   negative 
 8 abandoned   sadness  
 9 abandonment anger    
10 abandonment fear     
# ℹ 13,862 more rows

The three sentiment lexicons have different structures and methods for classifying words.

- AFINN contains 2,477 entries and assigns numerical sentiment scores from -5 to +5.
- Bing contains 6,786 entries and classifies words as positive or negative.
- NRC contains 13,872 entries and classifies words into positive and negative sentiments, as well as eight emotion categories, such as joy, fear, anger, and sadness.

These differences may lead to different sentiment analysis results, even when the same text is used.

4.2.2 Sentiment Analysis with Inner Join

4.2.2.1 Prepare Jane Austen’s Novels

First, I will load Jane Austen’s novels and convert the text into a tidy format. I will also add line and chapter numbers to keep track of the location of each word in the novels.

tidy_books <- austen_books() %>%
  group_by(book) %>%
  mutate(
    linenumber = row_number(),
    chapter = cumsum(str_detect(text,
                                regex("^chapter [\\divxlc]",
                                      ignore_case = TRUE)))) %>%
  ungroup() %>%
  unnest_tokens(word, text)

4.2.2.2 Most Common Joy Words in Emma

I will use the NRC lexicon to identify the most common words associated with joy in the novel Emma.

nrc_joy <- get_sentiments("nrc") %>%
  filter(sentiment == "joy")

tidy_books %>%
  filter(book == "Emma") %>%
  inner_join(nrc_joy) %>%
  count(word, sort = TRUE)
Joining with `by = join_by(word)`
# A tibble: 301 × 2
   word          n
   <chr>     <int>
 1 good        359
 2 friend      166
 3 hope        143
 4 happy       125
 5 love        117
 6 deal         92
 7 found        92
 8 present      89
 9 kind         82
10 happiness    76
# ℹ 291 more rows

The results show that ???good??? is the most common joy word in Emma, with 359 occurrences. It is followed by ???friend??? (166) and ???hope??? (143). Other common words include ???happy???, ???love???, and ???happiness???. These words are often related to positive feelings and personal relationships.

4.2.2.3 Calculate Net Sentiment in Jane Austen’s Novels

I will use the Bing lexicon to identify positive and negative words in Jane Austen’s novels. I will divide each novel into sections of 80 lines and calculate the net sentiment score by subtracting the number of negative words from the number of positive words.

jane_austen_sentiment <- tidy_books %>%
  inner_join(get_sentiments("bing"),
             by = "word",
             relationship = "many-to-many") %>%
  count(book, index = linenumber %/% 80, sentiment) %>%
  pivot_wider(names_from = sentiment,
              values_from = n,
              values_fill = 0) %>%
  mutate(sentiment = positive - negative)

4.2.2.4 Visualize Sentiment Changes

I will create bar charts to visualize how sentiment changes throughout each novel.

ggplot(jane_austen_sentiment, aes(index, sentiment, fill = book)) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~book, ncol = 2, scales = "free_x")

The charts show how sentiment changes throughout Jane Austen???s six novels. Positive sentiment scores are more common, but all six novels also have sections with negative scores. Mansfield Park and Northanger Abbey show noticeable negative sentiment in some sections. These results show that sentiment is not constant and changes as each story progresses.

4.2.3 Comparing the Three Sentiment Dictionaries

4.2.3.1 Select Pride and Prejudice

I will select Pride and Prejudice from the Jane Austen dataset to compare the three sentiment lexicons using the same novel.

pride_prejudice <- tidy_books %>%
  filter(book == "Pride & Prejudice")

pride_prejudice
# A tibble: 122,204 × 4
   book              linenumber chapter word     
   <fct>                  <int>   <int> <chr>    
 1 Pride & Prejudice          1       0 prıde    
 2 Pride & Prejudice          1       0 and      
 3 Pride & Prejudice          1       0 prejudıce
 4 Pride & Prejudice          3       0 by       
 5 Pride & Prejudice          3       0 jane     
 6 Pride & Prejudice          3       0 austen   
 7 Pride & Prejudice          7       1 chapter  
 8 Pride & Prejudice          7       1 1        
 9 Pride & Prejudice         10       1 ıt       
10 Pride & Prejudice         10       1 is       
# ℹ 122,194 more rows

4.2.3.2 Sentiment Analysis Using AFINN

I will use the AFINN lexicon to calculate sentiment scores for each section of 80 lines. I will add the individual word scores to calculate the total sentiment score for each section.

afinn <- pride_prejudice %>%
  inner_join(get_sentiments("afinn"), by = "word") %>%
  group_by(index = linenumber %/% 80) %>%
  summarise(sentiment = sum(value)) %>%
  mutate(method = "AFINN")

4.2.3.3 Sentiment Analysis Using Bing and NRC

I will use the Bing and NRC lexicons to count positive and negative words in each section. Then, I will calculate the net sentiment score by subtracting the number of negative words from the number of positive words.

bing_and_nrc <- bind_rows(
  pride_prejudice %>%
    inner_join(get_sentiments("bing"), by = "word") %>%
    mutate(method = "Bing et al."),
  
  pride_prejudice %>%
    inner_join(get_sentiments("nrc") %>%
                 filter(sentiment %in% c("positive",
                                         "negative")),
               by = "word",
               relationship = "many-to-many") %>%
    mutate(method = "NRC")) %>%
  count(method, index = linenumber %/% 80, sentiment) %>%
  pivot_wider(names_from = sentiment,
              values_from = n,
              values_fill = 0) %>%
  mutate(sentiment = positive - negative)

4.2.3.4 Visualize the Three Sentiment Lexicons

I will combine the results from AFINN, Bing, and NRC and create bar charts to compare sentiment changes throughout the novel.

bind_rows(afinn,
          bing_and_nrc) %>%
  ggplot(aes(index, sentiment, fill = method)) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~method, ncol = 1, scales = "free_y")

The three sentiment lexicons show similar patterns throughout the novel, but their sentiment scores are different. AFINN produces a wider range of scores because it assigns numerical values to words. NRC shows mostly positive sentiment, while Bing identifies more sections with negative sentiment. These results show that different sentiment lexicons can produce different results for the same text.

4.2.3.5 Compare Positive and Negative Words in the Lexicons

I will compare the number of positive and negative words in the NRC and Bing lexicons to better understand why the sentiment scores may be different.

NRC:

get_sentiments("nrc") %>%
  filter(sentiment %in% c("positive", "negative")) %>%
  count(sentiment)
# A tibble: 2 × 2
  sentiment     n
  <chr>     <int>
1 negative   3316
2 positive   2308

Bing:

get_sentiments("bing") %>%
  count(sentiment)
# A tibble: 2 × 2
  sentiment     n
  <chr>     <int>
1 negative   4781
2 positive   2005

Both lexicons contain more negative entries than positive entries. NRC contains 3,316 negative and 2,308 positive entries, while Bing contains 4,781 negative and 2,005 positive entries. Bing has a higher proportion of negative entries than NRC. This difference may help explain why Bing produces more negative sentiment results in the previous analysis.

4.2.4 Most Common Positive and Negative Words

4.2.4.1 Count Positive and Negative Words

I will use the Bing lexicon to identify positive and negative words in Jane Austen’s novels. Then, I will count how frequently each word appears.

bing_word_counts <- tidy_books %>%
  inner_join(get_sentiments("bing"),
             by = "word",
             relationship = "many-to-many") %>%
  count(word, sentiment, sort = TRUE) %>%
  ungroup()

bing_word_counts
# A tibble: 2,584 × 3
   word     sentiment     n
   <chr>    <chr>     <int>
 1 miss     negative   1855
 2 well     positive   1523
 3 good     positive   1380
 4 great    positive    981
 5 like     positive    725
 6 better   positive    639
 7 enough   positive    613
 8 happy    positive    534
 9 love     positive    495
10 pleasure positive    462
# ℹ 2,574 more rows

The results show that ???miss??? is the most frequent sentiment word, with 1,855 occurrences. It is classified as negative by the Bing lexicon. The most common positive words are ???well???, ???good???, and ???great???. However, the meaning of a word may change depending on its context.

4.2.4.2 Visualize the Most Common Sentiment Words

I will create bar charts to show the ten most common positive and negative words in Jane Austen’s novels.

bing_word_counts %>%
  group_by(sentiment) %>%
  slice_max(n, n = 10) %>%
  ungroup() %>%
  mutate(word = reorder(word, n)) %>%
  ggplot(aes(n, word, fill = sentiment)) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~sentiment, scales = "free_y") +
  labs(x = "Contribution to sentiment",
       y = NULL)

The charts show the ten most frequent positive and negative words in Jane Austen???s novels. The word ???miss??? stands out among the negative words, while ???well??? and ???good??? are the most frequent positive words. The high frequency of ???miss??? suggests that some words may be incorrectly classified because of their context.

4.2.4.3 Create Custom Stop Words

The word “miss” is classified as negative by the Bing lexicon. However, Jane Austen often uses this word as a title for unmarried women. I will add this word to a custom stop words list.

custom_stop_words <- bind_rows(
  tibble(word = c("miss"),
         lexicon = c("custom")),
  stop_words
)

custom_stop_words
# A tibble: 1,150 × 2
   word        lexicon
   <chr>       <chr>  
 1 miss        custom 
 2 a           SMART  
 3 a's         SMART  
 4 able        SMART  
 5 about       SMART  
 6 above       SMART  
 7 according   SMART  
 8 accordingly SMART  
 9 across      SMART  
10 actually    SMART  
# ℹ 1,140 more rows

The custom stop words list contains 1,150 entries, including the word ???miss???. Although the Bing lexicon classifies ???miss??? as negative, Jane Austen often uses it as a title for unmarried women. This example shows an important limitation of lexicon-based sentiment analysis. The same word can have different meanings depending on its context.

4.2.5 Wordclouds

4.2.5.1 Create a Word Cloud

I will remove common stop words from Jane Austen???s novels and count the remaining words. Then, I will create a word cloud to display the 100 most common words.

set.seed(123)

tidy_books %>%
  anti_join(stop_words, by = "word") %>%
  count(word) %>%
  with(wordcloud(word, n, max.words = 100))

The word cloud shows the most common words in Jane Austen???s novels after removing common stop words. Larger words appear more frequently in the novels. This visualization helps us identify frequently used words and understand the general content of the novels. However, it does not show whether the words are positive or negative.

4.2.5.2 Create a Sentiment Comparison Word Cloud

I will use the Bing lexicon to identify positive and negative words. Then, I will create a comparison word cloud to visualize the most common words in each sentiment group.

set.seed(123)

tidy_books %>%
  inner_join(get_sentiments("bing"),
             by = "word",
             relationship = "many-to-many") %>%
  count(word, sentiment, sort = TRUE) %>%
  acast(word ~ sentiment, value.var = "n", fill = 0) %>%
  comparison.cloud(colors = c("gray20", "gray80"),
                   max.words = 100)

The comparison word cloud shows the most frequent positive and negative words in Jane Austen???s novels. Words such as ???well???, ???good???, and ???great??? are common positive words, while ???miss??? stands out among the negative words. Unlike the previous word cloud, this visualization separates words based on their sentiment. However, as discussed earlier, the word ???miss??? may not always express negative sentiment in these novels.

4.2.6 Other Units of Analysis

4.2.6.1 Tokenize Text into Sentences

I will use the unnest_tokens() function to split Pride and Prejudice into sentences instead of individual words.

p_and_p_sentences <- tibble(text = prideprejudice) %>%
  unnest_tokens(sentence, text, token = "sentences")

p_and_p_sentences$sentence[2]
[1] "by jane austen"

The result shows that the text can be divided into sentences instead of individual words. Sentence-level analysis can provide more context than word-level analysis.

4.2.6.2 Split Novels into Chapters

I will use a regular expression to split Jane Austen???s novels into chapters. Each row will represent a section of the novel.

austen_chapters <- austen_books() %>%
  group_by(book) %>%
  unnest_tokens(chapter, text, token = "regex",
                pattern = "Chapter|CHAPTER [\\dIVXLC]") %>%
  ungroup()

4.2.6.3 Count Chapters in Each Novel

I will count the number of chapter sections in each novel.

austen_chapters %>%
  group_by(book) %>%
  summarise(chapters = n(), .groups = "drop")
# A tibble: 6 × 2
  book                chapters
  <fct>                  <int>
1 Sense & Sensibility       51
2 Pride & Prejudice         62
3 Mansfield Park            49
4 Emma                      56
5 Northanger Abbey          32
6 Persuasion                25

The results show that Pride and Prejudice has the highest number of chapter sections (62), while Persuasion has the lowest (25). The counts include the introductory text before the first chapter. This structure allows us to analyze sentiment at the chapter level.

4.2.6.4 Identify Negative Words

I will select only the negative words from the Bing sentiment lexicon.

bingnegative <- get_sentiments("bing") %>%
  filter(sentiment == "negative")

4.2.6.5 Count Total Words in Each Chapter

I will calculate the total number of words in each chapter. This will help me compare chapters of different lengths.

wordcounts <- tidy_books %>%
  group_by(book, chapter) %>%
  summarise(words = n(), .groups = "drop")

4.2.6.6 Identify the Most Negative Chapter in Each Novel

I will count the negative words in each chapter and divide this number by the total word count. Then, I will identify the chapter with the highest proportion of negative words in each novel.

tidy_books %>%
  semi_join(bingnegative, by = "word") %>%
  group_by(book, chapter) %>%
  summarise(negativewords = n(), .groups = "drop") %>%
  left_join(wordcounts, by = c("book", "chapter")) %>%
  mutate(ratio = negativewords / words) %>%
  filter(chapter != 0) %>%
  group_by(book) %>%
  slice_max(ratio, n = 1) %>%
  ungroup()
# A tibble: 6 × 5
  book                chapter negativewords words  ratio
  <fct>                 <int>         <int> <int>  <dbl>
1 Sense & Sensibility      43           161  3405 0.0473
2 Pride & Prejudice        34           111  2104 0.0528
3 Mansfield Park           46           173  3685 0.0469
4 Emma                     15           151  3340 0.0452
5 Northanger Abbey         21           149  2982 0.0500
6 Persuasion                4            62  1807 0.0343

The results show that Chapter 34 of Pride and Prejudice has the highest proportion of negative words among the selected chapters, at 5.28%. It is followed by Chapter 21 of Northanger Abbey, at 5.00%. Among the selected chapters, Chapter 4 of Persuasion has the lowest proportion, at 3.43%. Using proportions instead of total word counts allows us to compare chapters of different lengths more fairly.

4.2.7 Summary

I reproduced the sentiment analysis examples from Chapter 2 of Text Mining with R. I used the AFINN, Bing, and NRC sentiment lexicons to analyze Jane Austen???s novels. The main findings are:

- Sentiment changes throughout each novel.
- Different sentiment lexicons can produce different results for the same text.
- Bing contains a higher proportion of negative entries than NRC.
- Word clouds help identify the most frequent words and visualize sentiment.
- Using proportions allows us to compare sentiment across chapters of different lengths.
- Lexicon-based sentiment analysis has some limitations because the meaning of a word can change depending on its context.

These examples provide a foundation for the next part of my analysis, where I will use a different text dataset and an additional sentiment lexicon.

4.3 Sentiment Analysis of Sephora Skincare Reviews

4.3.1 Load the Dataset

I will download the Sephora product review dataset from my GitHub repository. Since the dataset is stored in a ZIP file, I will extract the files and check their contents before loading the data into R.

url <- "https://github.com/OzgeG01/DATA607-Assignment/raw/refs/heads/main/Sephora_product_review.zip"

zip_file <- tempfile(fileext = ".zip")
download.file(url, zip_file, mode = "wb")

unzip(zip_file, exdir = tempdir())

sephora_reviews <- read.csv(
  file.path(tempdir(), "combined_product_review_data.csv"),
  stringsAsFactors = FALSE,
  encoding = "UTF-8"
)

head(sephora_reviews)
  review_id date_published rating_value                              title
1 351645103     2025-07-10            3     This lip balm is a miss for me
2 349938731     2025-06-17            5                                   
3 348900301     2025-06-08            5                                   
4 347053222     2025-05-24            4                  amazing… at times
5 346825636     2025-05-21            3                          It’s okay
6 345143831     2025-05-04            4 So much for sustainable packaging…
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   text
1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        It’s much thinner than I thought it would be and the hydration doesn’t last very long. The flavor/scent also makes me feel nauseous but that is just my opinion. I loveeeee Alpyn’s other products but this just isn’t for me.
2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Consistency is a great mix between a balm and an oil! My issue with a lot of the new “lip oil” products is that its not an oil but a gloss and I hate when something is too sticky and thick. This moisturizes my lips more than a traditional oil but just the same as a regular balm. Though I would say its not a real plumper, and because its hydrating it may give that illusion but if you want something like the too faced lip maximizer this isnt it.
3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     As someone who never writes reviews, I HAD TO for this product! It is absolutely amazing. Moisturizes my lips so well and stays on for hours. It has become my go to lip product!
4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    i’m lucky enough to have tried multiple tubes of this product. there seems to be a difference in texture in some compared to others. i’m very nitpicky about my lip products, but i’ve noticed that some tubes are more gritty than others. if i get the right batch, it’s one of my favorite lip balms. the sweetness of the agave is refreshing and i like the slight pink hue of it!! yet, i also wish it was a little thicker like the original lip mask in the tub container.
5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          It’s not good or bad, just in the middle. It doesn’t plump my lips at all and it doesn’t really hydrate them either. I find that it wears off quickly and I have to keep reapplying. I’ll use it until it’s finished though.
6 Originally bought this about a year, maybe two, ago when it was a sephora online only brand. Marketed as a smaller sustainable clean beauty brand, even their 100 point sample testers were packaged in metal. Definitely on the pricier side, but I didn’t mind because all the packaging was sustainable (glass, metal, etc). Loved the formula, little bit went such a long way. Like many of their products, it took me until now to repurchase. Sad to see the packaging is like every other lip product out there in the weird crappy plastic tubes, so much for sustainability. The formula so far seems the same, I have yet to see if the application lasts overnight like the pot did. \nWhile I can understand changing the packaging to complete with other companies, I know the brand isn’t hurting for cash since they’re now in a decent chunk of every brick and mortar store. It would be nice to see companies that built their brand on a key component, such as sustainable packaging, actually stick with it. These changes make the customers who actually feel in love with the brand’s ethos and helped them grow feel like a slap to our faces. I rated this 4 stars because:\n1. While the packaging changed to a plastic tube, the overall price is lower: pot was 0.35oz, tube is 0.5oz, both sold for $28. \n2. So far the formula feels the same to me, I purchased the tube with lot# P2406-225.\n3. I really do like the rest of their products, and hope to see the company figure out a more sustainable package for the lip mask, like a redesigned version of the metal tubes they use for their sample testers.
  label                                                name brand
1 clean Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN
2 clean Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN
3 clean Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN
4 clean Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN
5 clean Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN
6 clean Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN
           category
1 lip-balm-lip-care
2 lip-balm-lip-care
3 lip-balm-lip-care
4 lip-balm-lip-care
5 lip-balm-lip-care
6 lip-balm-lip-care
                                                                                                                                   description
1 Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask at Sephora. This mask has sweet agave and hyaluronic acid for soft, fuller-looking lips.
2 Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask at Sephora. This mask has sweet agave and hyaluronic acid for soft, fuller-looking lips.
3 Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask at Sephora. This mask has sweet agave and hyaluronic acid for soft, fuller-looking lips.
4 Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask at Sephora. This mask has sweet agave and hyaluronic acid for soft, fuller-looking lips.
5 Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask at Sephora. This mask has sweet agave and hyaluronic acid for soft, fuller-looking lips.
6 Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask at Sephora. This mask has sweet agave and hyaluronic acid for soft, fuller-looking lips.
  price currency review_count aggregate_rating
1    28      USD          291         4.457045
2    28      USD          291         4.457045
3    28      USD          291         4.457045
4    28      USD          291         4.457045
5    28      USD          291         4.457045
6    28      USD          291         4.457045
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               full_review
1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            This lip balm is a miss for me It’s much thinner than I thought it would be and the hydration doesn’t last very long. The flavor/scent also makes me feel nauseous but that is just my opinion. I loveeeee Alpyn’s other products but this just isn’t for me.
2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Consistency is a great mix between a balm and an oil! My issue with a lot of the new “lip oil” products is that its not an oil but a gloss and I hate when something is too sticky and thick. This moisturizes my lips more than a traditional oil but just the same as a regular balm. Though I would say its not a real plumper, and because its hydrating it may give that illusion but if you want something like the too faced lip maximizer this isnt it.
3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        As someone who never writes reviews, I HAD TO for this product! It is absolutely amazing. Moisturizes my lips so well and stays on for hours. It has become my go to lip product!
4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     amazing… at times i’m lucky enough to have tried multiple tubes of this product. there seems to be a difference in texture in some compared to others. i’m very nitpicky about my lip products, but i’ve noticed that some tubes are more gritty than others. if i get the right batch, it’s one of my favorite lip balms. the sweetness of the agave is refreshing and i like the slight pink hue of it!! yet, i also wish it was a little thicker like the original lip mask in the tub container.
5                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   It’s okay It’s not good or bad, just in the middle. It doesn’t plump my lips at all and it doesn’t really hydrate them either. I find that it wears off quickly and I have to keep reapplying. I’ll use it until it’s finished though.
6 So much for sustainable packaging… Originally bought this about a year, maybe two, ago when it was a sephora online only brand. Marketed as a smaller sustainable clean beauty brand, even their 100 point sample testers were packaged in metal. Definitely on the pricier side, but I didn’t mind because all the packaging was sustainable (glass, metal, etc). Loved the formula, little bit went such a long way. Like many of their products, it took me until now to repurchase. Sad to see the packaging is like every other lip product out there in the weird crappy plastic tubes, so much for sustainability. The formula so far seems the same, I have yet to see if the application lasts overnight like the pot did. \nWhile I can understand changing the packaging to complete with other companies, I know the brand isn’t hurting for cash since they’re now in a decent chunk of every brick and mortar store. It would be nice to see companies that built their brand on a key component, such as sustainable packaging, actually stick with it. These changes make the customers who actually feel in love with the brand’s ethos and helped them grow feel like a slap to our faces. I rated this 4 stars because:\n1. While the packaging changed to a plastic tube, the overall price is lower: pot was 0.35oz, tube is 0.5oz, both sold for $28. \n2. So far the formula feels the same to me, I purchased the tube with lot# P2406-225.\n3. I really do like the rest of their products, and hope to see the company figure out a more sustainable package for the lip mask, like a redesigned version of the metal tubes they use for their sample testers.
  sentiment polarity_score
1  negative        -0.0772
2  positive         0.1260
3  positive         0.8135
4  positive         0.9744
5  positive         0.3278
6  positive         0.9813

4.3.2 Explore the Dataset

I will examine the structure of the Sephora dataset, including the number of rows and columns, column names, and data types. This step will help me identify the columns needed for sentiment analysis.

dim(sephora_reviews)
[1] 40234    17
names(sephora_reviews)
 [1] "review_id"        "date_published"   "rating_value"     "title"           
 [5] "text"             "label"            "name"             "brand"           
 [9] "category"         "description"      "price"            "currency"        
[13] "review_count"     "aggregate_rating" "full_review"      "sentiment"       
[17] "polarity_score"  
glimpse(sephora_reviews)
Rows: 40,234
Columns: 17
$ review_id        <int> 351645103, 349938731, 348900301, 347053222, 346825636…
$ date_published   <chr> "2025-07-10", "2025-06-17", "2025-06-08", "2025-05-24…
$ rating_value     <dbl> 3, 5, 5, 4, 3, 4, 5, 1, 1, 3, 4, 2, 4, 5, 5, 5, 5, 4,…
$ title            <chr> "This lip balm is a miss for me", "", "", "amazing… a…
$ text             <chr> "It’s much thinner than I thought it would be and the…
$ label            <chr> "clean", "clean", "clean", "clean", "clean", "clean",…
$ name             <chr> "Plumping & Softening Sweet Agave Lip Balm Treatment"…
$ brand            <chr> "ALPYN", "ALPYN", "ALPYN", "ALPYN", "ALPYN", "ALPYN",…
$ category         <chr> "lip-balm-lip-care", "lip-balm-lip-care", "lip-balm-l…
$ description      <chr> "Shop ALPYN’s Willow & Sweet Agave Plumping Lip Mask …
$ price            <dbl> 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0, 28.0,…
$ currency         <chr> "USD", "USD", "USD", "USD", "USD", "USD", "USD", "USD…
$ review_count     <dbl> 291, 291, 291, 291, 291, 291, 291, 291, 291, 291, 152…
$ aggregate_rating <dbl> 4.457045, 4.457045, 4.457045, 4.457045, 4.457045, 4.4…
$ full_review      <chr> "This lip balm is a miss for me It’s much thinner tha…
$ sentiment        <chr> "negative", "positive", "positive", "positive", "posi…
$ polarity_score   <dbl> -0.0772, 0.1260, 0.8135, 0.9744, 0.3278, 0.9813, 0.92…

The dataset contains 40,234 customer reviews and 17 columns. It includes review text, customer ratings, product names, brands, categories, prices, and publication dates. The full_review column combines the review title and text, so I will use this column for sentiment analysis. I will also use the rating_value column to examine the relationship between customer ratings and sentiment scores. Although the dataset already contains sentiment labels and polarity scores, I will calculate my own sentiment scores using different sentiment lexicons.

4.3.3 Data Cleaning and Preparation

4.3.3.1 Check Missing Values

First, I will check for missing values and empty strings in the dataset. This step is important because missing or empty reviews cannot provide useful information for sentiment analysis.

colSums(is.na(sephora_reviews))
       review_id   date_published     rating_value            title 
               0                0                0                0 
            text            label             name            brand 
               0                0                0                0 
        category      description            price         currency 
               0                0                0                0 
    review_count aggregate_rating      full_review        sentiment 
               0                0                0                0 
  polarity_score 
               0 
sephora_reviews %>%
  summarise(across(
    where(is.character),
    ~ sum(trimws(.x) == "", na.rm = TRUE)
  ))
  date_published title text label name brand category description currency
1              0  8264    0     0    0     0        0           0        0
  full_review sentiment
1           0         0

The dataset does not contain any NA values. However, 8,264 reviews (20.54%) have empty titles. All other columns contain no empty values. Since the full_review column contains no missing or empty values, I will keep all reviews at this stage.

4.3.3.2 Check and Remove Duplicate Reviews

I will check for duplicate review IDs to avoid analyzing the same review more than once.

sum(duplicated(sephora_reviews$review_id))
[1] 21678

I found 21,678 duplicate review IDs. I will check whether these duplicate records also contain identical review texts.

sum(duplicated(sephora_reviews[c("review_id", "full_review")]))
[1] 21678

The results show that 21,678 records have duplicate review IDs and identical review texts. These duplicate records represent approximately 53.88% of the dataset. I will remove these duplicates to avoid counting the same review more than once.

I will remove duplicate reviews based on the review ID and full review text. Then, I will check the dimensions of the cleaned dataset.

sephora_clean <- sephora_reviews %>%
  distinct(review_id, full_review, .keep_all = TRUE)

dim(sephora_clean)
[1] 18556    17

After removing 21,678 duplicate records, the dataset contains 18,556 unique reviews and 17 columns. I will use this cleaned dataset for the remaining analysis.

4.3.3.3 Select Relevant Columns

I will select the columns needed for sentiment analysis and convert the publication date into a date format. I will exclude the existing sentiment labels and polarity scores because I will calculate my own sentiment scores.

sephora_clean <- sephora_clean %>%
  select(review_id, date_published, rating_value,
         full_review, name, brand, category) %>%
  mutate(date_published = as.Date(date_published))

glimpse(sephora_clean)
Rows: 18,556
Columns: 7
$ review_id      <int> 351645103, 349938731, 348900301, 347053222, 346825636, …
$ date_published <date> 2025-07-10, 2025-06-17, 2025-06-08, 2025-05-24, 2025-0…
$ rating_value   <dbl> 3, 5, 5, 4, 3, 4, 5, 1, 1, 3, 4, 2, 4, 5, 5, 5, 5, 4, 2…
$ full_review    <chr> "This lip balm is a miss for me It’s much thinner than …
$ name           <chr> "Plumping & Softening Sweet Agave Lip Balm Treatment", …
$ brand          <chr> "ALPYN", "ALPYN", "ALPYN", "ALPYN", "ALPYN", "ALPYN", "…
$ category       <chr> "lip-balm-lip-care", "lip-balm-lip-care", "lip-balm-lip…

The cleaned dataset contains 18,556 unique customer reviews and seven relevant columns. The publication date was successfully converted to a date format. The dataset is now ready for text processing and sentiment analysis.

4.3.3.4 Normalize Text Characters

I will standardize special punctuation characters and convert the review text to lowercase using English language rules. This step will help improve word matching with sentiment lexicons.

sephora_clean <- sephora_clean %>%
  mutate(
    full_review = str_replace_all(full_review, "[\u2018\u2019]", "'"),
    full_review = str_replace_all(full_review, "[\u201C\u201D]", '"'),
    full_review = str_replace_all(full_review, "\u2026", "..."),
    full_review = str_to_lower(full_review, locale = "en")
  )

head(sephora_clean$full_review, 3)
[1] "this lip balm is a miss for me it's much thinner than i thought it would be and the hydration doesn't last very long. the flavor/scent also makes me feel nauseous but that is just my opinion. i loveeeee alpyn's other products but this just isn't for me."                                                                                                                                                                                                    
[2] "consistency is a great mix between a balm and an oil! my issue with a lot of the new \"lip oil\" products is that its not an oil but a gloss and i hate when something is too sticky and thick. this moisturizes my lips more than a traditional oil but just the same as a regular balm. though i would say its not a real plumper, and because its hydrating it may give that illusion but if you want something like the too faced lip maximizer this isnt it."
[3] "as someone who never writes reviews, i had to for this product! it is absolutely amazing. moisturizes my lips so well and stays on for hours. it has become my go to lip product!"                                                                                                                                                                                                                                                                                

4.3.4 Tokenize the Reviews

I will use the unnest_tokens() function to convert the customer reviews into a tidy text format. Each row will represent a single word from a customer review. This format will allow me to match individual words with different sentiment lexicons.

sephora_words <- sephora_clean %>%
  unnest_tokens(word, full_review, to_lower = FALSE)

dim(sephora_words)
[1] 1021828       7
head(sephora_words, 10)
   review_id date_published rating_value
1  351645103     2025-07-10            3
2  351645103     2025-07-10            3
3  351645103     2025-07-10            3
4  351645103     2025-07-10            3
5  351645103     2025-07-10            3
6  351645103     2025-07-10            3
7  351645103     2025-07-10            3
8  351645103     2025-07-10            3
9  351645103     2025-07-10            3
10 351645103     2025-07-10            3
                                                  name brand          category
1  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
2  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
3  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
4  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
5  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
6  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
7  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
8  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
9  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
10 Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
   word
1  this
2   lip
3  balm
4    is
5     a
6  miss
7   for
8    me
9  it's
10 much

4.3.5 Sentiment Analysis Using Bing

4.3.5.1 Identify Positive and Negative Words

I will use the Bing sentiment lexicon to classify words as positive or negative. As in the original example, I will use the inner_join() function to match words in Sephora customer reviews with the Bing lexicon.

sephora_bing <- sephora_words %>%
  inner_join(get_sentiments("bing"),
             by = "word",
             relationship = "many-to-many")

dim(sephora_bing)
[1] 111564      8
head(sephora_bing, 10)
   review_id date_published rating_value
1  351645103     2025-07-10            3
2  351645103     2025-07-10            3
3  349938731     2025-06-17            5
4  349938731     2025-06-17            5
5  349938731     2025-06-17            5
6  349938731     2025-06-17            5
7  349938731     2025-06-17            5
8  349938731     2025-06-17            5
9  348900301     2025-06-08            5
10 348900301     2025-06-08            5
                                                  name brand          category
1  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
2  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
3  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
4  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
5  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
6  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
7  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
8  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
9  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
10 Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
       word sentiment
1      miss  negative
2   thinner  positive
3     great  positive
4     issue  negative
5      hate  negative
6    sticky  negative
7  illusion  negative
8      like  positive
9   amazing  positive
10     well  positive

The Bing lexicon successfully classified words from Sephora customer reviews as positive or negative. Words such as “great,” “like,” and “amazing” are classified as positive, while “miss,” “hate,” and “sticky” are classified as negative. However, some words, such as “thinner,” are classified as positive even though they may express dissatisfaction in a skincare review. This shows that word meaning and context are important in sentiment analysis.

4.3.5.2 Examine and Visualize Sentiment Distribution

I will count the positive and negative words and calculate their percentages to examine the overall sentiment distribution in Sephora customer reviews.

bing_summary <- sephora_bing %>%
  count(sentiment) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

bing_summary
  sentiment     n percentage
1  negative 29991      26.88
2  positive 81573      73.12

I will create a bar chart to compare the number and percentage of positive and negative words identified by the Bing lexicon.

ggplot(bing_summary, aes(x = sentiment, y = n, fill = sentiment)) +
  geom_col(show.legend = FALSE, width = 0.6) +
  geom_text(aes(label = paste0(scales::comma(n),
                               "\n(", percentage, "%)")),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("negative" = "tomato",
                               "positive" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Sentiment Distribution Using Bing",
       x = "Sentiment",
       y = "Number of Words") +
  theme_minimal()

The Bing lexicon identified a total of 111,564 sentiment-related word occurrences. Positive words account for 73.12% (81,573), while negative words account for 26.88% (29,991). Positive words occur approximately 2.7 times more often than negative words. These results suggest that customers generally use positive language when describing skincare products. However, these percentages represent word frequencies rather than the percentage of positive or negative reviews.

4.3.5.3 Calculate Net Sentiment per Review

I will calculate a net sentiment score for each customer review by subtracting the number of negative words from the number of positive words.
- Positive score: Positive sentiment
- Negative score: Negative sentiment
- Zero score: Neutral sentiment

bing_review_scores <- sephora_bing %>%
  count(review_id, sentiment) %>%
  pivot_wider(names_from = sentiment,
              values_from = n,
              values_fill = 0) %>%
  right_join(
    sephora_clean %>% select(review_id, rating_value),
    by = "review_id"
  ) %>%
  mutate(
    positive = replace_na(positive, 0),
    negative = replace_na(negative, 0),
    net_sentiment = positive - negative,
    sentiment_class = case_when(
      net_sentiment > 0 ~ "Positive",
      net_sentiment < 0 ~ "Negative",
      TRUE ~ "Neutral"
    )
  )

head(bing_review_scores, 10)
# A tibble: 10 × 6
   review_id positive negative rating_value net_sentiment sentiment_class
       <int>    <int>    <int>        <dbl>         <int> <chr>          
 1   9176823        8        0            5             8 Positive       
 2  12187279        2        4            4            -2 Negative       
 3  21967962        5        3            5             2 Positive       
 4  28066987       11        4            5             7 Positive       
 5  29721846        8        1            5             7 Positive       
 6  32722078        1        0            5             1 Positive       
 7  53640081        6        0            5             6 Positive       
 8  56803865        2        0            5             2 Positive       
 9  59420073        3        1            1             2 Positive       
10  69781119        1        0            5             1 Positive       

The net sentiment scores show the difference between positive and negative word counts in each review. For example, a review with eight positive words and no negative words has a net sentiment score of 8. However, some sentiment scores do not match customer ratings. One review with a four-star rating has a negative sentiment score of -2, while another review with a one-star rating has a positive sentiment score of 2. These examples show that the Bing lexicon may not always capture the actual meaning of customer reviews.

4.3.5.4 Visualize Review-Level Sentiment

I will calculate the number and percentage of positive, negative, and neutral reviews based on their net sentiment scores. I will also create a bar chart to visualize the sentiment distribution at the review level.

bing_review_summary <- bing_review_scores %>%
  count(sentiment_class) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

bing_review_summary
# A tibble: 3 × 3
  sentiment_class     n percentage
  <chr>           <int>      <dbl>
1 Negative         2756      14.8 
2 Neutral          1820       9.81
3 Positive        13980      75.3 
ggplot(bing_review_summary,
       aes(x = sentiment_class, y = n, fill = sentiment_class)) +
  geom_col(show.legend = FALSE, width = 0.6) +
  geom_text(aes(label = paste0(scales::comma(n),
                               "\n(", percentage, "%)")),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("Negative" = "tomato",
                               "Neutral" = "gray60",
                               "Positive" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Review-Level Sentiment Distribution Using Bing",
       x = "Sentiment",
       y = "Number of Reviews") +
  theme_minimal()

The Bing lexicon classified 75.34% (13,980) of customer reviews as positive, 14.85% (2,756) as negative, and 9.81% (1,820) as neutral. These results suggest that most customers express positive opinions about Sephora skincare products. This finding is also consistent with the previous word-level analysis, where positive words were more common than negative words.

4.3.6 Sentiment Analysis Using AFINN

4.3.6.1 Assign Sentiment Scores to Words

I will use the AFINN sentiment lexicon to assign numerical sentiment scores to words in Sephora customer reviews. Unlike the Bing lexicon, AFINN measures both the direction and intensity of sentiment.

sephora_afinn <- sephora_words %>%
  inner_join(get_sentiments("afinn"),
             by = "word",
             relationship = "many-to-many")

dim(sephora_afinn)
[1] 82136     8
head(sephora_afinn, 10)
   review_id date_published rating_value
1  351645103     2025-07-10            3
2  349938731     2025-06-17            5
3  349938731     2025-06-17            5
4  349938731     2025-06-17            5
5  349938731     2025-06-17            5
6  348900301     2025-06-08            5
7  347053222     2025-05-24            4
8  347053222     2025-05-24            4
9  347053222     2025-05-24            4
10 347053222     2025-05-24            4
                                                  name brand          category
1  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
2  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
3  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
4  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
5  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
6  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
7  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
8  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
9  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
10 Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
       word value
1      miss    -2
2     great     3
3      hate    -3
4      want     1
5      like     2
6   amazing     4
7   amazing     4
8     lucky     3
9  favorite     2
10     like     2

The AFINN lexicon assigned numerical sentiment scores to words in Sephora customer reviews. For example, “hate” has a score of -3, while “miss” has a score of -2. Positive words such as “like,” “great,” and “amazing” have scores of 2, 3, and 4, respectively. Unlike the Bing lexicon, AFINN captures different levels of sentiment intensity. This provides a more detailed understanding of the emotional language used in customer reviews.

4.3.6.2 Examine and Visualize Sentiment Scores

I will examine the frequency and percentage of each AFINN sentiment score to understand the distribution of positive and negative sentiment in customer reviews.

afinn_summary <- sephora_afinn %>%
  count(value) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

afinn_summary
  value     n percentage
1    -4     8       0.01
2    -3  4001       4.87
3    -2  6618       8.06
4    -1  6242       7.60
5     1 10829      13.18
6     2 26037      31.70
7     3 25214      30.70
8     4  3149       3.83
9     5    38       0.05

I will create a bar chart to visualize the frequency of each sentiment score. Negative scores will be shown in red, and positive scores will be shown in green.

ggplot(afinn_summary,
       aes(x = factor(value), y = n, fill = value > 0)) +
  geom_col(show.legend = FALSE, width = 0.7) +
  geom_text(aes(label = scales::comma(n)),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("FALSE" = "tomato",
                               "TRUE" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Sentiment Score Distribution Using AFINN",
       x = "Sentiment Score",
       y = "Number of Words") +
  theme_minimal()

The results show that positive sentiment scores are more common than negative scores. The most frequent sentiment score is +2 (31.70%), followed by +3 (30.70%). Among negative scores, -2 is the most common (8.06%). Extremely positive (+5) and extremely negative (-4) scores are very rare. These results suggest that customers frequently use moderately positive language when describing skincare products. This finding is also consistent with the Bing sentiment analysis.

4.3.6.3 Calculate Net Sentiment per Review

I will calculate the net sentiment score for each customer review by adding the AFINN scores of individual words. Based on the total score, I will classify each review as positive, negative, or neutral.

afinn_review_scores <- sephora_afinn %>%
  group_by(review_id) %>%
  summarise(net_sentiment = sum(value), .groups = "drop") %>%
  right_join(
    sephora_clean %>% select(review_id, rating_value),
    by = "review_id"
  ) %>%
  mutate(
    net_sentiment = replace_na(net_sentiment, 0),
    sentiment_class = case_when(
      net_sentiment > 0 ~ "Positive",
      net_sentiment < 0 ~ "Negative",
      TRUE ~ "Neutral"
    )
  )

head(afinn_review_scores, 10)
# A tibble: 10 × 4
   review_id net_sentiment rating_value sentiment_class
       <int>         <dbl>        <dbl> <chr>          
 1   9176823            15            5 Positive       
 2  12187279             3            4 Positive       
 3  21967962            10            5 Positive       
 4  28066987            10            5 Positive       
 5  29721846            15            5 Positive       
 6  32722078             3            5 Positive       
 7  53640081            16            5 Positive       
 8  56803865             6            5 Positive       
 9  59420073             4            1 Positive       
10  69781119             2            5 Positive       

The net sentiment scores show the overall sentiment intensity of each customer review. For example, a five-star review has a net sentiment score of 15, indicating strong positive sentiment. However, a one-star review has a positive sentiment score of 4. Also, review 12187279 was classified as negative by Bing but positive by AFINN. These differences show that different sentiment lexicons can produce different results for the same review.

4.3.6.4 Visualize Review-Level Sentiment

I will calculate the number and percentage of positive, negative, and neutral reviews based on their AFINN sentiment scores. I will also visualize the results using a bar chart.

afinn_review_summary <- afinn_review_scores %>%
  count(sentiment_class) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

afinn_review_summary
# A tibble: 3 × 3
  sentiment_class     n percentage
  <chr>           <int>      <dbl>
1 Negative         2063      11.1 
2 Neutral          1140       6.14
3 Positive        15353      82.7 
ggplot(afinn_review_summary,
       aes(x = sentiment_class, y = n, fill = sentiment_class)) +
  geom_col(show.legend = FALSE, width = 0.6) +
  geom_text(aes(label = paste0(scales::comma(n),
                               "\n(", percentage, "%)")),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("Negative" = "tomato",
                               "Neutral" = "gray60",
                               "Positive" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Review-Level Sentiment Distribution Using AFINN",
       x = "Sentiment",
       y = "Number of Reviews") +
  theme_minimal()

The AFINN lexicon classified 82.74% (15,353) of customer reviews as positive, 11.12% (2,063) as negative, and 6.14% (1,140) as neutral. Compared to Bing, AFINN classified more reviews as positive and fewer reviews as negative or neutral. However, both lexicons show that positive sentiment is dominant in Sephora customer reviews.

4.3.7 Sentiment Analysis Using NRC

4.3.7.1 Identify Sentiment and Emotion Categories

I will use the NRC sentiment lexicon to identify different emotions in Sephora customer reviews. Unlike Bing and AFINN, NRC provides more detailed emotion categories in addition to positive and negative sentiment.

sephora_nrc <- sephora_words %>%
  inner_join(get_sentiments("nrc"),
             by = "word",
             relationship = "many-to-many")

dim(sephora_nrc)
[1] 239910      8
head(sephora_nrc, 10)
   review_id date_published rating_value
1  351645103     2025-07-10            3
2  351645103     2025-07-10            3
3  351645103     2025-07-10            3
4  351645103     2025-07-10            3
5  351645103     2025-07-10            3
6  351645103     2025-07-10            3
7  351645103     2025-07-10            3
8  351645103     2025-07-10            3
9  351645103     2025-07-10            3
10 349938731     2025-06-17            5
                                                  name brand          category
1  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
2  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
3  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
4  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
5  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
6  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
7  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
8  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
9  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
10 Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
          word    sentiment
1         balm anticipation
2         balm          joy
3         balm     negative
4         balm     positive
5      thought anticipation
6         long anticipation
7     nauseous      disgust
8     nauseous     negative
9     nauseous      sadness
10 consistency     positive

The NRC lexicon successfully matched words in Sephora customer reviews with different sentiment and emotion categories. For example, the word “balm” is associated with anticipation, joy, negative, and positive sentiments. The word “nauseous” is associated with disgust, negative sentiment, and sadness. These examples show that a single word can belong to multiple emotion categories. Unlike Bing and AFINN, NRC allows us to explore a wider range of emotions in customer reviews.

4.3.7.2 Examine and Visualize Emotion Distribution

I will calculate the frequency and percentage of each sentiment and emotion category to identify the most common emotions in customer reviews.

nrc_summary <- sephora_nrc %>%
  count(sentiment, sort = TRUE) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

nrc_summary
      sentiment     n percentage
1      positive 61622      25.69
2           joy 33625      14.02
3         trust 31269      13.03
4  anticipation 26045      10.86
5      negative 23364       9.74
6       disgust 14535       6.06
7      surprise 14247       5.94
8         anger 12632       5.27
9       sadness 12162       5.07
10         fear 10409       4.34

I will create a bar chart to compare the frequency of sentiment and emotion categories identified by the NRC lexicon.

ggplot(nrc_summary,
       aes(x = n, y = reorder(sentiment, n),
           fill = sentiment)) +
  geom_col(show.legend = FALSE) +
  geom_text(aes(label = scales::comma(n)),
            hjust = -0.2, size = 3.5) +
  scale_x_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Sentiment and Emotion Distribution Using NRC",
       x = "Word Frequency",
       y = "Sentiment and Emotion") +
  theme_minimal()

Positive sentiment is the most frequent category, with 61,622 occurrences (25.69%), while negative sentiment accounts for 23,364 occurrences (9.74%). Among the eight emotion categories, joy (14.02%), trust (13.03%), and anticipation (10.86%) are the most common. Fear (4.34%) is the least common emotion. These results suggest that positive emotions are more common in Sephora customer reviews. This finding is consistent with the Bing and AFINN analyses.

4.3.7.3 Calculate Net Sentiment per Review

I will calculate a net sentiment score for each customer review using the positive and negative categories of the NRC lexicon. The other eight emotion categories will not be included in this calculation.

nrc_review_scores <- sephora_nrc %>%
  filter(sentiment %in% c("positive", "negative")) %>%
  count(review_id, sentiment) %>%
  pivot_wider(names_from = sentiment,
              values_from = n,
              values_fill = 0) %>%
  right_join(
    sephora_clean %>% select(review_id, rating_value),
    by = "review_id"
  ) %>%
  mutate(
    positive = replace_na(positive, 0),
    negative = replace_na(negative, 0),
    net_sentiment = positive - negative,
    sentiment_class = case_when(
      net_sentiment > 0 ~ "Positive",
      net_sentiment < 0 ~ "Negative",
      TRUE ~ "Neutral"
    )
  )

head(nrc_review_scores, 10)
# A tibble: 10 × 6
   review_id positive negative rating_value net_sentiment sentiment_class
       <int>    <int>    <int>        <dbl>         <int> <chr>          
 1   9176823        7        0            5             7 Positive       
 2  12187279        1        4            4            -3 Negative       
 3  21967962        8        5            5             3 Positive       
 4  28066987        4        1            5             3 Positive       
 5  29721846        5        0            5             5 Positive       
 6  53640081        1        0            5             1 Positive       
 7  56803865        1        0            5             1 Positive       
 8  59420073        2        0            1             2 Positive       
 9  69781119        1        0            5             1 Positive       
10  84176948        0        2            4            -2 Negative       

The NRC lexicon classified customer reviews based on the difference between positive and negative word counts. For example, review 9176823 has seven positive words and no negative words, resulting in a net sentiment score of 7. Review 12187279 was classified as negative by both Bing and NRC but positive by AFINN. Additionally, a one-star review received a positive sentiment score of 2. These results show that different lexicons may produce different sentiment classifications for the same review.

4.3.7.4 Visualize Review-Level Sentiment

I will calculate the number and percentage of positive, negative, and neutral reviews based on NRC sentiment scores. I will also create a bar chart to visualize the results.

nrc_review_summary <- nrc_review_scores %>%
  count(sentiment_class) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

nrc_review_summary
# A tibble: 3 × 3
  sentiment_class     n percentage
  <chr>           <int>      <dbl>
1 Negative         2709       14.6
2 Neutral          2844       15.3
3 Positive        13003       70.1
ggplot(nrc_review_summary,
       aes(x = sentiment_class, y = n, fill = sentiment_class)) +
  geom_col(show.legend = FALSE, width = 0.6) +
  geom_text(aes(label = paste0(scales::comma(n),
                               "\n(", percentage, "%)")),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("Negative" = "tomato",
                               "Neutral" = "gray60",
                               "Positive" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Review-Level Sentiment Distribution Using NRC",
       x = "Sentiment",
       y = "Number of Reviews") +
  theme_minimal()

The NRC lexicon classified 70.07% (13,003) of customer reviews as positive, 14.60% (2,709) as negative, and 15.33% (2,844) as neutral. Compared to Bing and AFINN, NRC classified fewer reviews as positive and more reviews as neutral. However, all three lexicons show that positive sentiment is dominant in Sephora customer reviews.

4.3.8 Sentiment Analysis Using SentiWordNet

4.3.8.1 Load the SentiWordNet Lexicon

I will use SentiWordNet as an additional sentiment lexicon to extend the original analysis. SentiWordNet provides numerical sentiment scores that indicate the direction and intensity of sentiment. I will compare its results with those of Bing, AFINN, and NRC to understand how different lexicons classify customer reviews.

sentiwordnet <- lexicon::hash_sentiment_sentiword

dim(sentiwordnet)
[1] 20093     2
head(sentiwordnet, 10)
Key: <x>
               x       y
          <char>   <num>
 1:     365 days -0.5000
 2:     366 days  0.2500
 3:          3tc -0.2500
 4:   a fortiori  0.2500
 5:  a good deal  0.2500
 6: a great deal  0.3125
 7:        a lot  0.2500
 8:        a one  0.6250
 9: a posteriori  0.1250
10:     a priori  0.2500
colnames(sentiwordnet)
[1] "x" "y"
summary(sentiwordnet)
         x               y           
 Length   :20093   Min.   :-1.00000  
 N.unique :20093   1st Qu.:-0.25000  
 N.blank  :    0   Median :-0.12500  
 Min.nchar:    2   Mean   :-0.06174  
 Max.nchar:   29   3rd Qu.: 0.25000  
                   Max.   : 1.00000  

The SentiWordNet lexicon contains 20,093 unique entries and two columns. The first column (x) contains words and phrases, while the second column (y) contains numerical sentiment scores ranging from -1 to +1. Negative values represent negative sentiment, and positive values represent positive sentiment. Unlike AFINN, SentiWordNet uses decimal values to represent sentiment intensity.

4.3.8.2 Prepare the SentiWordNet Lexicon

I will rename the columns and keep only single-word entries in the SentiWordNet lexicon. This will make the lexicon compatible with the tokenized customer reviews.

sentiwordnet_clean <- sentiwordnet %>%
  as_tibble() %>%
  rename(word = x, value = y) %>%
  filter(!str_detect(word, "\\s"))

dim(sentiwordnet_clean)
[1] 14503     2
head(sentiwordnet_clean, 10)
# A tibble: 10 × 2
   word          value
   <chr>         <dbl>
 1 3tc         -0.25  
 2 aaa          0.125 
 3 abandon     -0.25  
 4 abandonment -0.5   
 5 abasement    0.0625
 6 abashment   -0.375 
 7 abasia      -0.5   
 8 abasic      -0.25  
 9 abate       -0.25  
10 abatement   -0.125 

After removing multi-word phrases, the SentiWordNet lexicon contains 14,503 single-word entries, compared to the original 20,093 entries. A total of 5,590 entries (27.82%) were removed. The remaining words and their sentiment scores are ready to be matched with the tokenized Sephora customer reviews.

4.3.8.3 Assign Sentiment Scores to Words

I will match words in Sephora customer reviews with the SentiWordNet lexicon to assign numerical sentiment scores to individual words.

sephora_sentiwordnet <- sephora_words %>%
  inner_join(sentiwordnet_clean,
             by = "word",
             relationship = "many-to-many")

dim(sephora_sentiwordnet)
[1] 253267      8
head(sephora_sentiwordnet, 10)
   review_id date_published rating_value
1  351645103     2025-07-10            3
2  351645103     2025-07-10            3
3  351645103     2025-07-10            3
4  351645103     2025-07-10            3
5  351645103     2025-07-10            3
6  351645103     2025-07-10            3
7  351645103     2025-07-10            3
8  351645103     2025-07-10            3
9  351645103     2025-07-10            3
10 349938731     2025-06-17            5
                                                  name brand          category
1  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
2  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
3  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
4  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
5  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
6  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
7  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
8  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
9  Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
10 Plumping & Softening Sweet Agave Lip Balm Treatment ALPYN lip-balm-lip-care
          word      value
1         miss -0.2500000
2         last -0.2083333
3         long  0.1250000
4        scent -0.0625000
5         feel  0.1250000
6     nauseous -0.5000000
7         just  0.1562500
8      opinion -0.5000000
9         just  0.1562500
10 consistency  0.1250000

The SentiWordNet lexicon matched 253,267 word occurrences, representing approximately 24.79% of all word tokens in the dataset. For example, “nauseous” received a negative score of -0.50, while “feel” and “consistency” received positive scores of 0.125. However, common words such as “just,” “opinion,” and “scent” also received sentiment scores, even though they may be neutral in customer reviews. This shows that SentiWordNet has broad vocabulary coverage, but it may not always capture the meaning of words in the skincare context.

4.3.8.4 Examine and Visualize Sentiment Distribution

I will classify the matched words as positive, negative, or neutral based on their numerical sentiment scores. Then, I will calculate the frequency and percentage of each sentiment category.

sentiwordnet_summary <- sephora_sentiwordnet %>%
  mutate(sentiment = case_when(
    value > 0 ~ "positive",
    value < 0 ~ "negative",
    TRUE ~ "neutral"
  )) %>%
  count(sentiment) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

sentiwordnet_summary
  sentiment      n percentage
1  negative 101318      40.00
2   neutral   3723       1.47
3  positive 148226      58.53

I will create a bar chart to compare the frequency and percentage of positive, negative, and neutral words identified by SentiWordNet.

ggplot(sentiwordnet_summary,
       aes(x = sentiment, y = n, fill = sentiment)) +
  geom_col(show.legend = FALSE, width = 0.6) +
  geom_text(aes(label = paste0(scales::comma(n),
                               "\n(", percentage, "%)")),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("negative" = "tomato",
                               "neutral" = "gray60",
                               "positive" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Sentiment Distribution Using SentiWordNet",
       x = "Sentiment",
       y = "Number of Words") +
  theme_minimal()

The SentiWordNet lexicon classified 58.53% (148,226) of matched word occurrences as positive, 40.00% (101,318) as negative, and 1.47% (3,723) as neutral. Although positive words are more common, SentiWordNet identified a higher percentage of negative words than Bing and AFINN. These differences may be related to its larger vocabulary and different scoring method.

4.3.8.5 Calculate Net Sentiment per Review

I will calculate the net sentiment score for each customer review by adding the SentiWordNet scores of individual words. Based on the total score, I will classify each review as positive, negative, or neutral.

sentiwordnet_review_scores <- sephora_sentiwordnet %>%
  group_by(review_id) %>%
  summarise(net_sentiment = sum(value), .groups = "drop") %>%
  right_join(
    sephora_clean %>% select(review_id, rating_value),
    by = "review_id"
  ) %>%
  mutate(
    net_sentiment = round(replace_na(net_sentiment, 0), 10),
    sentiment_class = case_when(
      net_sentiment > 0 ~ "Positive",
      net_sentiment < 0 ~ "Negative",
      TRUE ~ "Neutral"
    )
  )

head(sentiwordnet_review_scores, 10)
# A tibble: 10 × 4
   review_id net_sentiment rating_value sentiment_class
       <int>         <dbl>        <dbl> <chr>          
 1   9176823         0.906            5 Positive       
 2  12187279        -2.47             4 Negative       
 3  21967962        -0.315            5 Negative       
 4  28066987         0.403            5 Positive       
 5  29721846         1.75             5 Positive       
 6  32722078         1.06             5 Positive       
 7  53640081         2.53             5 Positive       
 8  56803865        -0.125            5 Negative       
 9  59420073         0.271            1 Positive       
10  84176948         1.33             4 Positive       

The SentiWordNet lexicon produced both positive and negative sentiment scores for customer reviews. For example, review 53640081 has a positive sentiment score of 2.53 and a five-star rating. However, reviews 21967962 and 56803865 received negative sentiment scores despite having five-star ratings. Both reviews were classified as positive by Bing, AFINN, and NRC. These differences show that the vocabulary and scoring methods of different lexicons can affect sentiment classification.

4.3.8.6 Visualize Review-Level Sentiment

I will calculate the number and percentage of positive, negative, and neutral reviews based on SentiWordNet sentiment scores. I will also create a bar chart to visualize the results.

sentiwordnet_review_summary <- sentiwordnet_review_scores %>%
  count(sentiment_class) %>%
  mutate(percentage = round(n / sum(n) * 100, 2))

sentiwordnet_review_summary
# A tibble: 3 × 3
  sentiment_class     n percentage
  <chr>           <int>      <dbl>
1 Negative         6222       33.5
2 Neutral           149        0.8
3 Positive        12185       65.7
ggplot(sentiwordnet_review_summary,
       aes(x = sentiment_class, y = n, fill = sentiment_class)) +
  geom_col(show.legend = FALSE, width = 0.6) +
  geom_text(aes(label = paste0(scales::comma(n),
                               "\n(", percentage, "%)")),
            vjust = -0.5, size = 3.5) +
  scale_fill_manual(values = c("Negative" = "tomato",
                               "Neutral" = "gray60",
                               "Positive" = "seagreen")) +
  scale_y_continuous(
    labels = scales::comma,
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Review-Level Sentiment Distribution Using SentiWordNet",
       x = "Sentiment",
       y = "Number of Reviews") +
  theme_minimal()

The SentiWordNet lexicon classified 65.67% (12,185) of customer reviews as positive, 33.53% (6,222) as negative, and 0.80% (149) as neutral. Compared to the other three lexicons, SentiWordNet classified the highest percentage of reviews as negative and the lowest percentage as neutral. These differences may be related to its broader vocabulary and numerical scoring method. However, positive sentiment remains the most common category across all four lexicons.

4.3.9 Comparison of Sentiment Lexicons

I will combine the sentiment analysis results from Bing, AFINN, NRC, and SentiWordNet into a single dataset. This will help me compare how each lexicon classifies the same customer reviews.

lexicon_comparison <- bind_rows(
  bing_review_summary %>% mutate(lexicon = "Bing"),
  afinn_review_summary %>% mutate(lexicon = "AFINN"),
  nrc_review_summary %>% mutate(lexicon = "NRC"),
  sentiwordnet_review_summary %>% mutate(lexicon = "SentiWordNet")
) %>%
  select(lexicon, sentiment_class, n, percentage)

print(lexicon_comparison, n = Inf)
# A tibble: 12 × 4
   lexicon      sentiment_class     n percentage
   <chr>        <chr>           <int>      <dbl>
 1 Bing         Negative         2756      14.8 
 2 Bing         Neutral          1820       9.81
 3 Bing         Positive        13980      75.3 
 4 AFINN        Negative         2063      11.1 
 5 AFINN        Neutral          1140       6.14
 6 AFINN        Positive        15353      82.7 
 7 NRC          Negative         2709      14.6 
 8 NRC          Neutral          2844      15.3 
 9 NRC          Positive        13003      70.1 
10 SentiWordNet Negative         6222      33.5 
11 SentiWordNet Neutral           149       0.8 
12 SentiWordNet Positive        12185      65.7 

I will create a grouped bar chart to compare the percentage of positive, negative, and neutral reviews across the four sentiment lexicons.

ggplot(lexicon_comparison,
       aes(x = lexicon, y = percentage,
           fill = sentiment_class)) +
  geom_col(position = position_dodge(width = 0.8),
           width = 0.7) +
  geom_text(aes(label = paste0(percentage, "%")),
            position = position_dodge(width = 0.8),
            vjust = -0.5, size = 3) +
  scale_fill_manual(values = c("Negative" = "tomato",
                               "Neutral" = "gray60",
                               "Positive" = "seagreen")) +
  scale_y_continuous(
    expand = expansion(mult = c(0, 0.15))
  ) +
  labs(title = "Comparison of Four Sentiment Lexicons",
       x = "Sentiment Lexicon",
       y = "Percentage of Reviews (%)",
       fill = "Sentiment") +
  theme_minimal()

All four sentiment lexicons classified most customer reviews as positive. AFINN has the highest percentage of positive reviews (82.74%), while SentiWordNet has the lowest (65.67%). SentiWordNet also has the highest percentage of negative reviews (33.53%), while NRC has the highest percentage of neutral reviews (15.33%). These differences show that vocabulary coverage and scoring methods can affect sentiment analysis results, even when the same dataset is used.

4.3.10 Comparison with the Original Example

The original example in Chapter 2 of Text Mining with R uses Jane Austen???s novels to explore sentiment in literary texts. In this study, I used Sephora skincare reviews to explore sentiment in customer feedback.

Feature Original Example Extended Analysis
Dataset Jane Austen???s novels Sephora skincare reviews
Text type Literary text Customer reviews
Sentiment lexicons Bing, AFINN, NRC Bing, AFINN, NRC, SentiWordNet
Analysis level Words, text sections, and chapters Words and individual reviews
Main purpose Understand sentiment in literary texts Understand customer opinions

Both analyses use similar text mining techniques, such as tokenization, sentiment classification, word frequency analysis, and visualization. However, the original example examines how sentiment changes throughout novels, while the extended analysis examines the distribution of positive, negative, and neutral customer reviews.

I also introduced SentiWordNet as an additional sentiment lexicon. All four lexicons classified most customer reviews as positive. However, AFINN identified the highest percentage of positive reviews, while SentiWordNet identified the highest percentage of negative reviews.

Both analyses show that different sentiment lexicons can produce different results for the same text. These differences highlight the importance of vocabulary coverage, scoring methods, and text context in sentiment analysis.

5. Conclusion

In this study, I reproduced the sentiment analysis examples from Chapter 2 of Text Mining with R and extended the original analysis using a different text dataset and an additional sentiment lexicon.

After data cleaning, I analyzed 18,556 Sephora customer reviews using Bing, AFINN, NRC, and SentiWordNet. All four lexicons classified most customer reviews as positive. However, AFINN identified the highest percentage of positive reviews (82.74%), while SentiWordNet identified the highest percentage of negative reviews (33.53%). NRC identified the highest percentage of neutral reviews (15.33%).

The original analysis focused on sentiment changes throughout Jane Austen’s novels, while my analysis focused on customer opinions about skincare products. Adding SentiWordNet showed how differences in vocabulary coverage and scoring methods can affect sentiment classification.

One limitation of this study is that lexicon-based methods may not fully understand context, negation, sarcasm, or skincare-specific terms.

Overall, this study shows that sentiment analysis can be applied to different types of text data and that the choice of sentiment lexicon can significantly affect the results.

6. References & Citation

Silge, J., & Robinson, D. (2017). Text Mining with R: A Tidy Approach. O’Reilly Media.
https://www.tidytextmining.com/sentiment

Messier, N. Sephora Skincare Reviews and Sentiment. Kaggle.
https://www.kaggle.com/datasets/natashamessier/sephora-skincare-reviews-and-sentiment

I used ChatGPT (GPT-5.6 Luna), developed by OpenAI, to help me understand some of the functions I used in this assignment and to check my work.

OpenAI. (2026). ChatGPT (GPT-5.6 Luna) [Large language model]. [https://chatgpt.com/ Accessed November 15, 2026].