Skip to content

bennlaufer/Sentiment-Algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentiment Algorithm (R)

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.

✨ Key Features

  • 📥 User input via console — just type and go
  • 🧹 Spelling correction using the spelling package
  • 💬 Sentiment scoring via AFINN lexicon with tidytext
  • 📈 Iterative score tracking for progressive sentiment insights
  • 📊 Clean output with sentiment labels and scores in a dataframe

🗂️ Package Structure

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

📦 Installation

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")

Dependencies

This package uses the following R libraries:

  • dplyr
  • tidyverse
  • tidytext
  • textdata
  • caret
  • spelling

Make sure these packages are installed before running the code.

install.packages(c("dplyr", "tidyverse", "tidytext", "textdata", "caret", "spelling"))

About

SentimentR is an interactive R package for real-time sentiment analysis using the AFINN lexicon. It features automated spelling correction, custom text cleaning, and iterative sentiment scoring, making it ideal for quick, accurate analysis of conversational text

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages