A beginner-friendly cloud computing mini-project that uses Natural Language Processing (NLP) to automatically analyze product reviews — detecting sentiment and product category — and provides an admin dashboard to manage review resolution status.
- Project Overview
- Features
- Technologies Used
- Project Structure
- Installation & Setup (Windows / VS Code)
- How to Run the Project
- How SQLite Works
- How Sentiment Analysis Works
- How Category Classification Works
- AWS EC2 Deployment Guide
- Screenshots
- Future Improvements
This system allows users to submit product reviews through a web interface. The backend automatically:
- Detects sentiment (Positive / Negative / Neutral) using TextBlob NLP
- Detects product category (Phone, Laptop, Chair, etc.) using keyword matching
- Stores all reviews in a local SQLite database
- Provides an Admin Dashboard where an operator can view, filter, search, and update the status of all reviews
This project is suitable as a cloud computing mini-project and can be deployed on AWS EC2 with minimal configuration.
- Clean text input form for submitting reviews
- Example review buttons for quick testing
- Real-time character counter
- Instant analysis result shown after submission
- Flash messages for success/error feedback
- Uses TextBlob polarity score
- Three classes: Positive, Negative, Neutral
- Keyword-based matching for 10 product categories
- Fallback to "Other" if no category found
- View all submitted reviews in a table
- Summary stats: total, positive, negative, unresolved counts
- Filter by: Sentiment, Category, Status
- Search by keyword in review text
- Update status inline: Unresolved → Under Process → Resolved
- Delete reviews
- Auto-submit filters on dropdown change
| Layer | Technology | Purpose |
|---|---|---|
| Backend | Flask 3.x | Web framework |
| Database | SQLite + SQLAlchemy ORM | Data storage |
| NLP | TextBlob | Sentiment analysis |
| ML/Data | scikit-learn, pandas | ML utilities (expandable) |
| NLP Extras | nltk, joblib | Text processing support |
| Frontend | Bootstrap 5 | Responsive UI |
| Frontend | Vanilla CSS + JS | Custom styling & interactivity |
project/
│
├── app.py ← Main Flask application (all routes)
├── requirements.txt ← Python dependencies
├── reviews.db ← SQLite database (auto-created on first run)
├── README.md ← This file
│
├── models/
│ ├── __init__.py
│ └── database.py ← SQLAlchemy Review model + db init
│
├── utils/
│ ├── __init__.py
│ ├── sentiment.py ← TextBlob sentiment analysis function
│ └── category.py ← Keyword-based category detection function
│
├── templates/
│ ├── index.html ← User review submission page
│ └── dashboard.html ← Admin dashboard page
│
└── static/
├── css/
│ └── style.css ← Custom CSS (modern design)
└── js/
└── main.js ← Client-side JS (form validation, UX)
- Python 3.9+ installed (python.org)
- VS Code installed (code.visualstudio.com)
- Git (optional)
File → Open Folder → Select your project folder
Terminal → New Terminal (or Ctrl + `)
python -m venv venvThis creates an isolated Python environment inside a venv/ folder.
venv\Scripts\activateYou should see (venv) at the start of the terminal prompt.
pip install -r requirements.txtTextBlob needs extra data for sentiment analysis:
python -m textblob.download_corporaIf that doesn't work, run:
python -c "import nltk; nltk.download('punkt'); nltk.download('averaged_perceptron_tagger')"
python app.pyYou should see:
[DB] Database initialized — tables created if not present.
* Running on http://0.0.0.0:5000
* Running on http://127.0.0.1:5000
Open your browser and go to:
- User Review Page: http://127.0.0.1:5000
- Admin Dashboard: http://127.0.0.1:5000/dashboard
To stop the server: press Ctrl + C in the terminal.
SQLite is a lightweight, file-based database — perfect for development and small projects.
- The database file
reviews.dbis automatically created the first time you runapp.py - No separate database server is needed
- The database stores all reviews in a table called
reviews
Table columns:
| Column | Type | Description |
|---|---|---|
| id | Integer | Auto-incremented unique ID |
| review_text | Text | The raw review entered by the user |
| sentiment | String | Positive / Negative / Neutral |
| category | String | Detected product category |
| status | String | Unresolved / Under Process / Resolved |
| created_at | DateTime | Timestamp when the review was submitted |
SQLAlchemy ORM (Object Relational Mapper) allows us to work with the database using Python objects instead of raw SQL queries. For example:
# Saving a review
new_review = Review(review_text="Great phone!", sentiment="Positive", ...)
db.session.add(new_review)
db.session.commit()
# Fetching reviews
reviews = Review.query.filter_by(sentiment="Positive").all()Library used: TextBlob
TextBlob is a Python NLP library. It analyzes text and returns a polarity score between -1.0 and +1.0:
| Polarity Range | Meaning | Our Label |
|---|---|---|
| > 0.1 | Positive | ✅ Positive |
| < -0.1 | Negative | ❌ Negative |
| Between | Neutral | ➖ Neutral |
Code example (utils/sentiment.py):
from textblob import TextBlob
def analyze_sentiment(review_text):
blob = TextBlob(review_text)
polarity = blob.sentiment.polarity # -1.0 to +1.0
if polarity > 0.1:
return "Positive"
elif polarity < -0.1:
return "Negative"
else:
return "Neutral"Examples:
- "The phone is amazing!" → polarity ≈ 0.8 → Positive
- "The chair was broken and terrible" → polarity ≈ -0.7 → Negative
- "The laptop battery is average" → polarity ≈ 0.0 → Neutral
Method: Simple keyword matching (no ML model needed)
A Python dictionary maps each category to a list of keywords:
CATEGORY_KEYWORDS = {
"Phone": ["phone", "smartphone", "mobile", "iphone"],
"Laptop": ["laptop", "notebook", "macbook"],
"Chair": ["chair", "seat", "stool"],
# ... etc
}The review is converted to lowercase, then scanned for each keyword. The first match wins.
Examples:
- "My phone screen cracked" → finds "phone" → Phone
- "The laptop is slow" → finds "laptop" → Laptop
- "It arrived broken" → no keyword found → Other
This approach is simple, fast, and easy to extend by adding more keywords.
- Log in to AWS Console
- Go to EC2 → Instances → Launch Instance
- Choose Ubuntu Server 22.04 LTS (Free Tier)
- Instance type: t2.micro (Free Tier)
- Create or select a key pair (
.pemfile) — save it safely - Under Security Group, add a rule:
- Type: Custom TCP
- Port:
5000 - Source:
0.0.0.0/0(allows public access)
- Click Launch Instance
On Windows, use PowerShell or Git Bash:
ssh -i "your-key.pem" ubuntu@<your-ec2-public-ip>Replace
your-key.pemwith your key file path and<your-ec2-public-ip>with your EC2 public IP.
On first connect, type yes to accept the fingerprint.
sudo apt update
sudo apt install python3 python3-pip python3-venv -yOption A — Using SCP (from your Windows terminal):
scp -i "your-key.pem" -r "C:/path/to/project" ubuntu@<ec2-ip>:~/ai-review-systemOption B — Using Git:
git clone https://github.com/yourusername/ai-review-system.git
cd ai-review-systemcd ~/ai-review-system
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python -m textblob.download_corporapython app.pyOpen your browser and go to:
http://<your-ec2-public-ip>:5000
Make sure port 5000 is open in your EC2 Security Group (Step 1).
nohup python app.py > output.log 2>&1 &This keeps the app running even after you close the SSH session.
For production, run with Gunicorn:
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app(Add screenshots here after running the application)
| Page | Description |
|---|---|
| Review Page | User submits a review, sees result |
| Analysis Result | Sentiment and category displayed |
| Admin Dashboard | All reviews with stats and filter bar |
| Status Update | Operator changes review status inline |
- User Authentication — Add login for admin dashboard
- Advanced ML Model — Replace keyword matching with a trained TF-IDF or BERT classifier
- Email Notifications — Notify admins when new negative reviews arrive
- Charts & Analytics — Add Plotly/Chart.js charts on the dashboard
- Pagination — Handle large numbers of reviews efficiently
- Export to CSV — Let admin download review data
- Multi-language Support — Detect sentiment in languages other than English
- REST API — Expose endpoints for mobile/other frontends
- PostgreSQL — Upgrade from SQLite to PostgreSQL for production
- Docker — Containerize for easier deployment
This project is for educational purposes. Free to use and modify.
Built with ❤️ using Flask · TextBlob · SQLAlchemy · Bootstrap 5