AI helped me organize the phone-carrier data and develop code for cleaning, text analysis, sentiment analysis, and an interactive chart. However, AI-generated code still requires verification. Search results can contain unrelated posts, such as T-Mobile venue references or uses of the word spectrum that do not refer to the provider. The report makes these cleaning decisions visible and includes checks for the calculations. These checks are useful, but correct arithmetic alone does not prove that the posts were classified correctly.
Human judgment is needed to interpret sarcasm, negation, and which company an opinion describes. A positive word does not necessarily mean that someone likes the carrier. The samples also differ in size and may cover different collection periods, so the results should not be treated as a ranking of customer satisfaction. My initial impression of this newly designed lab is that combining AI assistance with verification is useful because it requires students to question automated results. A helpful improvement would be a common collection template with matching search terms and dates. After running this report, I will revise this reflection to describe the examples I personally reviewed.
What words appear in the group’s phone-carrier search samples, and what sentiment does a basic dictionary method detect?
The source carrier identifies the search sample. A post may mention multiple carriers, and its emotional language may refer to another company.
raw |>
count(carrier, source_week, name = "imported_rows") |>
knitr::kable()
| carrier | source_week | imported_rows |
|---|---|---|
| Spectrum | Week 11 | 655 |
| T-Mobile | Week 11 | 200 |
| Verizon | Week 10 | 279 |
Class-week labels identify the source files. They do not establish matching calendar-week observations.
The rules below remove blank rows, exclude T-Mobile venue references, and require Spectrum posts to contain a possible provider-related term. Verizon posts must explicitly mention Verizon or Fios.
These rules are imperfect. For example, excluding venue references can also remove a post that discusses service at a venue. Both retained and rejected posts need human review.
Duplicate post IDs are removed within each carrier sample. If an ID is unavailable, normalized text is used instead.
spectrum_terms <- paste0(
"\\b(internet|wifi|wi-fi|cable|billing|bill|",
"outage|customer|provider|charter|modem|router|",
"broadband|subscription|tv|mobile)\\b"
)
staged <- raw |>
mutate(
normalized = str_to_lower(
str_squish(
str_replace_all(text, fixed("\\n"), " ")
)
),
relevant = case_when(
carrier == "T-Mobile" ~
str_detect(normalized, "\\bt[ -]?mobile\\b") &
!str_detect(
normalized,
"t[ -]?mobile (arena|park|center)"
),
carrier == "Spectrum" ~
str_detect(normalized, "\\bspectrum\\b") &
str_detect(normalized, spectrum_terms),
carrier == "Verizon" ~
str_detect(normalized, "\\b(verizon|fios)\\b"),
TRUE ~ FALSE
),
key = if_else(
str_squish(post_id) != "",
post_id,
normalized
),
clean_text = str_squish(
str_remove_all(
normalized,
"https?://\\S+|www\\.\\S+|\\b[a-z0-9.-]+\\.(com|org|net|ly)/\\S*"
)
),
reason = case_when(
normalized == "" ~ "Blank row",
!relevant ~ "Outside relevance rule",
clean_text == "" ~ "No text after URL removal",
TRUE ~ "Candidate"
)
) |>
group_by(carrier, key) |>
mutate(
duplicate = reason == "Candidate" &
cumsum(reason == "Candidate") > 1
) |>
ungroup() |>
mutate(
reason = if_else(
duplicate, "Duplicate post", reason
),
reason = if_else(
reason == "Candidate", "Retained", reason
)
)
posts <- staged |>
filter(reason == "Retained")
stopifnot(nrow(posts) > 0)
audit <- staged |>
count(carrier, reason, name = "rows")
knitr::kable(audit)
| carrier | reason | rows |
|---|---|---|
| Spectrum | Blank row | 64 |
| Spectrum | Outside relevance rule | 205 |
| Spectrum | Retained | 386 |
| T-Mobile | Blank row | 10 |
| T-Mobile | Outside relevance rule | 35 |
| T-Mobile | Retained | 155 |
| Verizon | Blank row | 10 |
| Verizon | Duplicate post | 11 |
| Verizon | Outside relevance rule | 26 |
| Verizon | Retained | 232 |
The analysis retained 773 posts from 1134 imported rows.
This table shows the ten most frequent content words in each sample. Stop words and carrier names are removed from this table, but the full token list is kept for sentiment scoring.
tokens <- posts |>
select(input_id, carrier, clean_text) |>
unnest_tokens(word, clean_text)
top_words <- tokens |>
anti_join(tidytext::stop_words, by = "word") |>
filter(
str_detect(word, "[a-z]"),
!word %in% c(
"t", "mobile", "tmobile",
"verizon", "spectrum", "fios"
)
) |>
count(carrier, word, sort = TRUE) |>
group_by(carrier) |>
slice_max(n, n = 10, with_ties = FALSE) |>
ungroup()
knitr::kable(top_words)
| carrier | word | n |
|---|---|---|
| Spectrum | plan | 106 |
| Spectrum | deal | 102 |
| Spectrum | android | 90 |
| Spectrum | license | 89 |
| Spectrum | authority | 88 |
| Spectrum | mobile’s | 88 |
| Spectrum | internet | 83 |
| Spectrum | starlink | 73 |
| Spectrum | spacex | 71 |
| Spectrum | phone | 66 |
| T-Mobile | twilio | 58 |
| T-Mobile | network | 45 |
| T-Mobile | sms | 38 |
| T-Mobile | delivery | 37 |
| T-Mobile | spacex | 31 |
| T-Mobile | delays | 29 |
| T-Mobile | boost | 24 |
| T-Mobile | carrier | 21 |
| T-Mobile | codes | 20 |
| T-Mobile | phone | 20 |
| Verizon | broadcom | 26 |
| Verizon | phone | 26 |
| Verizon | service | 23 |
| Verizon | tokenized | 23 |
| Verizon | starlink | 21 |
| Verizon | companies | 18 |
| Verizon | okx | 16 |
| Verizon | gap | 15 |
| Verizon | plan | 14 |
| Verizon | iphone | 13 |
These counts measure word occurrences rather than unique customers. Frequent words can come from advertisements, news, and channel listings.
The Bing dictionary labels matching words as positive or negative.
Post score = positive matches − negative matches.
Repeated words count repeatedly. A post with no dictionary matches is kept separate from a post with equal positive and negative counts. Neither outcome proves that a post is neutral.
lexicon <- get_sentiments("bing")
matches <- tokens |>
inner_join(lexicon, by = "word")
match_counts <- matches |>
group_by(input_id) |>
summarise(
positive = sum(sentiment == "positive"),
negative = sum(sentiment == "negative"),
.groups = "drop"
)
scored <- posts |>
left_join(match_counts, by = "input_id") |>
mutate(
positive = replace_na(positive, 0L),
negative = replace_na(negative, 0L),
score = positive - negative,
label = case_when(
positive + negative == 0 ~ "No matches",
score > 0 ~ "Positive",
score < 0 ~ "Negative",
TRUE ~ "Balanced matches"
)
)
sentiment_summary <- scored |>
count(carrier, label, name = "posts") |>
complete(
carrier,
label = c(
"Positive", "Negative",
"Balanced matches", "No matches"
),
fill = list(posts = 0L)
) |>
group_by(carrier) |>
mutate(
total = sum(posts),
percent = 100 * posts / total
) |>
ungroup()
knitr::kable(sentiment_summary, digits = 1)
| carrier | label | posts | total | percent |
|---|---|---|---|---|
| Spectrum | Balanced matches | 35 | 386 | 9.1 |
| Spectrum | Negative | 63 | 386 | 16.3 |
| Spectrum | No matches | 178 | 386 | 46.1 |
| Spectrum | Positive | 110 | 386 | 28.5 |
| T-Mobile | Balanced matches | 13 | 155 | 8.4 |
| T-Mobile | Negative | 45 | 155 | 29.0 |
| T-Mobile | No matches | 43 | 155 | 27.7 |
| T-Mobile | Positive | 54 | 155 | 34.8 |
| Verizon | Balanced matches | 22 | 232 | 9.5 |
| Verizon | Negative | 68 | 232 | 29.3 |
| Verizon | No matches | 77 | 232 | 33.2 |
| Verizon | Positive | 65 | 232 | 28.0 |
Hover over the bars to see counts and percentages. Click a legend entry to hide or show that category.
Percentages help display unequal sample sizes. They do not correct differences in search procedures, collection dates, or sample selection.
chart_data <- sentiment_summary |>
mutate(
label = factor(
label,
levels = c(
"Negative", "Balanced matches",
"No matches", "Positive"
)
),
hover = paste0(
carrier,
"<br>", label,
"<br>Posts: ", posts, " / ", total,
"<br>Share: ", round(percent, 1), "%"
)
)
plot_ly(
chart_data,
x = ~carrier,
y = ~percent,
color = ~label,
colors = c(
"#c44e52", "#ddad39",
"#929292", "#34856a"
),
type = "bar",
text = ~hover,
hoverinfo = "text"
) |>
layout(
title = "Dictionary Sentiment in Bluesky Samples",
barmode = "stack",
xaxis = list(title = "Source search sample"),
yaxis = list(
title = "Percent of retained posts",
range = c(0, 100)
)
)
percentage_check <- sentiment_summary |>
group_by(carrier) |>
summarise(total_percent = sum(percent))
checks <- data.frame(
check = c(
"Every imported row has an audit outcome",
"One score per retained post",
"No duplicate keys within each sample",
"Chart counts equal retained posts",
"Percentages sum to 100 within each sample"
),
passed = c(
sum(audit$rows) == nrow(raw),
nrow(scored) == nrow(posts),
!any(duplicated(scored[c("carrier", "key")])),
sum(sentiment_summary$posts) == nrow(posts),
all(
abs(percentage_check$total_percent - 100) <
0.000001
)
)
)
knitr::kable(checks)
| check | passed |
|---|---|
| Every imported row has an audit outcome | TRUE |
| One score per retained post | TRUE |
| No duplicate keys within each sample | TRUE |
| Chart counts equal retained posts | TRUE |
| Percentages sum to 100 within each sample | TRUE |
stopifnot(all(checks$passed))
Passing these checks confirms record handling and arithmetic. It does not establish that the sentiment interpretation is correct.
example_matches <- tibble(
text = "good good bad"
) |>
unnest_tokens(word, text) |>
inner_join(lexicon, by = "word")
knitr::kable(example_matches)
| word | sentiment |
|---|---|
| good | positive |
| good | positive |
| bad | negative |
stopifnot(
sum(example_matches$sentiment == "positive") == 2,
sum(example_matches$sentiment == "negative") == 1
)
The example contains two positive matches and one negative match.
2 − 1 = +1, producing a Positive label.
Excerpts below omit URLs, handles, and digits. The source row identifies the original CSV record, excluding its header.
excerpt <- function(x) {
x |>
str_remove_all(
"https?://\\S+|www\\.\\S+|\\b[a-z0-9.-]+\\.(com|org|net|ly)/\\S*"
) |>
str_remove_all("@[[:alnum:]_.-]+") |>
str_replace_all("[0-9]", "#") |>
str_squish() |>
str_trunc(200)
}
example_post <- scored |>
filter(positive + negative > 0) |>
arrange(desc(carrier == "T-Mobile"), input_id) |>
slice_head(n = 1)
example_post |>
transmute(
carrier,
source_row,
excerpt = excerpt(text),
positive,
negative,
score,
label
) |>
knitr::kable()
| carrier | source_row | excerpt | positive | negative | score | label |
|---|---|---|---|---|---|---|
| T-Mobile | 1 | SpaceX reportedly wants to buy Boost Mobile Boost has about #.# million customers. SpaceX already bought $## billion of EchoStar spectrum last year. | 2 | 0 | 2 | Positive |
matches |>
filter(input_id %in% example_post$input_id) |>
count(word, sentiment, name = "occurrences") |>
knitr::kable()
| word | sentiment | occurrences |
|---|---|---|
| boost | positive | 2 |
Add the positive and negative occurrences by hand. Compare the result with the displayed score, then read the original post to decide whose service the opinion describes.
staged |>
filter(
reason %in% c(
"Retained", "Outside relevance rule"
)
) |>
group_by(carrier, reason) |>
slice_head(n = 2) |>
ungroup() |>
transmute(
carrier,
source_row,
excerpt = excerpt(text),
reason
) |>
knitr::kable()
| carrier | source_row | excerpt | reason |
|---|---|---|---|
| Spectrum | 5 | ouch, relatable, worth a read on the “high-functioning autistic experience” growing up in England. | Outside relevance rule |
| Spectrum | 7 | Ha ha to those of us who switched from Telus to Freedom Mobile because, competition. | Outside relevance rule |
| Spectrum | 1 | For those curious, be wary of cable providers (hi Spectrum). When we first signed up, we received add’l “free” channels with our package. 🚨Free trial periods. A 🎁 NEVER discussed, but hidden in t… | Retained |
| Spectrum | 2 | European sovereign spectrum to be operated by EU companies Ireland hopes to reach a deal on the Mobile Satellite Services regulation by December | Retained |
| T-Mobile | 18 | We need to stop him. NOW. | Outside relevance rule |
| T-Mobile | 20 | After the MLB season is lost and the future of baseball is in question, I wonder if Hanauer could make a deal to turn T-mobile Park into a soccer stadium? | Outside relevance rule |
| T-Mobile | 1 | SpaceX reportedly wants to buy Boost Mobile Boost has about #.# million customers. SpaceX already bought $## billion of EchoStar spectrum last year. | Retained |
| T-Mobile | 3 | Happy T-Mobile Tuesday to all who celebrate! | Retained |
| Verizon | 6 | iPhone handoff, a seemingly worthless feature that now costs extra. This is for a cellular device. U could already handoff on a WiFi network. So how many ppl really needed this? Does this compete w… | Outside relevance rule |
| Verizon | 14 | Price drives the churn risk: ## percent of customers are weighing a switch, and cost of service is the top reason. Is any network good enough to overcome a $### average monthly bill? | Outside relevance rule |
| Verizon | 1 | One of the cables on our modem is FUBAR so I had to call Verizon. The AI agent hung up on me multiple times before I got a person and a repair appointment. Someone should run for president and prom… | Retained |
| Verizon | 2 | Join us for live coverage of the Voices & Strings Concert tonight ##/## @ #PM on the Education Channel ?? Comcast ####, Verizon ####, #Foxborough | Retained |
Review both retained and rejected examples. A TV listing may pass the Spectrum rule without expressing an opinion. A short complaint may fail because it lacks a provider-related keyword.
The analysis summarizes language in the collected samples. It does not establish which carrier has the happiest customers or whether sentiment changed over time.
The dictionary method has several limitations:
AI can help write repeatable code, but humans must evaluate relevance, context, and whether conclusions are supported. A stronger follow-up would use matching collection windows and manually review a random sample of posts.
The initial prompt supplied the assignment and asked for help applying it to the phone-carrier project. A follow-up requested copy-and-paste code because the R Markdown download was unavailable. Later prompts helped troubleshoot the Console.
Screenshots should show the actual prompts and responses from the conversation.
For a more specific analytical follow-up, I can ask:
Review the results of my phone-carrier report. Check a real-post sentiment calculation, the cleaning decisions, and the percentages in the interactive chart. Explain two potentially misleading results and suggest improvements. Here are my results: [paste results].
This suggested analytical prompt has not been used until I actually send it.
sessionInfo()
## R version 4.6.2 (2026-10-29)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.5 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0
##
## locale:
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
##
## time zone: UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] plotly_4.12.1 ggplot2_4.0.4 tidytext_0.4.3 stringr_1.6.0 tidyr_1.3.2
## [6] dplyr_1.2.1
##
## loaded via a namespace (and not attached):
## [1] Matrix_1.7-6 gtable_0.3.6 jsonlite_2.0.0
## [4] janeaustenr_1.0.0 compiler_4.6.2 tidyselect_1.2.1
## [7] Rcpp_1.1.2 jquerylib_0.1.4 scales_1.4.0
## [10] yaml_2.3.12 fastmap_1.2.0 lattice_0.23-1
## [13] R6_2.6.1 SnowballC_0.7.1 generics_0.1.4
## [16] knitr_1.52 htmlwidgets_1.6.4 tibble_3.3.1
## [19] RColorBrewer_1.1-3 bslib_0.12.0 pillar_1.11.1
## [22] tokenizers_0.3.0 rlang_1.3.0 cachem_1.1.0
## [25] stringi_1.8.9 xfun_0.62 S7_1.0.0
## [28] sass_0.4.10 otel_0.3.0 viridisLite_0.4.3
## [31] cli_3.6.6 withr_3.0.3 magrittr_2.0.5
## [34] crosstalk_1.2.2 digest_0.6.39 grid_4.6.2
## [37] rstudioapi_0.19.0 lifecycle_1.0.5 vctrs_0.7.3
## [40] data.table_1.18.6.1 evaluate_1.0.5 glue_1.8.1
## [43] farver_2.1.2 httr_1.4.9 rmarkdown_2.32
## [46] purrr_1.2.2 tools_4.6.2 pkgconfig_2.0.3
## [49] htmltools_0.5.9