An NLP-powered product review intelligence system that classifies sentiment, discovers product categories, and generates AI-written buying guides β deployed as an Amazon-style Streamlit web app.
GitHub: https://github.com/normandy17/ReviewSense
Live App: https://reviewsense-amz-beauty.streamlit.app/
ReviewSense is a full end-to-end NLP project built on the McAuley Amazon Beauty dataset. It tackles three tasks:
| Task | Description | Model |
|---|---|---|
| 1 β Sentiment Analysis | Classify reviews as Positive, Neutral, or Negative | DistilBERT fine-tuned |
| 2 β Category Clustering | Group sparse product categories into meaningful meta-categories | BERTopic + K-Means + GPT-4o-mini |
| 3 β Review Summarization | Generate "Top 10 Best" buying guide articles per category | GPT-4o-mini (3-step pipeline) |
All three models are integrated into a Streamlit web app with an Amazon-style product browsing experience.
ReviewSense/
β
βββ notebooks/
β βββ 01_EDA.ipynb β Exploratory data analysis
β βββ 02_Sentiment_Classifier.ipynb β DistilBERT training & evaluation
β βββ 03_Product_Clustering.ipynb β BERTopic clustering pipeline
β βββ 04_Summarizer.ipynb β GPT-4o-mini article generation
β
βββ Sentiment Analyzer 3.0/ β Saved HuggingFace sentiment model
β βββ config.json
β βββ pytorch_model.bin
β βββ tokenizer files...
β
βββ summaries/ β AI-generated article .txt files
β βββ Article_CategoryName.txt
β βββ Summary_CategoryName.txt
β
βββ data/
β βββ reviews_final.csv β Final joined dataset
β
βββ app.py β Streamlit web app
βββ requirements.txt
βββ README.md
- Python 3.10+
- An OpenAI API key (for the summarizer and Streamlit live summaries)
pip install -r requirements.txtexport OPENAI_API_KEY="sk-..."On Windows:
set OPENAI_API_KEY=sk-...The project uses the McAuley Amazon Beauty Reviews dataset.
- Download from: https://cseweb.ucsd.edu/~jmcauley/datasets.html#amazon_reviews
- Select the Beauty category
- Place the downloaded file(s) in the
data/folder - Run
01_EDA.ipynbto clean and exportreviews_final.csv
Run the notebooks in order β each one produces outputs consumed by the next.
jupyter notebook notebooks/01_EDA.ipynb- Loads and inspects the raw dataset
- Plots category distribution, rating balance, text length analysis, word clouds
- Exports
data/reviews_final.csv
jupyter notebook notebooks/02_Sentiment_Classifier.ipynb- Maps star ratings β Positive (4β5β ) / Neutral (3β ) / Negative (1β2β )
- Trains DistilBERT (
distilbert-base-uncased) on balanced, downsampled data - Input: review
title+ reviewtextcombined - Saves the model to
./Sentiment Analyzer 3.0/ - Final accuracy: 83% β balanced F1 across all 3 classes
jupyter notebook notebooks/03_Product_Clustering.ipynb- Embeds product names using
distilbert-base-nli-stsb-mean-tokens - Runs BERTopic with K-Means to discover natural product groupings
- Uses GPT-4o-mini to assign meaningful category names to each cluster
- Adds
bertopic_category_namecolumn to the dataset
jupyter notebook notebooks/04_Summarizer.ipynb- For each meta-category, selects the top 10 products by rating and volume
- Step 1 β Curate: picks 8 reviews per star rating (1β5), prioritising verified purchases and helpful votes
- Step 2 β Summarize: one GPT-4o-mini call per product β Overall Sentiment, Top 3 Pros, Top 3 Cons, Best For
- Step 3 β Write Article: feeds all 10 summaries to GPT β generates full "Top 10 Best {category}" article with a Category Winner and Buying Guide
- Saves outputs to
summaries/Article_{category}.txtandsummaries/Summary_{category}.txt
streamlit run app.pyThe app will open at http://localhost:8501
| Page | Description |
|---|---|
| π Home | Project overview, pipeline diagram, dataset statistics |
| π Sentiment Analyzer | Paste any review text β live DistilBERT prediction with confidence score |
| ποΈ Categories | Grid of all BERTopic meta-categories with product and review counts |
| π¦ Category Page | Top 10 products + full searchable product list with images |
| ποΈ Product Page | Amazon-style view: images, star breakdown, paginated reviews (10 at a time) with sentiment badges, live GPT-4o-mini summary on demand |
| π° Buying Guide | AI-generated buying articles rendered per category with download option |
- Product AI summaries are cached in session state β GPT is only called once per product per session
- Sentiment is run live on every review card using the saved DistilBERT model
- Product images load from Amazon CDN URLs with automatic placeholder fallback
| Parameter | Value |
|---|---|
| Base model | distilbert-base-uncased |
| Labels | 3 (Positive / Neutral / Negative) |
| Input | Review title + review text (concatenated) |
| Dataset size | ~170,000 reviews |
| Balancing strategy | Downsampled to match smallest class |
| Training epochs | 3 |
| Overall accuracy | 83% |
| Negative F1 | 0.82 |
| Neutral F1 | 0.75 |
| Positive F1 | 0.92 |
Key decision: The first model reached 95% accuracy but had poor F1 on Negative and Neutral classes due to severe class imbalance. Switching to a larger balanced dataset and downsampling to the smallest class resolved this.
| Parameter | Value |
|---|---|
| Embedding model | distilbert-base-nli-stsb-mean-tokens |
| Clustering | BERTopic with K-Means |
| Category naming | GPT-4o-mini |
| Input | Product name |
| Output | 4β6 meta-categories |
Key decision: Standalone K-Means forced equal cluster sizes regardless of natural data distribution. BERTopic with K-Means respects semantic groupings β one category legitimately holding 70% of products was confirmed correct on inspection.
| Parameter | Value |
|---|---|
| LLM | GPT-4o-mini |
| Reviews per product | 8 per star rating (1β5) = up to 40 reviews |
| Review priority | verified_purchase + helpful_vote |
| GPT calls per category | 10 (one per product) + 1 (final article) |
| Output | Per-product summary + full category article |
The app is deployed on Streamlit Community Cloud.
Live URL: <!-- ADD YOUR HOSTED APP URL HERE -->
To deploy your own instance:
- Push this repository to GitHub
- Go to share.streamlit.io
- Connect your repo and select
app.py - Add
OPENAI_API_KEYunder the Secrets panel - Deploy β a public URL is generated automatically
- NLP models: HuggingFace Transformers, BERTopic, sentence-transformers
- LLM: OpenAI GPT-4o-mini
- Data: pandas, numpy
- Visualisation: matplotlib, seaborn
- App: Streamlit
- Training: PyTorch
Dataset: McAuley Lab β Amazon Reviews
Base model: DistilBERT β Hugging Face
Topic modelling: BERTopic