This project is a comprehensive solution for scraping, analyzing, and serving iPhone 12 reviews from Amazon. It includes web scraping capabilities, sentiment analysis, and a Flask-based API for interacting with the collected data.
The main components of the project are:
- Web scraping script to collect iPhone 12 reviews from Amazon
- Sentiment analysis of the collected reviews
- API endpoints for retrieving reviews and performing sentiment analysis
- A simple frontend for interacting with the API
- Web Scraping: Collects reviews, ratings, and other metadata from Amazon's iPhone 12 product page.
- Sentiment Analysis: Analyzes the sentiment of reviews using NLTK and TextBlob.
- Keyword Analysis: Identifies the most impactful positive and negative keywords in the reviews.
- RESTful API: Provides endpoints for retrieving reviews and performing sentiment analysis on new text.
- Database Storage: Stores collected reviews in an SQLite database for easy access and management.
- Simple Frontend: Includes a basic HTML interface for interacting with the API.
-
Clone the repository:
git clone https://github.com/charans2702/Amazon-ReviewRetrival-and-SentimentAnalysis.git cd Amazon_Scrapper
-
Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Download NLTK data:
python -c "import nltk; nltk.download('vader_lexicon')"
-
Run the web scraping script:
python Amazon_Scrapper.py
This will collect reviews and save them to the
amazon_reviews.db
SQLite database. -
Perform sentiment analysis on the collected reviews:
python sentiment_analysis.py
-
Start the Flask API:
python app.py
The API will be available at
http://localhost:5000
. -
Open
index.html
in a web browser to use the frontend interface.
-
Sentiment Analysis
- URL:
/sentiment
- Method: POST
- Data Params:
{ "text": "Review text here" }
- Success Response:
{ "sentiment": "positive" }
- URL:
-
Review Retrieval
- URL:
/reviews
- Method: GET
- URL Params:
color
(optional)storage
(optional)rating
(optional)
- Success Response: Array of review objects
- URL:
- Python 3.x
- BeautifulSoup4 for web scraping
- NLTK and TextBlob for sentiment analysis
- Flask for API development
- SQLite for database storage
- Pandas for data manipulation
- Scikit-learn for TF-IDF vectorization