Skip to content

gaganpreetam/Sentiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 SentimentPulse — AI-Powered Social Media Sentiment Analysis

A stunning, production-ready full-stack web application that analyzes social media sentiment in real-time using advanced NLP.

SentimentPulse Node.js License

✨ Features

  • Real-time Sentiment Analysis — VADER-based + optional HuggingFace transformer analysis
  • Emotion Detection — Joy, Anger, Fear, Surprise, Sadness breakdown
  • Live Dashboard — Bento grid with animated charts, word cloud, stats
  • Live Feed — Server-Sent Events streaming new posts every 3 seconds
  • Realtime Model Training — Continuously trains on fresh incoming posts
  • Realtime Dataset Capture — Writes labeled stream samples to data/realtime-dataset.jsonl
  • Keyword Extraction — Auto-detect trending keywords with sentiment coloring
  • Multi-platform Support — Twitter/X, Reddit, Instagram, Facebook, TikTok, YouTube
  • Stunning Design — Deep space theme, glassmorphism, particles, animations

🛠️ Tech Stack

Layer Technologies
Frontend HTML5, CSS3, Vanilla JavaScript
Backend Node.js, Express.js
NLP sentiment (VADER), HuggingFace Inference API
Charts Chart.js
Particles tsParticles
Icons Lucide Icons
Fonts Inter, Space Grotesk (Google Fonts)

📁 Project Structure

mini2/
├── public/                  # Static frontend files
│   ├── index.html           # Single-page application
│   ├── css/
│   │   └── styles.css       # Complete design system
│   └── js/
│       └── app.js           # Client-side application logic
├── server/
│   ├── server.js            # Express server entry point
│   ├── .env                 # Environment variables
│   ├── routes/
│   │   ├── analyze.js       # POST /api/analyze
│   │   ├── dashboard.js     # GET /api/dashboard
│   │   └── feed.js          # GET /api/feed (SSE)
│   └── services/
│       ├── sentimentService.js     # VADER sentiment analysis
│       ├── huggingfaceService.js   # HuggingFace API integration
│       └── mockDataService.js      # Simulated social media data
├── package.json
└── README.md

🚀 Quick Start

Prerequisites

  • Node.js 18+ installed

Installation

# 1. Navigate to the project directory
cd mini2

# 2. Install dependencies
npm install

# 3. Start the server
npm start

Open in Browser

Visit http://localhost:3000

Optional: HuggingFace API (Enhanced Analysis)

For deeper analysis using transformer models, add your free HuggingFace API key:

  1. Get a free API key at huggingface.co/settings/tokens
  2. Edit server/.env:
    HUGGINGFACE_API_KEY=your_key_here
    
  3. Restart the server

📡 API Endpoints

Method Endpoint Description
POST /api/analyze Analyze text sentiment
GET /api/dashboard Get dashboard statistics
GET /api/feed SSE live feed of posts
GET /api/training/status Realtime model + dataset stats
GET `/api/training/dataset?format=jsonl csv`
POST /api/training/reset Reset model ({"resetDataset": true} also clears dataset file)

Realtime Training Data

  • Incoming Reddit + manual analyzer text is auto-labeled and appended to data/realtime-dataset.jsonl
  • A lightweight online model is updated continuously from this stream and blended with base sentiment scoring

POST /api/analyze

// Request
{ "text": "I love this product! Amazing quality!" }

// Response
{
  "sentiment": "positive",
  "score": 0.65,
  "confidence": 82,
  "emotions": { "joy": 85, "anger": 12, "fear": 8, "surprise": 45, "sadness": 5 },
  "keywords": ["love", "product", "amazing", "quality"],
  "highlightedText": [{ "word": "love", "sentiment": "positive" }, ...]
}

🎨 Design Highlights

  • Deep Space color palette (midnight blacks, neon accents)
  • Glassmorphism cards with backdrop blur
  • Neumorphic inputs and buttons
  • tsParticles interactive hero background
  • Typewriter headline animation
  • Cursor glow that follows mouse movement
  • Scroll-triggered section reveals
  • Animated charts with Chart.js
  • Live SSE feed with slide-in animations
  • Floating CTA button on scroll
  • Full responsive design (desktop → mobile)

📄 License

MIT License — Use freely for personal and commercial projects.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors