This project is a sentiment analysis application built using React.js and integrates with a machine learning backend for sentiment analysis.
This application allows users to input text and receive sentiment analysis results. It consists of a frontend built with React.js for the user interface and a backend service for analyzing sentiment using machine learning models.
-
Sentiment Input: Users can enter text for sentiment analysis.
-
Result Display: Displays the sentiment analysis result (positive, negative, neutral) based on the input text.
-
Info Cards: Informational cards explaining different sentiment types (positive, negative, neutral).
To get a local copy up and running, follow these steps:
- Node.js installed on your local machine.
- Git installed on your local machine.
-
Clone the repo:
git clone https://github.com/your-username/your-repo.git cd your-repo
-
Install dependencies:
npm install
To run the application locally:
npm start
Open http://localhost:3000 to view it in your browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
To run tests:
npm test
Launches the test runner in the interactive watch mode.
To build the app for production:
npm run build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
This project is set up to be deployed using Vercel or any other hosting platform of your choice. See the Create React App documentation on deployment for more information.
You can learn more in the Create React App documentation.
- Python 3.x
- NLTK (Natural Language Toolkit)
- Flask
- Flask-CORS
-
Clone the repository:
git clone <repository-url> cd <repository-name>
-
Install dependencies:
pip install -r requirements.txt
To start the Flask server:
python app.py
The server will start running at http://localhost:5000
.
-
Endpoint:
/analyze
-
Method: POST
-
Request Body:
{ "text": "Text to analyze" }
-
Response:
{ "sentiment": "positive|negative|neutral" }
curl -X POST -H "Content-Type: application/json" -d '{"text": "I love this product!"}' http://localhost:5000/analyze
{
"sentiment": "positive"
}
- This API uses NLTK's VADER sentiment analysis tool.
- It supports CORS to allow cross-origin requests.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.