sentiment-analysis-social-media

๐Ÿ” Sentiment Analysis on Social Media / Reviews

Portfolio Project Data Science NLP Marketing & E-commerce

Real-time sentiment analysis system for brand feedback on Amazon, Zomato, and Swiggy reviews. Demonstrates end-to-end unstructured data mastery using rule-based (VADER), deep learning (BERT), and unsupervised (LDA) NLP techniques.


๐Ÿš€ Features

Feature Description
๐Ÿ“Š EDA Review length, rating distribution, top n-grams, word clouds
๐Ÿ˜Š VADER Rule-based sentiment, instant, no training needed
๐Ÿค– BERT HuggingFace twitter-roberta-base-sentiment, ~500MB download
๐Ÿ“Œ LDA Topic modeling (Gensim), coherence evaluation, pyLDAvis HTML
๐Ÿ–ฅ๏ธ Dashboard Streamlit app โ€” live demo + full analytics

๐Ÿ“ Project Structure

SentimentAnalysis/
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ raw/          โ† reviews.csv (1200 synthetic reviews)
โ”‚   โ””โ”€โ”€ processed/    โ† cleaned data, model outputs
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ 01_EDA.ipynb
โ”‚   โ”œโ”€โ”€ 02_Sentiment_Analysis.ipynb
โ”‚   โ””โ”€โ”€ 03_Topic_Modeling.ipynb
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ preprocess.py         โ† text cleaning pipeline
โ”‚   โ”œโ”€โ”€ vader_analysis.py     โ† VADER sentiment
โ”‚   โ”œโ”€โ”€ bert_analysis.py      โ† BERT deep learning
โ”‚   โ””โ”€โ”€ topic_modeling.py     โ† LDA topic modeling
โ”œโ”€โ”€ app/
โ”‚   โ””โ”€โ”€ dashboard.py          โ† Streamlit dashboard
โ”œโ”€โ”€ outputs/
โ”‚   โ”œโ”€โ”€ figures/              โ† auto-generated charts
โ”‚   โ””โ”€โ”€ reports/              โ† interactive LDA HTML
โ”œโ”€โ”€ run_all.py                โ† one-click quick start
โ””โ”€โ”€ requirements.txt

โšก Quick Start

1. Install dependencies

pip install -r requirements.txt
python -m spacy download en_core_web_sm

Note: BERT requires PyTorch. On CPU this works fine. For GPU, install CUDA-compatible torch from https://pytorch.org

python run_all.py

This will:

3. Manual step-by-step

# Generate dataset
python data/raw/generate_dataset.py

# Preprocess text
python src/preprocess.py

# VADER analysis (fast, no download)
python src/vader_analysis.py

# BERT analysis (downloads ~500MB model first time)
python src/bert_analysis.py

# LDA topic modeling
python src/topic_modeling.py

# Launch dashboard
streamlit run app/dashboard.py

4. Jupyter Notebooks

jupyter notebook
# Open notebooks/ and run them in order: 01 โ†’ 02 โ†’ 03

๐Ÿ“Š Models Used

VADER (Valence Aware Dictionary and sEntiment Reasoner)

BERT (cardiffnlp/twitter-roberta-base-sentiment)

LDA (Latent Dirichlet Allocation)


๐ŸŽฏ Skills Demonstrated


๐Ÿ“ˆ Sample Results

Model Accuracy Speed GPU Required
VADER ~72% โšก Instant โŒ No
BERT ~87% ๐ŸŒ Slower Recommended

๐Ÿ› ๏ธ Tech Stack

Python ยท pandas ยท NLTK ยท spaCy ยท vaderSentiment ยท HuggingFace Transformers ยท PyTorch ยท Gensim ยท pyLDAvis ยท scikit-learn ยท Streamlit ยท Plotly ยท WordCloud ยท Matplotlib ยท Seaborn


๐Ÿ“ฌ Use Cases

This project applies directly to:


Built as a Data Science portfolio project demonstrating real-world NLP capabilities.