An AI-powered customer review analysis tool that uses state-of-the-art NLP models to analyze sentiment, categorize feedback, and extract actionable insights from customer reviews.
Link: https://review-analyzer-ai.streamlit.app/
- Sentiment Analysis: Classify reviews as Positive, Negative, or Neutral using BERTweet
- Category Classification: Automatically categorize reviews into topics (Product Quality, Shipping, Customer Service, etc.)
- Review Summarization: Generate concise summaries from multiple reviews using BART-CNN
- Keyword Extraction: Identify key terms from positive and negative reviews
- Real-time Analytics: Visualize sentiment distribution, category breakdowns, and trends
- Advanced Filtering: Filter reviews by sentiment, category, rating, and keywords
- Custom Visualizations: Interactive Plotly charts with multiple themes
- Confidence Scores: View model confidence for each prediction
- Keyword Analysis: Discover most common words in positive/negative reviews
- Sentiment by Category: See how sentiment varies across different topics
- Rating Correlation: Analyze relationship between ratings and sentiment
- Review Explorer: Search and browse individual reviews with full metadata
- Download filtered results as CSV
- Export complete analyzed dataset
- Timestamped file naming for version control
- Python 3.8 or higher
- 4GB+ RAM recommended
- GPU optional (will use CPU if not available)
- Clone the repository
git clone https://github.com/yourusername/review-analyzer.git
cd review-analyzer- Create a virtual environment (recommended)
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Download spaCy language model
python -m spacy download en_core_web_smstreamlit run app.pyThe application will open in your default browser at http://localhost:8501
review-analyzer/
│
├── app.py # Main Streamlit application
├── review_analyzer.py # Core NLP analysis engine
├── requirements.txt # Python dependencies
├── README.md # This file
Your CSV file should contain review text in one of these column names:
review_text,text,review,content,reviewText,Text,Review,reviews, orcustomer_review
Optional rating column (automatically detected):
rating,star_rating,stars,score,Rating, orStar
review_text,rating
"Great product! Exceeded my expectations.",5
"Shipping was delayed by 3 days.",2
"Good value for money. Would recommend.",4
"Poor quality. Broke after one week.",1
"Decent product but overpriced.",3-
Upload your CSV file
- Click "Browse files" and select your review data
- Supported format: CSV with text and optional rating columns
-
Configure settings (in sidebar)
- Set sample size (0 = analyze all reviews)
- Choose visualization theme
-
Load models
- Click "Load & Initialize Models"
- Wait for models to download and initialize (first run takes longer)
-
Analyze reviews
- Click "Analyze Reviews"
- Processing time depends on dataset size (~1-2 reviews/second on CPU)
View high-level analytics:
- Key Metrics: Total reviews, sentiment breakdown, confidence scores
- Sentiment Distribution: Visual breakdown of positive/negative/neutral
- Category Analysis: Most common review topics
- Confidence Distribution: Model prediction reliability
- Rating Analysis: If ratings are available
Explore detailed insights:
- Filter reviews by sentiment, category, and rating
- View top keywords for positive and negative reviews
- Generate AI summaries for specific review segments
- Analyze sentiment patterns across categories
Browse individual reviews:
- Search reviews using keywords
- Filter by multiple criteria
- Sort by confidence, rating, or other fields
- Export filtered results to CSV
The application uses three transformer models:
| Task | Model | Purpose |
|---|---|---|
| Sentiment Analysis | finiteautomata/bertweet-base-sentiment-analysis |
Classify positive/negative/neutral |
| Category Classification | facebook/bart-large-mnli |
Zero-shot topic categorization |
| Summarization | facebook/bart-large-cnn |
Generate review summaries |
Default review categories (customizable in review_analyzer.py):
- Product Quality (Defect or Condition)
- Shipping and Delivery Experience
- Customer Service and Support
- Value for Money and Pricing
- Product Features and Functionality
- Durability and Longevity
Adjust these constants in ReviewAnalyzer class:
BATCH_SIZE = 32 # Increase for faster processing (requires more RAM)
SENTIMENT_MAX_LENGTH = 128 # Maximum tokens for sentiment analysis
CLASSIFICATION_MAX_LENGTH = 512 # Maximum tokens for classification| Hardware | Reviews/Second | 100 Reviews | 1000 Reviews |
|---|---|---|---|
| CPU (i7) | ~1-2 | ~1 min | ~10 min |
| GPU (RTX 3060) | ~10-15 | ~10 sec | ~2 min |
- Minimum: 4GB RAM
- Recommended: 8GB RAM
- With GPU: 6GB VRAM for optimal performance
Models not loading
# Clear transformers cache and reinstall
rm -rf ~/.cache/huggingface/
pip install --upgrade transformersOut of memory errors
- Reduce
BATCH_SIZEinreview_analyzer.py - Use sample size to analyze fewer reviews
- Close other applications
spaCy model not found
python -m spacy download en_core_web_smSlow performance
- Enable GPU if available
- Increase
BATCH_SIZEfor faster processing - Use sample size for large datasets
streamlit>=1.28.0
pandas>=1.5.0
plotly>=5.17.0
transformers>=4.30.0
torch>=2.0.0
spacy>=3.6.0
numpy>=1.24.0
See requirements.txt for complete list with version pinning.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
# Install development dependencies
pip install -r requirements-dev.txt
# Run tests
pytest tests/
# Format code
black .
flake8 .- Hugging Face for transformer models and the Transformers library
- Streamlit for the amazing web framework
- Plotly for interactive visualizations
- spaCy for NLP preprocessing
- Initial release
- Sentiment analysis, categorization, summarization
- Interactive Streamlit dashboard
- Export capabilities
This tool uses AI models for analysis. While generally accurate, predictions should be validated for critical business decisions. Model performance may vary based on:
- Review language and quality
- Domain-specific terminology
- Dataset size and diversity
If you find this project useful, please consider giving it a star!
Made with Python, Streamlit, and Transformers