Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gtuckerkellogg/3735994 to your computer and use it in GitHub Desktop.
Save gtuckerkellogg/3735994 to your computer and use it in GitHub Desktop.
require(tm)
source("code/tmt.R")
require(plyr)
require(Rstem)
require(wordcloud)
ans.good <- tolower(clean(as.character(unlist(feedback[feedback$average < 65 ,6]))))
ans.good <- removePunctuation(removeWords(ans.good,stopwords()))
#ans.good <- removeWords(ans.good,c("lecture","lectures"))
ans.good <- ans.good[!is.na(ans.good)]
ans.good <- ans.good[sapply(ans.good,ans.lengths) > 8 ]
ans.good <- paste(ans.good,collapse="" )
ans.words <- unlist(strsplit(ans.good, split="\\s+"))
ans.fixed <- as.character(sapply(ans.words,function(w)AspellCheck(w,"fix")))
ans.reallyfixed <- as.character(sapply(wordStem(ans.fixed,lang="english"),function(w)AspellCheck(w,"fix")))
wordcloud(ans.reallyfixed, colors=brewer.pal(6,"Dark2"),random.order=FALSE,use.r=TRUE)
classify_emotion(paste(ans.fixed,collapse=" " ))
classify_polarity(paste(ans.fixed,collapse=" " ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment