Skip to content

Hritikraj8804/Sentiment-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Sentiment Analysis Tool - v2.0

Sentiment Analysis Version License

A modern, full-stack web application for analyzing sentiment in customer reviews and feedback

Installation Β· Documentation


✨ What's New in v2.0

  • 🎨 Complete UI/UX Redesign - Modern, premium interface with glassmorphism effects
  • πŸ“Š Enhanced Analytics - Beautiful visualizations with progress bars and stat cards
  • πŸš€ Improved Performance - Optimized file handling and processing
  • πŸ“± Fully Responsive - Perfect experience on desktop, tablet, and mobile
  • 🎭 Better UX - File selection display, error handling, and smooth animations
  • πŸ”’ Enhanced Security - 10MB file size limits and improved validation

🌟 Features

Core Functionality

  • βœ… CSV File Upload - Drag & drop or click to upload review datasets
  • πŸ“ˆ Sentiment Analysis - Powered by TextBlob and NLTK for accurate results
  • πŸ“Š Visual Analytics - Interactive charts and word clouds
  • πŸ’¬ Example Reviews - See most positive and negative reviews
  • 🎯 Real-time Processing - Fast analysis with progress indicators

Analysis Insights

  • Overall sentiment score and classification
  • Sentiment distribution (Positive/Negative/Neutral)
  • Word clouds for positive and negative reviews
  • Subjectivity vs polarity analysis
  • Detailed sentiment breakdown with percentages

Modern UI/UX

  • Clean, intuitive interface with gradient themes
  • Smooth animations and micro-interactions
  • Glassmorphism design elements
  • Responsive grid layouts
  • Dark accents with vibrant colors

πŸ—οΈ Project Structure

Sentiment-Analysis/
β”œβ”€β”€ πŸ“„ server/                    # Node.js/Express backend
β”‚   β”œβ”€β”€ controllers/             # Request handlers
β”‚   β”œβ”€β”€ middleware/              # Upload & validation middleware
β”‚   β”œβ”€β”€ routes.js               # API routes
β”‚   └── server.js               # Main server file
β”‚
β”œβ”€β”€ 🎨 public/                    # Frontend files
β”‚   β”œβ”€β”€ index.html              # Main application page
β”‚   β”œβ”€β”€ data.html               # Sample datasets page
β”‚   β”œβ”€β”€ docs.html               # Documentation page
β”‚   β”œβ”€β”€ style.css               # Modern CSS with design system
β”‚   β”œβ”€β”€ script.js               # Client-side JavaScript
β”‚   └── images/                 # Generated analysis visualizations
β”‚
β”œβ”€β”€ 🐍 seti.py                    # Python ML analysis script
β”œβ”€β”€ πŸ“Š data/                      # Sample CSV datasets
β”‚   β”œβ”€β”€ Reviews.csv             # Restaurant reviews (1000+)
β”‚   β”œβ”€β”€ hotel_reviews.csv       # Hotel reviews
β”‚   β”œβ”€β”€ movie_reviews.csv       # Movie reviews
β”‚   └── tech_reviews.csv        # Tech product reviews
β”‚
β”œβ”€β”€ πŸ§ͺ tests/                     # Test files
β”‚   β”œβ”€β”€ server.test.js          # Node.js tests
β”‚   └── test_seti.py            # Python tests
β”‚
β”œβ”€β”€ πŸ“ requirements.txt           # Python dependencies
β”œβ”€β”€ πŸ“¦ package.json              # Node.js dependencies
β”œβ”€β”€ βš™οΈ nodemon.json               # Development server config
└── πŸ“– README.md                 # This file

πŸš€ Quick Start

Prerequisites

  • Node.js >= 18.0.0
  • Python >= 3.8

Installation

  1. Clone the repository

    git clone https://github.com/Hritikraj8804/Sentiment-Analysis.git
    cd Sentiment-Analysis
  2. Install Node.js dependencies

    npm install
  3. Install Python dependencies

    pip install -r requirements.txt
  4. Download NLTK data (first time only)

    python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"

Running the Application

Development mode:

npm run dev

Production mode:

npm start

The application will be available at http://localhost:3000


πŸ“– Usage

1. Upload Your Data

  • Click "Choose CSV File" button
  • Select a CSV file with reviews (max 10MB)
  • See the selected filename and size displayed
  • Click "Analyze" to start processing

2. CSV Format

Your CSV file should have at least one column with text data:

Review,Liked
"Great product, highly recommend!",1
"Poor quality, disappointed.",0
"It's okay, nothing special.",2

Supported sentiment values:

  • 1 - Positive
  • 0 - Negative
  • 2 - Neutral (optional)

3. View Results

The analysis provides:

  • Overall Sentiment - Classified as Positive, Negative, or Neutral
  • Statistics - Total reviews, sentiment breakdown with percentages
  • Visualizations - Distribution charts, pie charts, word clouds
  • Example Reviews - Most positive and most negative examples

πŸ› οΈ Technologies Used

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • Multer - File upload handling
  • CORS - Cross-origin resource sharing

Frontend

  • HTML5 - Semantic structure
  • CSS3 - Modern styling with custom properties
  • Vanilla JavaScript - ES6+ features
  • Font Awesome - Icons
  • Google Fonts - Inter & Poppins typography

Machine Learning / NLP

  • Python 3 - Analysis engine
  • TextBlob - Sentiment analysis
  • NLTK - Natural language processing
  • pandas - Data manipulation
  • matplotlib - Visualization generation
  • WordCloud - Word cloud creation

Development

  • nodemon - Auto-restart development server
  • Jest - JavaScript testing
  • pytest - Python testing
  • ESLint - Code linting

πŸ“Š API Endpoints

POST /api/analyze

Upload and analyze a CSV file

Request:

  • Content-Type: multipart/form-data
  • Body: csv_file (file)

Response:

{
  "success": true,
  "message": "Analysis completed successfully"
}

GET /data/:filename

Download sample dataset files


🎨 Design System

Color Palette

  • Primary: Purple/Blue gradient (#6366f1 to #a855f7)
  • Success: Green (#22c55e)
  • Error: Red (#ef4444)
  • Warning: Amber (#f59e0b)

Typography

  • Body: Inter (400, 500, 600, 700)
  • Headings: Poppins (600, 700, 800)

Components

  • Glassmorphism cards with backdrop blur
  • Smooth animations (200-300ms cubic-bezier)
  • Rounded corners (0.5rem to 1.5rem)
  • Elevated shadows with multiple layers

πŸ§ͺ Testing

Run JavaScript tests:

npm test

Run Python tests:

pytest

Run linting:

npm run lint

πŸ“ Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Commit your changes
    git commit -m "feat: add amazing feature"
  4. Push to your branch
    git push origin feature/amazing-feature
  5. Open a Pull Request

Commit Convention

  • feat: - New feature
  • fix: - Bug fix
  • docs: - Documentation changes
  • style: - Code style changes
  • refactor: - Code refactoring
  • test: - Test updates
  • chore: - Maintenance tasks

πŸ› Troubleshooting

File Upload Issues

  • Ensure file is .csv format
  • Check file size is under 10MB
  • Verify CSV has proper column headers

Analysis Errors

  • Use UTF-8 encoding for special characters
  • Ensure at least one text column exists
  • Check for malformed CSV data

Server Issues

  • Kill existing Node processes: killall node (Mac/Linux) or Stop-Process -Name node -Force (Windows)
  • Clear uploads folder if needed
  • Restart with npm run dev

πŸ“„ License

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


πŸ‘¨β€πŸ’» Author

Hritikraj


πŸ™ Acknowledgments

  • TextBlob for sentiment analysis capabilities
  • The open-source community for amazing tools and libraries
  • All contributors who have helped improve this project

πŸ“Έ Screenshots

Main Dashboard

Dashboard

Analysis Results

Beautiful visualizations with:

  • Sentiment distribution charts
  • Category breakdown pie charts
  • Positive & negative word clouds
  • Subjectivity analysis
  • Example reviews with badges

⭐ Star this repo if you found it helpful!

Made with ❀️ by Hritikraj | Report Bug | Request Feature

About

Developed a sentiment analysis tool to automatically determine the emotional tone of text data, providing insights into public opinion and customer feedback.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors