classify_polarity.Rdclassify_polarity Classifies the polarity (e.g. positive or negative) of a set of texts using a naive Bayes classifier trained on Janyce Wiebe's subjectivity lexicon.
classify_polarity( textColumns, algorithm = "bayes", pstrong = 0.5, pweak = 1, prior = 1, verbose = FALSE, lang = "en", ... )
| textColumns | A |
|---|---|
| algorithm | A |
| pstrong | A |
| pweak | A |
| prior | A |
| verbose | A |
| lang | Language, "en" for English and "pt" for Brazilian Portuguese. |
| ... | Additional parameters to be passed into the |
Returns an object of class data.frame with four columns and one row for each document.
The absolute log likelihood of the document expressing a positive sentiment.
The absolute log likelihood of the document expressing a negative sentiment.
The ratio of absolute log likelihoods between positive and negative sentiment scores. A score of 1 indicates a neutral sentiment, less than 1 indicates a negative sentiment, and greater than 1 indicates a positive sentiment.
The most likely sentiment category (e.g. positive, negative, neutral) for the given text.
Timothy P. Jurka <tpjurka@ucdavis.edu> and Jodavid Ferreira <jdaf1@de.ufpe.br>
# DEFINE DOCUMENTS documents <- c("I am very happy, excited, and optimistic.", "I am very scared, annoyed, and irritated.") # CLASSIFY POLARITY