This project is a Flask API that performs sentiment analysis using NLTK's VADER (Valence Aware Dictionary and sEntiment Reasoner). It determines whether a given text is positive, negative, or neutral based on predefined lexicon-based sentiment scores.
- Rule-based sentiment analysis using NLTK's VADER.
- REST API built with Flask for easy integration.
- JSON-based input and output for seamless communication.
- Bonus: Sentiment trend visualization using Matplotlib or Seaborn.
- Python
- Flask (for API development)
- NLTK (for sentiment analysis)
- Matplotlib/Seaborn (optional, for visualization)
Ensure you have Python 3.7+ installed.
git clone https://github.com/fatma20010/sentiment-analysis-tool-using-NLTK-s-VADER.git
cd sentiment-analysis-tool-using-NLTK-s-VADERconda create -n sentiment_analysis
conda activate sentiment_analysispython app.pyBy default, the API runs on http://127.0.0.1:5000.
- Method:
POST - Request Format: JSON
- Request Body:
{
"text": "I love this product!"
}- Response: JSON with sentiment scores
{
"neg": 0.0,
"neu": 0.254,
"pos": 0.746,
"compound": 0.8316
}curl -X POST "http://127.0.0.1:5000/analyze" -H "Content-Type: application/json" -d '{"text": "I love this product!"}'You can extend this project by analyzing multiple texts and visualizing sentiment trends using Matplotlib or Seaborn.
- Add support for multilingual sentiment analysis.
- Implement deep learning models (BERT, LSTMs) for better accuracy.
- Deploy the API on Heroku, AWS, or Render for public use.
Feel free to fork this repository and submit pull requests. Any improvements or bug fixes are welcome!