A Streamlit Python web application to analyze sentiment in CSV files and add sentiment values to the data.
- 📊 Upload CSV files and analyze sentiment
- 🔍 Automatic sentiment classification (Positive, Negative, Neutral)
- 📈 Polarity and Subjectivity scores
- 📥 Download results as CSV
- 🎨 User-friendly interface
-
Clone or download this repository
-
Install the required dependencies:
pip install -r requirements.txt- Download TextBlob corpora (required for sentiment analysis):
python -m textblob.download_corpora- Run the Streamlit application:
streamlit run main.py-
Open your browser and navigate to the URL shown in the terminal (usually
http://localhost:8501) -
Upload a CSV file containing text data
-
Select the column containing text to analyze
-
Click "Analyze Sentiment" to process the data
-
Download the results as a CSV file with added sentiment columns:
polarity: Sentiment polarity score (-1 to 1)subjectivity: Subjectivity score (0 to 1)sentiment: Sentiment label (Positive, Negative, Neutral)
Your CSV file should contain at least one column with text data. Example:
| id | text |
|---|---|
| 1 | I love this product! |
| 2 | This is terrible. |
| 3 | It's okay. |
- Polarity: Ranges from -1 (very negative) to 1 (very positive)
- Subjectivity: Ranges from 0 (objective) to 1 (subjective)
- Sentiment Label:
- Positive (polarity > 0.1)
- Negative (polarity < -0.1)
- Neutral (polarity between -0.1 and 0.1)
- Streamlit: Web application framework
- Pandas: Data manipulation and analysis
- TextBlob: Natural language processing and sentiment analysis
- Python 3.7 or higher
- See
requirements.txtfor package versions
This project is created for educational purposes.