An interactive sentiment analysis package in R that lets users input text, automatically corrects spelling, scores sentiment using the AFINN lexicon, and returns a tidy dataframe with labeled sentiment results. Great for quick, conversational text sentiment scoring in an R environment.
- 📥 User input via console — just type and go
- 🧹 Spelling correction using the
spellingpackage - 💬 Sentiment scoring via AFINN lexicon with
tidytext - 📈 Iterative score tracking for progressive sentiment insights
- 📊 Clean output with sentiment labels and scores in a dataframe
The package is composed of three main scripts:
| Script | Purpose |
|---|---|
Sentiment.R |
Core function sentiment() to collect input and generate output |
scores.R |
Functions for calculating sentiment scores and iterative difference |
textFix.R |
Functions to clean and fix misspelled or noisy user input |
Clone the repo and use devtools to install:
# if needed:
install.packages("devtools")
# install from local path
devtools::install_local("path/to/your/sentimentR-package")This package uses the following R libraries:
dplyrtidyversetidytexttextdatacaretspelling
Make sure these packages are installed before running the code.
install.packages(c("dplyr", "tidyverse", "tidytext", "textdata", "caret", "spelling"))