This project is a Streamlit-based web application designed to perform sentiment analysis on customer feedback. It supports both single feedback input and batch processing via CSV uploads. The project uses TextBlob for sentiment analysis and visualizes results using matplotlib and seaborn.
The Customer Feedback Sentiment Analyzer allows businesses to understand the sentiments behind their customer feedback efficiently. Whether analyzing a single piece of feedback or processing bulk data, the app is built to provide actionable insights.
This application can be adapted for other use cases, such as analyzing feedback in mergers and acquisitions (M&A), product reviews, or employee feedback surveys.
- Single Input Analysis: Users can type in individual feedback and instantly analyze the sentiment.
- Batch Processing: Upload a CSV file with multiple feedback entries for batch sentiment analysis.
- Visualization: Displays a bar chart summarizing the sentiment distribution (Positive, Negative, Neutral).
- Downloadable Results: Users can download the analyzed results in CSV format.
- Expandable Use Cases: The app's framework can be adapted for various feedback scenarios.
- Python
- Streamlit (Frontend)
- TextBlob (Sentiment Analysis)
- matplotlib & seaborn (Data Visualization)
- pandas (Data Handling)
project-folder/
│
├── app.py # Main Streamlit app code
├── sample_feedback.csv # Example input CSV file
├── requirements.txt # Python dependencies for deployment
└── README.md # Project documentation
To replicate this project, clone the GitHub repository to your local machine:
git clone https://github.com/<your-username>/Sentiment-Analysis-for-Customer-Feedback.git
cd Sentiment-Analysis-for-Customer-Feedback
Ensure Python 3.8+ is installed. Install the required dependencies using:
pip install -r requirements.txt
The requirements.txt
file includes:
streamlit
textblob
pandas
matplotlib
seaborn
Launch the app in your local browser using Streamlit:
streamlit run app.py
The app will open in your default browser at http://localhost:8501
.
- Enter your feedback in the text box.
- Click Analyze Sentiment.
- The sentiment (Positive, Negative, or Neutral) and polarity score will be displayed.
- Upload a CSV file with a column named
Customer Feedback
.- Example format:
Customer Feedback "The service was excellent!" "Very poor experience, will not recommend." "The product is okay but could be improved."
- Example format:
- The app will analyze all feedback in the CSV and display the results in a table.
- You can download the results as a CSV file.
- Push your project to a GitHub repository.
- Go to Streamlit Cloud.
- Click New App and connect your GitHub repository.
- Select the branch (e.g.,
main
) and the file path toapp.py
. - Click Deploy. Streamlit Cloud will provide a public URL for your app.
- Heroku: Use the
requirements.txt
andProcfile
for deployment. - AWS/Google Cloud: Containerize the app using Docker and deploy.
This project can be easily modified for various use cases by updating the input format and sentiment logic. Examples include:
- M&A Sentiment Analysis: Analyze feedback on mergers and acquisitions.
- Product Review Analysis: Assess product feedback from e-commerce platforms.
- Employee Surveys: Gauge employee sentiments from survey results.
- Replace the
Customer Feedback
input field with your desired context (e.g., "Employee Comments"). - Update the sample CSV and README documentation to reflect the new use case.
Here is sample data for an M&A use case:
Customer Feedback
"The acquisition was seamless and well-executed."
"The process was confusing and lacked transparency."
"Great communication between the teams involved."
"Very poor execution; deadlines were missed repeatedly."
Feedback | Sentiment | Polarity Score |
---|---|---|
The acquisition was seamless and well-executed. | Positive | 0.75 |
The process was confusing and lacked transparency. | Negative | -0.4 |
Great communication between the teams involved. | Positive | 0.6 |
Very poor execution; deadlines were missed repeatedly. | Negative | -0.8 |
If a module (e.g., textblob
) is missing, ensure you’ve installed all dependencies:
pip install -r requirements.txt
- Ensure
app.py
is in the root directory of your repository. - Verify that the required libraries are listed in
requirements.txt
.
- Resolve conflicts manually, then push the changes:
git pull origin main --allow-unrelated-histories
git push -u origin main
- Extend Features: Add advanced sentiment analysis using machine learning models like
NLTK
ortransformers
. - Integrate APIs: Fetch real-time feedback from platforms like Twitter or Google Reviews.
- Improve UI: Use Streamlit themes or integrate with a frontend framework for a polished interface.
- Streamlit for an excellent platform for rapid app deployment.
- TextBlob for providing easy sentiment analysis tools.
- Inspiration drawn from real-world use cases like M&A feedback analysis.