Benjamin Smith
March 18, 2018
The application is located at https://misterliver52.shinyapps.io/WordCloud2/.
The word cloud application is based on excerpts from selected 19th Century English-language poetic works by:
All the works were sourced from Project Gutenberg https://www.gutenberg.org, and are referenced in the server.R file in the application.
The subject text is selected based on user selection and passed to a corpus, trims common words (a, the, an, etc.), and places in a matrix.
library(tm);library(wordcloud);library(memoise)
#text <- readLines(sprintf("./%s.txt.gz", poet), encoding="UTF-8")
text <- "The quick brown fox jumps over the lazy dog."
myCorpus = Corpus(VectorSource(text))
myCorpus = tm_map(myCorpus, removeWords, c(stopwords("SMART"), "thy", "the"))
myDTM = TermDocumentMatrix(myCorpus,control = list(minWordLength = 1))
print(myDTM)
<<TermDocumentMatrix (terms: 7, documents: 1)>>
Non-/sparse entries: 7/0
Sparsity : 0%
Maximal term length: 5
Weighting : term frequency (tf)