Description Usage Arguments Value Author(s) Examples
View source: R/sentiment_engines.R
This function extracts the documents with most extreme sentiment (lowest, highest or both in absolute terms). The extracted documents are unique, even when, for example, all most extreme sentiment values (across sentiment calculation methods) occur only for one document.
1 |
sentiment |
a |
n |
a positive |
type |
a |
do.average |
a |
A vector of type "character"
corresponding to the n
extracted document identifiers.
Samuel Borms
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | set.seed(505)
data("usnews", package = "sentometrics")
data("list_lexicons", package = "sentometrics")
data("list_valence_shifters", package = "sentometrics")
l <- sento_lexicons(list_lexicons[c("LM_en", "HENRY_en")])
corpus <- sento_corpus(corpusdf = usnews)
corpusSample <- quanteda::corpus_sample(corpus, size = 200)
sent <- compute_sentiment(corpusSample, l, how = "proportionalPol")
# extract the peaks
peaksAbs <- peakdocs(sent, n = 5)
peaksAbsQuantile <- peakdocs(sent, n = 0.50)
peaksPos <- peakdocs(sent, n = 5, type = "pos")
peaksNeg <- peakdocs(sent, n = 5, type = "neg")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.