Closed trinker closed 6 years ago
Evidence is not conclusive:
library(sentimentr)
dats <- c(
"crowdflower_deflategate",
"crowdflower_products",
"course_evaluations",
"crowdflower_self_driving_cars",
"crowdflower_weather",
"hotel_reviews",
"kaggle_movie_reviews",
"cannon_reviews",
"kotzias_reviews_amazon_cells"
)
cdat <- combine_data(dats[c(1:7, 9)])
sdat <- get_sentences(cdat)
cl::tic()
swears <- profanity(sdat, profanity_list = c('fucking', 'fuckin'))
cl::toc()
library(data.table)
swears[profanity > 0, ]
Needs more formal counting of how the f word is used.
fuckin
only used 6 times...still it should probably be treated the same as the -ing version though in actual use these two words, when spoken, often have different conotations I suspect.
the main emotion function has been built in the same way prfanity
is.
emotion
functioncombine.negated.emotions = FALSE
a way to combine negated emotions with oppositedrop.unused.emotions
to drop un used emotionsplot.emotion
emotion_by
emotion_by
get_sentences
methodsextract_emotion_terms
un.as.negation
as this slows the searching down.Note that this gives no warning and should:
emotion(text.var, un.as.negation.warn = TRUE)
Also this gives the following error:
emotion('')
Show Traceback
Rerun with Debug
Error in `[.data.table`(emo_dat[, `:=`(negator_loc, ifelse(is_negator, :
Column 1 of j's result for the first group is NULL. We rely on the column types of the first result to decide the type expected for the remaining groups (and require consistency). NULL columns are acceptable for later groups (and those are replaced with NA of appropriate type and recycled) but not for the first. Please use a typed empty vector instead, such as integer() or numeric().
It doesn't make sense to combine negated anger with fear within Plutchik's wheel. Not doing combine.negated.emotions
Ensure that 'ununhappy' isn't created by un.as.negation as this slows the searching down (ABOVE)
turns out this isn't really likely to happen, isn't slowing it down that much if it does. The time to find and the conditional logic to deal with it takes more time. And it's not going affect the accuracy except to the positive where, in rare cases, something like ununhappy does exist in the text, in which case we'd want to negate the unhappy anyway.
use lexicon::nrc_emotions and similar negation handling as sentiment