library(readtext)
library(dplyr)
poems_hunter <- readtext("~/OneDrive - Plymouth State University/madness/poems_hunter/*") %>% tibble()
poems_hunter
## # A tibble: 10 x 2
## doc_id text
## <chr> <chr>
## 1 1_Hunter_2009.t… "It's A Mad(Off) , Mad(Off) , Mad(Off) , Mad(Off) World\nWh…
## 2 10_Hunter_2008.… "Mad Mad World\n\nthe world is mad\ninsane!\nchristians fig…
## 3 2_Hunter_2014.t… "What Is This Mad Race Of The Mad-Mad Modern Man?\n\nWhat i…
## 4 3_Hunter_2009.t… "It Is A Mad, Mad, Mad World.........\n\nMoon is gone\nbut …
## 5 4_Hunter_2014.t… "Poetry, Poetry, Poetry, Will Madden Me And You/ You Poetry…
## 6 5_Hunter_2014.t… "The Poets Are The Mad Men And Poetry A Mad Man's Babbling\…
## 7 6_Hunter_2013.t… "A Mad Mad Mothers Mistake\n\nLeft left not right she's lef…
## 8 7_Hunter_2010.t… "Thoughts In Madness, Madness In Thought\n\nMy days are mad…
## 9 8_Hunter_2012.t… "Traces Of Madness (Madman's Song)\n\nYou would have said, …
## 10 9_Hunter_2010.t… "If Mad Is A Hatter Then Mad Am I\n\nIf mad is a hatter the…
poems_victorian <- readtext("~/OneDrive - Plymouth State University/madness/poems_victorian/*") %>% tibble()
poems_victorian
## # A tibble: 10 x 2
## doc_id text
## <chr> <chr>
## 1 1_Victorian_1850.… "THE BALLAD OF RICHARD BURNELL.\n\nFrom his bed rose Rich…
## 2 10_Victorian_1820… "The following touching Verses are taken from a Newcastle…
## 3 2_Victorian_1820.… "THE BRANCHERS.*\n\n1.\nI sat to bask, one sunny morn,\n1…
## 4 3_Victorian_1890.… "THE BALLAD OF THE KING’S JEST.\n\nWhen springtime flushe…
## 5 4_Victorian_1850.… "THE PENITENT FREE-TRADER.\n\nTufnell ! For the love of m…
## 6 5_Victorian_1820.… "STANZAS.\n\n“ —— And muttered, lost ! lost ! lost !”\nSi…
## 7 6_Victorian_1860.… "XV.—THE MOTHER’S LAMENT.\n\nWhen I was young, when I was…
## 8 7_Victorian_1880.… "A Stray Sunbeam.\n\nA\nSUNBEAM gone astray\n1\nUpon life…
## 9 8_Victorian_1870.… "LADY NOEL BYRON.\n\nA\nND as she spoke, it seemed as tho…
## 10 9_Victorian_1840.… "The Auld State Kirk.\nNEW SONG.\nTune—“ Auld Lang Syne.”…
Join datasets
poems_raw <- rbind(poems_hunter,poems_victorian)
poems_raw
## # A tibble: 20 x 2
## doc_id text
## <chr> <chr>
## 1 1_Hunter_2009.txt "It's A Mad(Off) , Mad(Off) , Mad(Off) , Mad(Off) World\n…
## 2 10_Hunter_2008.txt "Mad Mad World\n\nthe world is mad\ninsane!\nchristians f…
## 3 2_Hunter_2014.txt "What Is This Mad Race Of The Mad-Mad Modern Man?\n\nWhat…
## 4 3_Hunter_2009.txt "It Is A Mad, Mad, Mad World.........\n\nMoon is gone\nbu…
## 5 4_Hunter_2014.txt "Poetry, Poetry, Poetry, Will Madden Me And You/ You Poet…
## 6 5_Hunter_2014.txt "The Poets Are The Mad Men And Poetry A Mad Man's Babblin…
## 7 6_Hunter_2013.txt "A Mad Mad Mothers Mistake\n\nLeft left not right she's l…
## 8 7_Hunter_2010.txt "Thoughts In Madness, Madness In Thought\n\nMy days are m…
## 9 8_Hunter_2012.txt "Traces Of Madness (Madman's Song)\n\nYou would have said…
## 10 9_Hunter_2010.txt "If Mad Is A Hatter Then Mad Am I\n\nIf mad is a hatter t…
## 11 1_Victorian_1850.… "THE BALLAD OF RICHARD BURNELL.\n\nFrom his bed rose Rich…
## 12 10_Victorian_1820… "The following touching Verses are taken from a Newcastle…
## 13 2_Victorian_1820.… "THE BRANCHERS.*\n\n1.\nI sat to bask, one sunny morn,\n1…
## 14 3_Victorian_1890.… "THE BALLAD OF THE KING’S JEST.\n\nWhen springtime flushe…
## 15 4_Victorian_1850.… "THE PENITENT FREE-TRADER.\n\nTufnell ! For the love of m…
## 16 5_Victorian_1820.… "STANZAS.\n\n“ —— And muttered, lost ! lost ! lost !”\nSi…
## 17 6_Victorian_1860.… "XV.—THE MOTHER’S LAMENT.\n\nWhen I was young, when I was…
## 18 7_Victorian_1880.… "A Stray Sunbeam.\n\nA\nSUNBEAM gone astray\n1\nUpon life…
## 19 8_Victorian_1870.… "LADY NOEL BYRON.\n\nA\nND as she spoke, it seemed as tho…
## 20 9_Victorian_1840.… "The Auld State Kirk.\nNEW SONG.\nTune—“ Auld Lang Syne.”…
library(tidyr)
poems <- poems_raw %>% separate(doc_id, c("ID","Database","Year"))
## Warning: Expected 3 pieces. Additional pieces discarded in 20 rows [1, 2, 3, 4,
## 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20].
poems
## # A tibble: 20 x 4
## ID Database Year text
## <chr> <chr> <chr> <chr>
## 1 1 Hunter 2009 "It's A Mad(Off) , Mad(Off) , Mad(Off) , Mad(Off) Worl…
## 2 10 Hunter 2008 "Mad Mad World\n\nthe world is mad\ninsane!\nchristian…
## 3 2 Hunter 2014 "What Is This Mad Race Of The Mad-Mad Modern Man?\n\nW…
## 4 3 Hunter 2009 "It Is A Mad, Mad, Mad World.........\n\nMoon is gone\…
## 5 4 Hunter 2014 "Poetry, Poetry, Poetry, Will Madden Me And You/ You P…
## 6 5 Hunter 2014 "The Poets Are The Mad Men And Poetry A Mad Man's Babb…
## 7 6 Hunter 2013 "A Mad Mad Mothers Mistake\n\nLeft left not right she'…
## 8 7 Hunter 2010 "Thoughts In Madness, Madness In Thought\n\nMy days ar…
## 9 8 Hunter 2012 "Traces Of Madness (Madman's Song)\n\nYou would have s…
## 10 9 Hunter 2010 "If Mad Is A Hatter Then Mad Am I\n\nIf mad is a hatte…
## 11 1 Victorian 1850 "THE BALLAD OF RICHARD BURNELL.\n\nFrom his bed rose R…
## 12 10 Victorian 1820 "The following touching Verses are taken from a Newcas…
## 13 2 Victorian 1820 "THE BRANCHERS.*\n\n1.\nI sat to bask, one sunny morn,…
## 14 3 Victorian 1890 "THE BALLAD OF THE KING’S JEST.\n\nWhen springtime flu…
## 15 4 Victorian 1850 "THE PENITENT FREE-TRADER.\n\nTufnell ! For the love o…
## 16 5 Victorian 1820 "STANZAS.\n\n“ —— And muttered, lost ! lost ! lost !”\…
## 17 6 Victorian 1860 "XV.—THE MOTHER’S LAMENT.\n\nWhen I was young, when I …
## 18 7 Victorian 1880 "A Stray Sunbeam.\n\nA\nSUNBEAM gone astray\n1\nUpon l…
## 19 8 Victorian 1870 "LADY NOEL BYRON.\n\nA\nND as she spoke, it seemed as …
## 20 9 Victorian 1840 "The Auld State Kirk.\nNEW SONG.\nTune—“ Auld Lang Syn…
library(tidytext)
library(stringr)
poems_cleaned <- poems %>%
unnest_tokens(output = word, input = text) %>%
anti_join(stop_words) %>%
filter(!str_detect(word, "[^a-zA-Z\\s]|mad")) %>%
mutate(database = str_replace(Database, "Hunter", "Contemporary"))
poems_cleaned
## # A tibble: 3,610 x 5
## ID Database Year word database
## <chr> <chr> <chr> <chr> <chr>
## 1 1 Hunter 2009 world Contemporary
## 2 1 Hunter 2009 schmucky Contemporary
## 3 1 Hunter 2009 putz Contemporary
## 4 1 Hunter 2009 bernard Contemporary
## 5 1 Hunter 2009 jewed Contemporary
## 6 1 Hunter 2009 investors Contemporary
## 7 1 Hunter 2009 banker Contemporary
## 8 1 Hunter 2009 globe Contemporary
## 9 1 Hunter 2009 money Contemporary
## 10 1 Hunter 2009 adolph Contemporary
## # … with 3,600 more rows
visualize most frequent words
library(ggplot2)
poems_cleaned %>%
count(Database, word, sort = TRUE) %>%
group_by(Database) %>%
top_n(10, n) %>%
ungroup() %>%
ggplot(aes(x = n, y = reorder_within(word, n, Database), fill = Database)) + geom_col(alpha = 0.8) +
facet_wrap(~Database, scales = "free_y") +
scale_y_reordered() +
labs(y = NULL,
x = "Word Frequency",
title = "Top 10 Most Frequent Words")
nrc <- get_sentiments("nrc")
nrc
## # A tibble: 13,901 x 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
## # … with 13,891 more rows
poems_cleaned %>%
inner_join(nrc) %>%
count(Database, sentiment, sort = TRUE) %>%
ggplot(aes(y = reorder_within(sentiment, n, Database), x = n, fill = Database)) +
geom_col(alpha = 0.8) +
facet_wrap(~Database, scales = "free_y") +
scale_y_reordered() +
labs(title = "Number of Words Association with Emotions",
y = "Emotions",
x = "Number of Words")
bing <- get_sentiments("bing")
bing
## # A tibble: 6,786 x 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
## # … with 6,776 more rows
poems_cleaned %>%
inner_join(bing) %>%
ggplot(aes(x = database, fill = sentiment)) +
geom_bar(position = "fill") +
labs(title = "Ratios of Negative and Positive words",
y = "Proportions",
x = NULL)
affin <- get_sentiments("afinn")
affin
## # A tibble: 2,477 x 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
## # … with 2,467 more rows
poems_cleaned %>%
inner_join(affin) %>%
group_by(Database) %>%
summarise(sentiment_score = sum(value)) %>%
ungroup() %>%
ggplot(aes(x = Database, y = sentiment_score)) +
geom_col(fill = "midnightblue", alpha = 0.8) +
labs(title = "Sum of Sentiment Scores of Words",
x = NULL,
y = "Sum of Sentiment Scores")
Based on the data the Victorian era used a lot more positive words throughout their poems. This was very surprising to me because I always pictured people from the olden days being tougher and not showing or speaking of emotions that much. In society today most people are very sensitive which lead me to think that most of the poems would be as-well. I did read The Tell-Tale Heart by Edgar Allan Poe. There was a lot of emotion and madness throughout the story. The character in his story was trying to convince the reader that he was not mad and that his actions made sense. Even after he killed the guy. “If still you think me mad, you will think so no longer when I describe the wise precautions I took for the concealment of the body. The night waned, and I worked hastily, but in silence. First of all I dismembered the corpse. I cut off the head and the arms and the legs.” (Poe, edgar). The fact that he tries to defend his actions and tries to say he is sane is strange. It makes me wonder if this is how all murders think when they do something like this. Throughout this poem you can see how his emotions guide him. At the beginning he let his emotions of seeing the eye take him over, “Whenever it fell upon me, my blood ran cold; and so by degrees – very gradually –I made up my mind to take the life of the old man, and thus rid myself of the eye forever.” (Poe, Edgar). It is surprising to me how this guy is portrayed throughout the story. Even though he is a mad man Edgar made it so he seemed almost like the good guy. He didn’t write it to make the guy seem very evil and a murderer. I think that this is seen a lot nowadays in modern writing and songs. There is a song called Monster by Rihanna and Eminem. They talk about listening to the voices in their heads. It isn’t portrayed as a bad thing though. I feel like in our society we push people who are “Mad” to go get help rather than having a negative view about them. I see it over instagram a lot as well with people posting depression awareness and mental health posts. Overall I think our society wants people to get help rather than put in some asylum.
Work Cited
Giordano, Robert. “The Tell-Tale Heart by Edgar Allan Poe.” PoeStories.com, poestories.com/read/telltaleheart.