R: sentiments analysis
Revision as of 16:56, 8 November 2018 by Onnowpurbo (talk | contribs)
library(tidytext) sentiments
get_sentiments("afinn") get_sentiments("bing") get_sentiments("nrc")
library(janeaustenr) library(dplyr) library(stringr)
tidy_books <- austen_books() %>% group_by(book) %>% mutate(linenumber = row_number(), chapter = cumsum(str_detect(text, regex("^chapter [\\divxlc]", ignore_case = TRUE)))) %>% ungroup() %>% unnest_tokens(word, text)