Skip to content

A sentiment analysis web app that classifies text into positive, negative, or neutral emotions using machine learning.

Notifications You must be signed in to change notification settings

tushargautam681/Sentiment-Analysis-using-Machine-Learning

Repository files navigation

Sentiment Analysis Web App

A Streamlit Python web application to analyze sentiment in CSV files and add sentiment values to the data.

Features

  • 📊 Upload CSV files and analyze sentiment
  • 🔍 Automatic sentiment classification (Positive, Negative, Neutral)
  • 📈 Polarity and Subjectivity scores
  • 📥 Download results as CSV
  • 🎨 User-friendly interface

Installation

  1. Clone or download this repository

  2. Install the required dependencies:

pip install -r requirements.txt
  1. Download TextBlob corpora (required for sentiment analysis):
python -m textblob.download_corpora

Usage

  1. Run the Streamlit application:
streamlit run main.py
  1. Open your browser and navigate to the URL shown in the terminal (usually http://localhost:8501)

  2. Upload a CSV file containing text data

  3. Select the column containing text to analyze

  4. Click "Analyze Sentiment" to process the data

  5. 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)

CSV Format

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.

Sentiment Scores

  • 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)

Technologies Used

  • Streamlit: Web application framework
  • Pandas: Data manipulation and analysis
  • TextBlob: Natural language processing and sentiment analysis

Requirements

  • Python 3.7 or higher
  • See requirements.txt for package versions

License

This project is created for educational purposes.

About

A sentiment analysis web app that classifies text into positive, negative, or neutral emotions using machine learning.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages