Skip to content

hari7261/NLP-social-media-Sentiment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ AI-Powered Social Media Sentiment Analysis Tool

A comprehensive, AI-driven platform for analyzing emotional tone and sentiment across social media platforms. This tool helps brands, organizations, and researchers understand public opinion, detect crises early, and make data-driven decisions.

Platform Python Flask AI

🎯 Key Features

πŸ“Š Multi-Platform Analysis

  • Reddit: Posts and comments from relevant subreddits
  • YouTube: Video comments analysis
  • Web Scraping: Custom data collection from various sources

🧠 Advanced AI Analysis

  • Multi-Level Sentiment: Basic (positive/negative/neutral) + Advanced emotions
  • VADER + TextBlob: Enhanced sentiment accuracy
  • Gemini AI Integration: Context-aware interpretation
  • Emotion Detection: Joy, anger, fear, sadness, surprise, disgust

🎯 Use Cases

πŸ›‘οΈ Brand Monitoring

  • Track brand sentiment across platforms
  • Monitor product launches and campaigns
  • Competitive analysis and benchmarking

⚑ Crisis Management

  • Real-time crisis detection with scoring (0-100)
  • Automated alerts for negative sentiment spikes
  • Early warning system for reputation management

πŸ“ˆ Market Research

  • Customer sentiment analysis
  • Product feedback analysis
  • Market trend identification

πŸ“’ Campaign Tracking

  • Marketing campaign effectiveness
  • Influencer impact measurement
  • ROI analysis through sentiment

πŸ—³οΈ Public Opinion Analysis

  • Political sentiment tracking
  • Social issue monitoring
  • Real-time opinion polls

πŸš€ Quick Start

1. Installation

# Clone the repository
git clone <repository-url>
cd NLP-social media-Sentiment-Analysis-main

# Run setup script
python setup.py

2. Configuration (Optional)

Edit config.py to add your API keys:

# Reddit API (Optional - fallback to web scraping)
REDDIT_CLIENT_ID = "your_client_id"
REDDIT_CLIENT_SECRET = "your_client_secret"

3. Launch Application

python app.py

Open your browser to: http://localhost:5000

πŸ“Š Dashboard Overview

Analysis Dashboard

  • Query Input: Brand name, product, or any topic
  • Platform Selection: Choose Reddit, YouTube
  • Analysis Type: Brand monitoring, crisis management, etc.
  • Sample Size: 50-500 posts for analysis

Real-Time Monitoring

  • Live Sentiment Tracking: Continuous monitoring
  • Crisis Alerts: Automated notifications
  • Trend Analysis: Historical sentiment patterns

Visualizations

  • Sentiment Distribution: Pie charts showing positive/negative/neutral
  • Emotion Analysis: Bar charts for detailed emotions
  • Platform Comparison: Cross-platform sentiment analysis
  • Crisis Gauge: Risk assessment visualization

πŸ”§ Technical Architecture

Backend Stack

  • Flask: Web framework
  • NLTK + VADER: Sentiment analysis engine
  • Gemini AI: Advanced language understanding
  • Selenium: Web scraping automation
  • Pandas: Data processing and analysis

Frontend Stack

  • Tailwind CSS: Modern responsive design
  • JavaScript: Interactive dashboard
  • Chart.js/Plotly: Data visualizations
  • Font Awesome: Icons and UI elements

Data Pipeline

  1. Data Collection: Multi-platform scraping
  2. Preprocessing: Text cleaning and normalization
  3. Sentiment Analysis: AI-powered classification
  4. Emotion Detection: Advanced psychological analysis
  5. Insights Generation: AI-powered recommendations
  6. Visualization: Interactive charts and reports

πŸ“ˆ Analysis Capabilities

Sentiment Metrics

  • Compound Score: Overall sentiment (-1 to +1)
  • Positive/Negative/Neutral: Percentage distribution
  • Subjectivity: Opinion vs. factual content
  • Polarity: Emotional intensity

Emotion Detection

  • Joy: Happiness, excitement, delight
  • Anger: Frustration, irritation, rage
  • Fear: Anxiety, worry, concern
  • Sadness: Depression, grief, disappointment
  • Surprise: Shock, amazement, wonder
  • Disgust: Revulsion, distaste, rejection

