This project implements a hybrid Sentiment and Emotion Analysis System that combines traditional lexicon-based methods (TextBlob, VADER) with a transformer-based deep learning model (DistilRoBERTa from Hugging Face).
The system predicts both emotion categories (anger, fear, joy, love, sadness, surprise, neutral) and sentiment polarity (positive, negative, neutral) using a weighted ensemble strategy for improved accuracy.
- Lexicon-based sentiment analysis using TextBlob and VADER
- Emotion classification using DistilRoBERTa (
j-hartmann/emotion-english-distilroberta-base) - Weighted ensemble method for combining model predictions
- Robust detection of neutral sentiment/emotion
- Evaluation using accuracy, precision, recall, F1-score, confusion matrix
- Clean, modular code with preprocessing, prediction, and evaluation
- Python
- TextBlob
- VADER Sentiment
- Hugging Face Transformers
- scikit-learn
- matplotlib & seaborn
- Numpy
- Pandas
- Tensonflow
- Pytorch
- Clone the Repository
git clone https://github.com/saparya05/Employee-Management-System
cd sentiment-emotion-analysis- Activate Virtual Environment
# Linux/macOS
source env/bin/activate
# Windows
.\env\Scripts\activate- Install Dependencies
pip install -r requirements.txt- Run the Script
python main.pysample_texts = [I am so happy today! Everything is going perfectly."]
Analyzing: 'I am so happy today! Everything is going perfectly.'
Text: I am so happy today! Everything is going perfectly.
Predicted Emotion: joy
Confidence: 0.972This project uses the Emotion Dataset from Hugging Face's datasets library. Contains 6 emotion labels: sadness, joy, love, anger, fear, and surprise Automatically loaded using:
from datasets import load_dataset
dataset = load_dataset("emotion")This project is open-source and available under the MIT License.