SentimentAI is a robust, full-stack Product Intelligence Dashboard designed to transform raw Amazon customer feedback into actionable business insights. Using advanced Natural Language Processing (NLP) and custom web scraping automation, it provides a comprehensive view of market sentiment.
- 🔍 Advanced Scraping Engine: Employs Selenium with a "Smart Scroll" algorithm to bypass anti-bot measures and capture lazy-loaded reviews.
- 📊 Dynamic Sentiment Analytics: Interactive Donut Charts (via Chart.js) visualizing Positive, Neutral, and Negative distributions.
- 💡 AI-Driven Insights: Automatically generates strategic business advice based on analyzed sentiment trends.
- 📂 Multi-Input Support: Analyze data from direct Amazon URLs, uploaded CSV/TXT files, or manual text entry.
- 🌓 Premium UX/UI: Glassmorphic dashboard design with a persistent Dark/Light mode toggle.
- 📜 Analysis History: Local persistent storage for easy retrieval of previous product analyses.
- Preprocessing: NLTK-powered cleaning (Tokenization, Stop-word removal, Lemmatization).
- Vectorization: TF-IDF (Term Frequency-Inverse Document Frequency) for feature extraction.
- Classification: Random Forest Classifier for high-accuracy sentiment prediction.
To handle Amazon's dynamic content, we built a custom automation wrapper using Selenium and ChromeDriver. The script mimics human browsing behavior to trigger JavaScript events required for loading reviews that standard scrapers miss.
- Python 3.8+
- Google Chrome (latest version)
- Git (optional)
-
Clone the Repository
git clone https://github.com/muhammadumarafzaal/sentiment-analysis.git cd sentiment-analysis -
Install Dependencies
pip install -r requirements.txt
-
Download NLTK Data Run the following in a Python shell:
import nltk nltk.download(['stopwords', 'wordnet', 'omw-1.4'])
- Start the Application
python app.py
- Access the Dashboard
Open your browser and navigate to
http://127.0.0.1:5000. - Run Analysis
- URL Tab: Paste an Amazon product link and wait for the automated scraper.
- Manual/File Tab: Upload datasets or type text directly for instant classification.
- View History Access the History tab in the sidebar to review all past analysis results.
sentiment-analysis/
├── app.py # Main Flask application & API routes
├── amazon_scraper.py # Selenium-based scraping logic
├── data_preprocessing.py # Text cleaning & NLP pipeline
├── generative.py # Business insight generation
├── train_model.py # ML training & serialization
├── requirements.txt # Project dependencies
├── static/ # CSS (Glassmorphism) & JS
└── templates/ # Jinja2 HTML templates
- Umar Afzal (23F-3106)
This project is licensed under the MIT License - see the LICENSE file for details.
Developed by muhammadumarafzaal Email:umarafzaal182@gmail.com