I am trying to perform sentiment analysis in R. I want to use either afinn or bing lexicon, but the problem is i cant tokenize the words.
Here are the words for which i need the sentiments for :
So there are 6 words for whom i want sentiments for : Pass Fail Not Ready Out of Business Pass w/conditions No entry
How do i use any of the lexicons to assign sentiments to these words
Here is my code :
d<- as.data.frame(data$Results)
d<- as.data.frame(d[1:2000,])
colnames(d) <- "text"
#Making preprocessed file for raw data
preprocess<-data.frame(text=sapply(tweet_corpus_clean, identity),
stringsAsFactors=F)
# tokenize
tokens <- data_frame(text = preprocess$text) %>% unnest_tokens(word, text)
When run this i get :
Because for lexicons to assign sentiments it has to be one token per row
So i had to merge those words together. Now when i use afinn its not able to understand what outofbusiness is obvioulsy
tokens <- data_frame(text = preprocess$text) %>% unnest_tokens(word, text)
contributions = tokens %>%ungroup()%>%
inner_join(get_sentiments("afinn"), by = "word") %>%
group_by(word) %>%
summarize(score = as.numeric(sum(score * n) / sum(n))) %>%
arrange(desc(sentiment))
how do i do sentiment analysis for those 6 tpes of words?