https://github.com/hr-fahim/customer-sentiment-analysis-api
Basic Sentiment Analysis API implemented with Python, Flask, and TextBlob.
https://github.com/hr-fahim/customer-sentiment-analysis-api
flask textblob-sentiment-analysis
Last synced: 17 days ago
JSON representation
Basic Sentiment Analysis API implemented with Python, Flask, and TextBlob.
- Host: GitHub
- URL: https://github.com/hr-fahim/customer-sentiment-analysis-api
- Owner: HR-Fahim
- Created: 2024-03-08T15:53:08.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-08T15:58:12.000Z (almost 2 years ago)
- Last Synced: 2025-01-14T13:54:47.746Z (11 months ago)
- Topics: flask, textblob-sentiment-analysis
- Language: Python
- Homepage:
- Size: 11.5 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Customer Sentiment Analysis API
This project demonstrates how to create a simple Sentiment Analysis API using Python, Flask, and TextBlob.
## Setup
### 1. Prerequisites
- Python 3.x
- pip (Python package manager)
### 2. Clone the Repository
```bash
git clone https://github.com/your-username/Sentiment-Analysis-API.git
cd Sentiment-Analysis-API
```
### 3. Set Up Virtual Environment (Optional but Recommended)
```bash
python -m venv myenv
```
Activate the virtual environment:
- On Windows:
```bash
myenv\Scripts\activate
```
- On macOS/Linux:
```bash
source myenv/bin/activate
```
### 4. Install Dependencies
```bash
pip install -r requirements.txt
```
## Usage
### Running the Flask Application
```bash
python app.py
```
The application should start running at `http://localhost:5000`.
### Testing the API
Use `curl` or Postman to test the API. Send a POST request to `http://localhost:5000/sentiment` with a JSON payload containing the text to be analyzed.
Example using `curl`:
```bash
curl -X POST http://localhost:5000/sentiment -H "Content-Type: application/json" -d '{"text": "I love this product!"}'
```
or
```bash
Invoke-RestMethod -Method Post -Uri http://localhost:5000/sentiment -ContentType "application/json" -Body '{"text": "I love this product!"}'
```
### Result

It shows a response indicating the sentiment analysis result.
## Future Work
To extend this project into a more sophisticated sentiment analysis system the following steps can be considered in future:
- Collect a labeled dataset for training.
- Train a machine learning model using libraries like scikit-learn or TensorFlow/Keras.
- Integrate the trained model into the Flask API for sentiment analysis.