Sentiment Analysis on Product Reviews
Text classification project to predict Positive or Negative sentiment from Amazon product reviews. TF-IDF + Logistic Regression, NLTK preprocessing, and a Flask web app with dark modern UI.
Overview
A complete NLP pipeline for binary sentiment classification of Amazon product reviews. The project includes exploratory data analysis, text preprocessing with NLTK, multiple classifier comparisons (Logistic Regression and Naive Bayes with TF-IDF and CountVectorizer), and a production Flask web app. Users can paste or type a review and get an instant Positive or Negative prediction with a clean, dark-themed UI.
Challenge
Large volumes of product reviews are impossible to read manually. The task was to compare text representations and classifiers to reliably label reviews as positive or negative, and serve the best model for real-time use.
Solution
TF-IDF + Logistic Regression pipeline with NLTK preprocessing, deployed as a Flask inference app.
Architecture
NLTK preprocessing · TfidfVectorizer (max_features=5000, ngram_range 1-2) · Logistic Regression · Flask UI
Results
- Evaluation: Accuracy comparison table across models
- Reports: Precision, Recall, F1
- Visuals: Confusion matrices
- Reusable preprocessing in src/preprocessing.py
- Best model saved as models/best_model.joblib (vectorizer + classifier)
- Flask UI: textarea + Analyze button, result card (Positive green / Negative red)
- Clear project structure: notebook for training, app.py for inference
Technologies
- Python 3.10+
- Flask
- NLTK
- scikit-learn
- Pandas
- NumPy
- Matplotlib
- Seaborn
- HTML/CSS/JS
Loading project…