AI assisted me in writing code to import and clean the BlueSky data, count terms that appear frequently, perform sentiment analysis on the Bing lexicon, and create a Plotly chart. Nine of the 299 records in the dataset had blank post content, leaving 290 postings. The most common phrases were “amazon” (275), “delivery” (170), and “uk” (82) after I eliminated URLs. 159 positive and 149 negative word occurrences were discovered using the sentiment analysis.

Examining cases revealed the limitations of AI-assisted analysis. I changed the cleaning code to eliminate URLs because my initial word count included “www” from links. Additionally, I looked at five examples—five positive and five negative. Words like “fast” described a tale, “beautiful” appeared in a movie title, and “crime” identified a kind of film. This demonstrated to me that a dictionary can overlook context and that the posts contain amusement and advertisements. I was able to verify the code, determine whether postings were pertinent, and refrain from using word counts as evidence that the majority of posts or customers were satisfied with Amazon shipping thanks to human judgment.

library(readxl)
bluesky <- read_excel("Amazon_Delivery_SCRAPE 2 EXCEL.xlsx", skip = 1)
library(readxl)

bluesky <- read_excel("Amazon_Delivery_SCRAPE 2 EXCEL.xlsx", skip = 1)

names(bluesky)
## [1] "text"             "author_handle"    "timestamp"        "like_count"      
## [5] "repost_count"     "reply_count"      "engagement"       "keyword"         
## [9] "collected_at_utc"
dim(bluesky)
## [1] 299   9
bluesky_clean <- bluesky
bluesky_clean$text <- trimws(gsub("[[:space:]]+", " ", bluesky_clean$text))
bluesky_clean <- bluesky_clean[
  !is.na(bluesky_clean$text) & bluesky_clean$text != "", ]

nrow(bluesky_clean)
## [1] 290
sum(is.na(bluesky_clean$text))
## [1] 0

I removed nine records with missing or blank post text and standardized spacing. The cleaned dataset contains 290 posts.

library(tidytext)
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
word_counts <- bluesky_clean |>
  mutate(text_for_words = gsub(
    "(https?://|www\\.)\\S+", " ", text,
    ignore.case = TRUE, perl = TRUE
  )) |>
  unnest_tokens(word, text_for_words) |>
  anti_join(stop_words, by = "word") |>
  count(word, sort = TRUE)

print(head(word_counts, 10))
## # A tibble: 10 × 2
##    word         n
##    <chr>    <int>
##  1 amazon     275
##  2 delivery   170
##  3 uk          82
##  4 ad          80
##  5 price       78
##  6 save        78
##  7 blu         75
##  8 cast        75
##  9 imdb        75
## 10 ray         75
library(tidytext)
library(dplyr)

sentiment_words <- bluesky_clean |>
  mutate(post_id = row_number(),
         analysis_text = gsub(
           "(https?://|www\\.)\\S+", " ", text,
           ignore.case = TRUE, perl = TRUE
         )) |>
  select(post_id, analysis_text) |>
  unnest_tokens(word, analysis_text) |>
  inner_join(get_sentiments("bing"), by = "word")

sentiment_counts <- sentiment_words |>
  count(sentiment, name = "word_count")

print(sentiment_counts)
## # A tibble: 2 × 2
##   sentiment word_count
##   <chr>          <int>
## 1 negative         149
## 2 positive         159
library(plotly)
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
plot_ly(
  data = sentiment_counts,
  x = ~sentiment,
  y = ~word_count,
  type = "bar",
  color = ~sentiment,
  colors = c("#D55E00", "#0072B2"),
  text = ~word_count,
  textposition = "auto",
  hovertemplate = "%{x}: %{y} word occurrences<extra></extra>"
) |>
  layout(
    title = "Sentiment Words in BlueSky Posts",
    xaxis = list(title = "Dictionary sentiment"),
    yaxis = list(title = "Word occurrences", rangemode = "tozero"),
    showlegend = FALSE
  )

The Bing dictionary identified 159 positive and 149 negative word occurrences. Positive words were slightly more frequent, but these counts do not establish that most posts or customers were positive. Context and promotional content may affect the results.

I checked a sample of five positive and five negative word occurrences against their original post excerpts. Some dictionary labels did not represent opinions about Amazon delivery. For example, “beautiful” appeared in a movie title, “fast” described stories, and “crime” identified a movie genre. The word “glad” appeared in a post supporting Amazon’s withdrawal of a drone proposal, showing that positive language does not necessarily indicate a positive opinion of the company. These examples demonstrate why word counts alone cannot establish customer satisfaction. Human judgment is needed to evaluate context and decide which posts are relevant.