Crisis Scoring

  • Algorithm: Weighted combination of negative sentiment and anger/fear emotions
  • Scale: 0-100 (0 = No risk, 100 = Critical crisis)
  • Thresholds:
    • 0-30: Low risk (Green)
    • 31-70: Medium risk (Orange)
    • 71-100: High risk (Red)

πŸ“‹ Use Case Examples

Brand Monitoring Example

Query: "iPhone 15"
Platforms: Reddit
Analysis: Product launch sentiment
Result: 73% positive, Crisis Score: 15/100
Insight: "Highly positive reception, strong market appeal"

Crisis Management Example

Query: "Company XYZ data breach"
Platforms: Reddit, YouTube
Analysis: Crisis detection
Result: 65% negative, Crisis Score: 85/100
Alert: "HIGH CRISIS RISK: Immediate action recommended"

Campaign Tracking Example

Query: "#BrandCampaign2024"
Platforms: Reddit
Analysis: Marketing campaign effectiveness
Result: 58% positive, High engagement
Insight: "Campaign resonating well with target audience"

πŸš€ Future Enhancements

Planned Features

  • Real-time streaming: WebSocket integration
  • Machine Learning: Custom sentiment models
  • Geographic Analysis: Location-based sentiment
  • Influencer Tracking: Key opinion leader analysis
  • Historical Trends: Long-term pattern analysis
  • Multi-language Support: Global sentiment analysis

Built with ❀️ using AI and advanced analytics for better social media understanding.

πŸš€ Quick Start

  1. Clone the repository
git clone https://github.com/yourusername/movieai-analysis.git
cd movieai-analysis
  1. Set up environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
  1. Configure API Keys
# Add to .env file
GEMINI_API_KEY=your_api_key_here
  1. Run the application
python app.py

πŸ› οΈ Tech Stack

Backend

  • 🐍 Python 3.8+
  • 🌢️ Flask web framework
  • 🧠 NLTK for NLP tasks
  • πŸ€– Google Gemini API
  • 🌐 Selenium for web scraping
  • πŸ“Š Matplotlib for visualizations

Frontend

  • πŸ’¨ TailwindCSS
  • 🎨 Glass-morphism UI
  • πŸ“± Responsive design
  • πŸ”„ Async JavaScript
  • 🎯 Dynamic charts

πŸ”„ How It Works

Architecture

  1. Data Collection 🌐

    • Scrapes movie data from Wikipedia
    • Falls back to Gemini AI for missing data
    • Collects reviews and critical reception
  2. Analysis Pipeline πŸ”¬

    • Performs sentiment analysis on reviews
    • Generates sentiment scores and ratings
    • Creates visual representations
  3. Report Generation πŸ“Š

    • Creates detailed PDF reports
    • Includes sentiment analysis charts
    • Adds AI-generated insights
  4. User Interface 🎨

    • Modern glass-morphism design
    • Real-time analysis updates
    • Interactive visualizations

πŸ“Š Sample Analysis

Sample Analysis

The platform provides:

  • πŸ“ˆ Sentiment distribution charts
  • 🎭 Rating comparisons
  • πŸ’‘ AI-generated insights
  • πŸ“ Comprehensive reports

πŸ”§ Advanced Configuration

Customizing Analysis Parameters

# In app.py
SENTIMENT_THRESHOLD = 0.05
MAX_FEATURES = 1000
ANALYSIS_DEPTH = 'deep'

Styling Modifications

/* In style.css */
.glass-effect {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.1);
}

πŸ“š API Documentation

Analyze Endpoint

POST /analyze
{
    "movie_name": "string",
    "analysis_depth": "string",
    "include_ai_insights": boolean
}

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/AmazingFeature
  3. Commit your changes: git commit -m 'Add some AmazingFeature'
  4. Push to the branch: git push origin feature/AmazingFeature
  5. Open a pull request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • NLTK team for natural language processing tools
  • Google Gemini API for AI insights
  • Unsplash for beautiful images
  • TailwindCSS for modern styling
  • Flask for robust backend framework

Made with ❀️ by Your Name

About

AI-driven platform for analyzing emotional tone and sentiment across social media platforms. This tool helps brands, organizations, and researchers understand public opinion, detect crises early, and make data-driven decisions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors