-
-
Save shawngraham/87bb74b576395737fc76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#setwd(path-to-your-directoy) | |
install.packages("devtools") | |
devtools::install_github("mjockers/syuzhet") | |
library("syuzhet") | |
x <- get_text_as_string("text.csv") | |
text <- get_sentences(x) | |
# this gets sentiment by individual token | |
stext <- get_sentiment(text) | |
write.csv(stext, "stext.csv") | |
# this line scales your entire corpus, divides into tenths, plots sentiment over that | |
chunktext <- get_percentage_values(stext) | |
write.csv(chunktext, "chunktext.csv") | |
barplot(chunktext, main="this", xlab="that") | |
barplot(stext, main="this", xlab="that") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment