View source: R/classify_polarity.R
classify_polarity | R Documentation |
classify_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.
pos |
The absolute log likelihood of the document expressing a positive sentiment. |
neg |
The absolute log likelihood of the document expressing a negative sentiment. |
pos/neg |
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. |
best_fit |
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.