For each book in our corpus, I scraped up to the first 100 pages of reviews (10 reviews/page). I ended up with 103,957 reviews in total. Of those, 28,222 reviews contained one of the follow relational gender words (27%):
“daughter”,“daughters”, “granddaughter”, “granddaughters”,“niece”, “nieces”,“son”, “sons”, “grandson”, “grandsons”, “nephew”, “nephews”
I selected these gender words because they would be more likely to refer to the child being read to, compared to pronouns like “she” and “he” which could refer to characters in the story. I excluded reviews that included relational words from both genders.
REVIEW_PATH <- "scraped_amazon_reviews.csv"
all_reviews <- read_csv(REVIEW_PATH, col_names = c("title", "page_num", "review_title",
"review", "rating"))
cleaned_reviews <- all_reviews %>%
mutate(title_review = paste0(review_title, " ", review )) %>% # combine titles and review
select(-review_title, -review, -page_num)
count(cleaned_reviews, title) %>%
ggplot(aes(x = n)) +
ggtitle("Number of reviews by book") +
geom_histogram() +
theme_classic()
#cleaned_reviews %>%
# ggplot(aes(x = rating)) +
# ggtitle("Review distribution") +
# geom_histogram(binwidth = 1) +
# theme_classic()
FEMALE_WORDS <- c("daughter","daughters", "granddaughter", "granddaughters","niece", "nieces")
MALE_WORDS <- c("son", "sons", "grandson", "grandsons", "nephew", "nephews")
tidy_reviews <- cleaned_reviews %>%
mutate(review_id = 1:n(),
title_review = tolower(title_review),
title_review = str_remove_all(title_review, "[:punct:]")) %>%
unnest_tokens(word, title_review)
gendered_reviews <- tidy_reviews %>%
mutate(gendered_word = word %in% c(FEMALE_WORDS, MALE_WORDS)) %>%
filter(gendered_word) %>%
data.table()
gendered_counts <- gendered_reviews %>%
count(title) %>%
arrange(n) %>%
rename(n_gendered_words = n)
gendered_counts %>%
ggplot(aes(x = n_gendered_words)) +
ggtitle("Total gendered words by book") +
geom_histogram() +
theme_classic()
by_gender_reviews <- gendered_reviews %>%
mutate(gender_type = case_when(word %in% FEMALE_WORDS ~ "F", TRUE ~ "M")) %>%
select(-gendered_word) %>%
distinct(review_id, word, .keep_all = T) %>%
data.table()
multi_gender_reviews <- by_gender_reviews %>%
count(review_id, gender_type) %>%
count(review_id) %>%
filter(nn == 2) %>%
pull(review_id)
relative_gender <- by_gender_reviews %>%
filter(!(review_id %in% multi_gender_reviews)) %>%
distinct(title, review_id, gender_type) %>%
count(title, gender_type) %>%
group_by(title) %>%
mutate (prop_female = n/sum(n),
total = sum(n)) %>%
filter(gender_type == "F") %>%
mutate(lower = as.data.frame(binconf(n, total, alpha=0.05, include.x = F,
include.n = F))$Lower,
upper = as.data.frame(binconf(n, total, alpha=0.05, include.x = F,
include.n = F))$Upper) %>%
arrange(prop_female)
ggplot(relative_gender, aes(x = prop_female)) +
geom_histogram() +
theme_classic()
This plot shoes the proportion of reviews that contained a female relational term relative the number of reviews that contained a male relational term. Ranges are 95% CIs. The ranges are so large because the number of reviews is so variable across books.
relative_gender %>%
ggplot(aes(x = reorder(title, prop_female),
y = prop_female, color = prop_female)) +
geom_hline(aes(yintercept = .5), linetype = 2) +
coord_flip() +
geom_pointrange(aes(ymin = lower, ymax = upper), size = .1) +
scale_colour_gradient2(low = "blue", mid = "grey",
high ="red", midpoint = .5, space = "Lab",
na.value = "grey50", guide = F) +
#ylim(2, 4) +
theme_classic() +
xlab("Book Title") +
ylab("Prop. female words") +
ggtitle("Mean Gender Rating by Book") +
theme(axis.text.y = element_text(size = 6))