This project is a simple web application built using Flask, which takes user input from an HTML form and performs sentiment analysis on the provided text. The app measures whether the inputted phrase is positive, negative, or neutral using the TextBlob
library and displays the result back to the user.
- User Input: Users can input a phrase through a web interface.
- Sentiment Analysis: The app processes the input text using
TextBlob
and determines the sentiment polarity.- Polarity: A value between -1.0 and 1.0, where:
- Negative: less than 0
- Neutral: 0
- Positive: greater than 0
- Polarity: A value between -1.0 and 1.0, where:
- REST API: The project includes a RESTful API that can be accessed using tools like Postman to send input data and receive sentiment results in JSON format.
- Backend: Flask (Python)
- Frontend: HTML, CSS
- Sentiment Analysis: TextBlob
- Database: MySQL
- API Testing: Postman
- Clone the repository:
git clone https://github.com/ChathuminiBandara/TextBlob_Flask.git
- Navigate to the project directory:
cd TextBlob_Flask
- Install the required Python packages:
pip install -r requirements.txt
- Run the Flask app:
python app.py
- Open the app in your browser at
http://127.0.0.1:5000
.
To test the API:
- Use Postman to send a
POST
request to the following endpoint:POST http://127.0.0.1:5000/sentiment
- In the request body, use the following JSON format:
{ "phrase": "Your input text here" }
- Add authentication for API access.
- Implement more advanced NLP features such as entity recognition and language translation.
- Expand database functionality for storing and tracking sentiment analysis results.
\