SentimentAnalysis
Dictionary-based sentiment analysis
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 7 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
2 of 4 committers (50.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.6%) to scientific vocabulary
Last synced: 11 months ago
·
JSON representation
Repository
Dictionary-based sentiment analysis
Basic Info
- Host: GitHub
- Owner: sfeuerriegel
- License: other
- Language: R
- Default Branch: master
- Size: 9.09 MB
Statistics
- Stars: 151
- Watchers: 18
- Forks: 43
- Open Issues: 5
- Releases: 0
Created about 10 years ago
· Last pushed almost 3 years ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# Sentiment Analysis
[](https://cran.r-project.org/package=SentimentAnalysis)
**SentimentAnalysis** performs a **sentiment analysis** of textual contents in R. This implementation utilizes various existing dictionaries, such as QDAP, Harvard IV or Loughran-McDonald. 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.
## Overview
The most important functions in **SentimentAnalysis** are:
* Compute sentiment scores from contents stored in different formats with `analyzeSentiment()`.
* If desired, convert the continuous scores to either binary sentiment classes (negative or positive) or tertiary directions (negative, neutral or positive). This conversion can be done with `convertToBinary()` or `convertToDirection()` respectively.
* Compare the calculated sentiment socres with a baseline (i.e. a gold standard). Here, `compareToResponse()` performs a statistical evaluation, while `plotSentimentResponse()` enables a visual comparison.
* Generate customized dictionaries with the help of `generateDictionary()` as part of an advanced analysis. However, this prerequisites a response variable (i.e. the baseline).
To see examples of these functions in use, check out the help pages, the demos and the vignette.
## Usage
This section shows the basic functionality of how to perform a sentiment analysis. First, install the package from CRAN. Then load the corresponding package **SentimentAnalysis**.
```{r, message=FALSE}
# install.packages("SentimentAnalysis")
library(SentimentAnalysis)
```
### Quick demonstration
This simple example shows how to perform a sentiment analysis of a single string. The result is a two-level factor with levels "positive" and "negative."
```{r}
# Analyze a single string to obtain a binary response (positive / negative)
sentiment <- analyzeSentiment("Yeah, this was a great soccer game of the German team!")
convertToBinaryResponse(sentiment)$SentimentGI
```
### Small example
The following demonstrates some of the functionality provided by **SentimentAnalysis**. It also shows its visualization and evaluation capabilities.
```{r}
# Create a vector of strings
documents <- c("Wow, I really like the new light sabers!",
"That book was excellent.",
"R is a fantastic language.",
"The service in this restaurant was miserable.",
"This is neither positive or negative.",
"The waiter forget about my a dessert -- what a poor service!")
# Analyze sentiment
sentiment <- analyzeSentiment(documents)
# Extract dictionary-based sentiment according to the QDAP dictionary
sentiment$SentimentQDAP
# View sentiment direction (i.e. positive, neutral and negative)
convertToDirection(sentiment$SentimentQDAP)
response <- c(+1, +1, +1, -1, 0, -1)
compareToResponse(sentiment, response)
# Optional visualization: plotSentimentResponse(sentiment$SentimentQDAP, response)
```
## Dictionary generation
Research in finance and social sciences nowadays utilizes content analysis to understand human decisions in the face of textual materials. While content analysis has received great traction lately, the available tools are not yet living up to the needs of researchers. This package implements a novel approach named "**dictionary generation" to study tone, sentiment and reception of textual materials.
The approach utilizes LASSO regularization to extract words from documents that statistically feature a positive and negative polarity. This immediately reveals manifold implications for practitioners, finance research and social sciences: researchers can use R to extract text components that are relevant for readers and test their hypothesis based on these.
* Proellochs, Feuerriegel and Neumann (2018): Statistical inferences for polarity identification in natural language, PLOS ONE 13(12):e0209323. [DOI: 10.1371/journal.pone.0209323](https://doi.org/10.1371/journal.pone.0209323)
* Proellochs, Feuerriegel and Neumann (2015): Generating Domain-Specific Dictionaries Using Bayesian Learning, Proceedings of the 23rd European Conference on Information Systems (ECIS 2015), Muenster, Germany. [DOI: 10.2139/ssrn.2522884](https://dx.doi.org/10.2139/ssrn.2522884)
## License
**SentimentAnalysis** is released under the [MIT License](https://opensource.org/license/mit/)
Copyright (c) 2023 Stefan Feuerriegel & Nicolas Pröllochs
Owner
- Login: sfeuerriegel
- Kind: user
- Website: http://sfeuerriegel.com
- Twitter: stfeuerriegel
- Repositories: 3
- Profile: https://github.com/sfeuerriegel
GitHub Events
Total
- Watch event: 3
Last Year
- Watch event: 3
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| sfeuerriegel | s****l@i****e | 57 |
| sfeuerriegel | s****l@e****h | 4 |
| Nicolas Pröllochs | n****s@g****m | 3 |
| Bernhard Lutz | B****z@o****e | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 8
- Total pull requests: 3
- Average time to close issues: 1 day
- Average time to close pull requests: 3 days
- Total issue authors: 7
- Total pull request authors: 3
- Average comments per issue: 2.13
- Average comments per pull request: 0.67
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rdatasculptor (2)
- abresler (1)
- M-Jen98 (1)
- abendorf (1)
- ms1948 (1)
- snvv (1)
- strategist922 (1)
Pull Request Authors
- kant (1)
- bernhardlutz (1)
- chainsawriot (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 524 last-month
- Total docker downloads: 39
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 1
(may contain duplicates) - Total versions: 8
- Total maintainers: 1
cran.r-project.org: SentimentAnalysis
Dictionary-Based Sentiment Analysis
- Homepage: https://github.com/sfeuerriegel/SentimentAnalysis
- Documentation: http://cran.r-project.org/web/packages/SentimentAnalysis/SentimentAnalysis.pdf
- License: MIT + file LICENSE
-
Latest release: 1.3-5
published almost 3 years ago
Rankings
Forks count: 1.7%
Stargazers count: 2.9%
Downloads: 11.1%
Average: 11.6%
Dependent packages count: 18.2%
Dependent repos count: 23.9%
Maintainers (1)
Last synced:
11 months ago
conda-forge.org: r-sentimentanalysis
- Homepage: https://github.com/sfeuerriegel/SentimentAnalysis
- License: MIT
-
Latest release: 1.3_4
published almost 5 years ago
Rankings
Forks count: 25.2%
Stargazers count: 27.6%
Dependent repos count: 34.0%
Average: 34.5%
Dependent packages count: 51.2%
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
- ggplot2 * imports
- glmnet * imports
- moments * imports
- ngramrr >= 0.1 imports
- qdapDictionaries * imports
- spikeslab >= 1.1 imports
- stringdist * imports
- tm >= 0.6 imports
- SnowballC * suggests
- XML * suggests
- knitr * suggests
- mgcv * suggests
- rmarkdown * suggests
- testthat * suggests