This project is a sentiment analysis application built using Flask for the backend, a React frontend, and the BERT model for NLP-based sentiment analysis. Users can upload a CSV file with feedback data, and the application categorizes the sentiments, generates pie charts for visual insights, and displays the results dynamically.
- Overview
- Features
- Technologies Used
- How It Works
- Setup and Installation
- Usage
- Output
- Future Enhancements
- Acknowledgments
This project leverages BERT (Bidirectional Encoder Representations from Transformers) for sentiment analysis, analyzing customer feedback or textual data. Sentiments are classified into categories like "Very Positive," "Positive," "Neutral," "Negative," and "Very Negative." The results are visualized through a pie chart.
- Dynamic Sentiment Analysis: Uses the BERT NLP model for accurate sentiment classification.
- File Upload Support: Allows uploading CSV files containing textual feedback for analysis.
- Data Visualization: Generates and displays pie charts for sentiment distributions.
- User-Friendly Web Interface: Powered by Flask and React.js for seamless user interaction.
- Backend: Flask
- Frontend: React.js
- NLP Model:
nlptown/bert-base-multilingual-uncased-sentiment
from the Hugging Face Transformers library - Libraries:
- Pandas for CSV processing
- Matplotlib for chart generation
- SpaCy for text preprocessing
- Deployment Environment: Localhost
-
Input:
- User uploads a CSV file containing feedback data.
- Each feedback entry is preprocessed using SpaCy to remove stopwords and punctuation.
-
Sentiment Analysis:
- Each preprocessed feedback text is analyzed using the BERT model.
- BERT provides a sentiment label (e.g., "Very Positive") and a confidence score.
-
Visualization:
- The results are categorized and visualized as pie charts for easy understanding.
-
Output:
- The app dynamically generates HTML to display sentiment distributions with charts.
- Python 3.8 or higher
- Node.js (for React frontend)
- Pipenv or pip for Python dependency management
- Clone the Repository:
git clone <repository_url> cd sentiment-analysis-app
- Set Up the Backend:
Create a virtual environment and install dependencies:
pip install -r requirements.txt
- Start the Flask App:
python app1.py
Launch the app in your browser. Upload a CSV file containing feedback data. Ensure the file has a column named FeedbackText. Wait for the analysis to complete. View the sentiment distribution charts and detailed results.
The application produces:
Pie Charts: Visual representations of sentiment distributions (e.g., "Very Positive," "Negative"). Processed Feedback Data: CSV output showing sentiment scores and labels for each entry.
MongoDB Integration: Store feedback data and sentiment results for persistent access and historical analysis. Dashboard: Add features for filtering and viewing historical results by date or sentiment category. Advanced Visualizations: Use more sophisticated tools like Plotly or D3.js for interactive charts. Multi-language Support: Extend the app to support feedback in multiple languages. Authentication: Allow users to save their analysis securely with user accounts.
Hugging Face: For providing the nlptown/bert-base-multilingual-uncased-sentiment model. Flask: For the lightweight and flexible backend framework. React.js: For building a responsive and dynamic frontend. Matplotlib: For generating charts. SpaCy: For NLP preprocessing.
Inspiration from NLP projects and sentiment analysis examples.
Thank you :)