Package: SentimentAnalysis 1.3-5

Nicolas Proellochs

SentimentAnalysis: Dictionary-Based Sentiment Analysis

Performs a sentiment analysis of textual contents in R. This implementation utilizes various existing dictionaries, such as Harvard IV, or finance-specific dictionaries. Furthermore, it can also create customized dictionaries. The latter uses LASSO regularization as a statistical approach to select relevant terms based on an exogenous response variable.

Authors:Nicolas Proellochs [aut, cre], Stefan Feuerriegel [aut]

SentimentAnalysis_1.3-5.tar.gz
SentimentAnalysis_1.3-5.zip(r-4.5)SentimentAnalysis_1.3-5.zip(r-4.4)SentimentAnalysis_1.3-5.zip(r-4.3)
SentimentAnalysis_1.3-5.tgz(r-4.4-any)SentimentAnalysis_1.3-5.tgz(r-4.3-any)
SentimentAnalysis_1.3-5.tar.gz(r-4.5-noble)SentimentAnalysis_1.3-5.tar.gz(r-4.4-noble)
SentimentAnalysis_1.3-5.tgz(r-4.4-emscripten)SentimentAnalysis_1.3-5.tgz(r-4.3-emscripten)
SentimentAnalysis.pdf |SentimentAnalysis.html
SentimentAnalysis/json (API)
NEWS

# Install 'SentimentAnalysis' in R:
install.packages('SentimentAnalysis', repos = c('https://sfeuerriegel.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/sfeuerriegel/sentimentanalysis/issues

Datasets:
  • DictionaryGI - Dictionary with opinionated words from the Harvard-IV dictionary as used in the General Inquirer software
  • DictionaryHE - Dictionary with opinionated words from Henry's Financial dictionary
  • DictionaryLM - Dictionary with opinionated words from Loughran-McDonald Financial dictionary

On CRAN:

8.55 score 148 stars 1 packages 238 scripts 1.7k downloads 4 mentions 43 exports 49 dependencies

Last updated 1 years agofrom:279194dc86. Checks:OK: 3 NOTE: 4. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 17 2024
R-4.5-winNOTENov 17 2024
R-4.5-linuxNOTENov 17 2024
R-4.4-winNOTENov 17 2024
R-4.4-macNOTENov 17 2024
R-4.3-winOKNov 17 2024
R-4.3-macOKNov 17 2024

Exports:analyzeSentimentcompareDictionariescompareToResponseconvertToBinaryResponseconvertToDirectioncountWordsenetEstimationextractWordsgenerateDictionaryglmEstimationlassoEstimationlmEstimationloadDictionaryGIloadDictionaryHEloadDictionaryLMloadDictionaryLM_UncertaintyloadDictionaryQDAPloadImdblookupEstimationMethodngram_tokenizenumEntriesnumNegativeEntriesnumPositiveEntriesplotSentimentplotSentimentResponsepreprocessCorpusreadridgeEstimationruleLinearModelruleNegativityrulePositivityruleRatioruleSentimentruleSentimentPolarityruleWordCountSentimentDictionarySentimentDictionaryBinarySentimentDictionaryWeightedSentimentDictionaryWordlistspikeslabEstimationtoDocumentTermMatrixtransformIntoCorpuswrite

Dependencies:BHclicodetoolscolorspacefansifarverforeachggplot2glmnetgluegtableisobanditeratorslabelinglarslatticelifecyclemagrittrMASSMatrixmgcvmomentsmunsellngramrrnlmeNLPpillarpkgconfigqdapDictionariesR6randomForestRColorBrewerRcppRcppEigenrlangscalesshapeslamspikeslabstringdistsurvivaltautibbletmutf8vctrsviridisLitewithrxml2

SentimentAnalysis Vignette

Rendered fromSentimentAnalysis.Rmdusingknitr::rmarkdownon Nov 17 2024.

Last update: 2023-08-23
Started: 2016-06-18

Readme and manuals

Help Manual

Help pageTopics
Sentiment analysisanalyzeSentiment analyzeSentiment.character analyzeSentiment.Corpus analyzeSentiment.data.frame analyzeSentiment.DocumentTermMatrix analyzeSentiment.TermDocumentMatrix
Compares two dictionariescompareDictionaries
Compare sentiment values to existing response variablecompareToResponse compareToResponse.data.frame compareToResponse.factor compareToResponse.integer compareToResponse.logical compareToResponse.numeric
Convert continuous sentiment to directionconvertToBinaryResponse
Convert continuous sentiment to directionconvertToDirection
Count wordscountWords countWords.character countWords.Corpus countWords.data.frame countWords.DocumentTermMatrix countWords.TermDocumentMatrix
Dictionary with opinionated words from the Harvard-IV dictionary as used in the General Inquirer softwareDictionaryGI
Dictionary with opinionated words from Henry's Financial dictionaryDictionaryHE
Dictionary with opinionated words from Loughran-McDonald Financial dictionaryDictionaryLM
Elastic net estimationenetEstimation
Extract words from dictionaryextractWords
Generates dictionary of decisive termsgenerateDictionary generateDictionary.character generateDictionary.Corpus generateDictionary.data.frame generateDictionary.DocumentTermMatrix generateDictionary.TermDocumentMatrix
Estimation via generalized least squaresglmEstimation
Lasso estimationlassoEstimation
Ordinary least squares estimationlmEstimation
Loads Harvard-IV dictionary into objectloadDictionaryGI
Loads Henry's finance-specific dictionary into objectloadDictionaryHE
Loads Loughran-McDonald dictionary into objectloadDictionaryLM
Loads uncertainty words from Loughran-McDonald into objectloadDictionaryLM_Uncertainty
Loads polarity words from qdap package into objectloadDictionaryQDAP
Retrieves IMDb datasetloadImdb
Estimation methodlookupEstimationMethod
N-gram tokenizerngram_tokenize
Number of words in dictionarynumEntries
Number of negative words in dictionarynumNegativeEntries
Number of positive words in dictionarynumPositiveEntries
KDE plot of estimated coefficientsplot.SentimentDictionaryWeighted
Line plot with sentiment scoresplotSentiment
Scatterplot with trend line between sentiment and responseplotSentimentResponse
Prediction for given dictionarypredict.SentimentDictionaryWeighted
Default preprocessing of corpuspreprocessCorpus
Output content of sentiment dictionaryprint.SentimentDictionaryBinary print.SentimentDictionaryWeighted print.SentimentDictionaryWordlist
Read dictionary from text fileread
Ridge estimationridgeEstimation
Sentiment based on linear modelruleLinearModel
Ratio of negative wordsruleNegativity
Ratio of positive wordsrulePositivity
Ratio of dictionary wordsruleRatio
Sentiment scoreruleSentiment
Sentiment polarity scoreruleSentimentPolarity
Counts word frequenciesruleWordCount
Create new sentiment dictionary based on inputSentimentDictionary
Create a sentiment dictionary of positive and negative wordsSentimentDictionaryBinary
Create a sentiment dictionary of words linked to a scoreSentimentDictionaryWeighted
Create a sentiment dictionary consisting of a simple wordlistSentimentDictionaryWordlist
Spike-and-slab estimationspikeslabEstimation
Output summary information on sentiment dictionarysummary.SentimentDictionaryBinary summary.SentimentDictionaryWeighted summary.SentimentDictionaryWordlist
Default preprocessing of corpus and conversion to document-term matrixtoDocumentTermMatrix
Transforms the input into a Corpus objecttransformIntoCorpus
Write dictionary to text filewrite write.SentimentDictionaryBinary write.SentimentDictionaryWeighted write.SentimentDictionaryWordlist