Skip to content

ghulamraza110/sentiment-analysis-dashboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 Sentiment Analysis Dashboard

A comprehensive web-based sentiment analysis tool for analyzing social media text from platforms like Twitter, Facebook, and Instagram. Built with Python, Streamlit, VADER, and spaCy.


🎯 Features

  • Real-time Sentiment Analysis: Analyze individual texts instantly
  • Batch Processing: Analyze multiple texts at once
  • Sample Data: Pre-loaded dataset for testing
  • Interactive Visualizations:
    • Sentiment distribution pie charts
    • Score distribution histograms
    • Sentiment score bar charts
    • Word clouds for each sentiment category
    • Confidence level analysis
  • Social Media Text Handling:
    • Emoji recognition
    • Hashtag processing
    • Slang normalization
    • @mention handling
    • URL removal
  • Export Functionality: Download results as CSV
  • Professional UI: Clean, modern interface with Streamlit

🛠️ Tools & Frameworks

  • Python 3.8+
  • VADER Sentiment: Lexicon and rule-based sentiment analysis
  • spaCy: Natural language processing
  • Streamlit: Web application framework
  • Plotly: Interactive visualizations
  • WordCloud: Word cloud generation
  • Pandas: Data manipulation

📊 Dataset

Sample dataset inspired by Sentiment140, containing 50 social media posts with:

  • Various sentiment types (positive, negative, neutral)
  • Emojis and special characters
  • Hashtags and mentions
  • Slang and informal language

🚀 Installation

Install Python dependencies:

pip install -r requirements.txt

Download spaCy language model (optional, for advanced preprocessing):

python -m spacy download en_core_web_sm

💻 Usage

Run the application:

streamlit run app.py

Open your browser to the URL shown (typically http://localhost:8501)

Choose analysis mode:

  • Single Text: Analyze one text at a time
  • Batch Analysis: Analyze multiple texts via manual input or file upload
  • Sample Data: Use pre-loaded sample posts

View results:

  • Sentiment classification (Positive/Negative/Neutral)
  • Compound score (-1 to +1)
  • Detailed sentiment scores
  • Interactive visualizations
  • Word clouds
  • Export results as CSV

📁 Project Structure

sentiment-analysis/
├── app.py                  # Main Streamlit application
├── sentiment_analyzer.py   # VADER sentiment analysis engine
├── data_handler.py         # Data loading and processing
├── visualizations.py       # Chart and visualization functions
├── requirements.txt        # Python dependencies
└── README.md               # This file

🎓 How It Works

Sentiment Classification

Uses VADER (Valence Aware Dictionary and sEntiment Reasoner):

  • Positive: Compound score ≥ 0.05 😊
  • Neutral: -0.05 < Compound score < 0.05 😐
  • Negative: Compound score ≤ -0.05 😞

Text Preprocessing

  • Slang normalization: Converts common slang (lol, omg, etc.) to full words
  • Hashtag processing: Removes # symbol but keeps the word
  • Mention removal: Removes @mentions
  • URL removal: Strips out web links
  • Emoji preservation: VADER handles emojis natively

Confidence Levels

  • High: |compound score| ≥ 0.5
  • Medium: 0.2 ≤ |compound score| < 0.5
  • Low: |compound score| < 0.2

🔍 Practical Use Cases

  • Brand Monitoring
  • Political Campaign Analysis
  • Social Listening
  • Customer Feedback Analysis
  • Crisis Management
  • Market Research

📈 Sample Output

Sentiment: Positive 😊
Compound Score: 0.8516
Confidence: High

Detailed Scores:
- Positive: 0.4820
- Negative: 0.0000
- Neutral: 0.5180

🎨 Features Showcase

Single Text Analysis

  • Input any social media text
  • Get instant sentiment classification
  • View detailed score breakdown
  • See processed text comparison

Batch Analysis

  • Manual input (multiple lines)
  • File upload (CSV/TXT)
  • Analyze up to hundreds of texts
  • Comprehensive statistics

Visualizations

  • Distribution Charts
  • Score Histograms
  • Bar Charts
  • Word Clouds
  • Confidence Analysis

🤝 Contributing

This is an educational project demonstrating sentiment analysis concepts. Feel free to:

  • Add more slang terms to the dictionary
  • Improve preprocessing logic
  • Add new visualization types
  • Enhance the UI/UX

📝 Notes

  • VADER works best with social media text and informal language
  • The model is lexicon-based, so it doesn’t require training
  • Emojis significantly impact sentiment scores
  • Context and sarcasm may not always be detected accurately

🔗 Resources


📄 License

This project is for educational purposes. Feel free to use and modify as needed.


🙏 Acknowledgments

  • VADER sentiment analysis tool by C.J. Hutto
  • Sentiment140 dataset for inspiration
  • Streamlit for the amazing web framework
  • spaCy for NLP capabilities

About

A comprehensive web-based sentiment analysis tool for analyzing social media text from platforms like Twitter, Facebook, and Instagram. Built with Python, Streamlit, VADER, and spaCy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages