Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React + Vite - Product Recommendation System with ABSA

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

๐Ÿ†• NEW FEATURE: Aspect-Based Sentiment Analysis (ABSA)

This project now includes an advanced Aspect-Based Sentiment Filter that analyzes customer reviews to determine sentiment (positive, negative, or neutral) for specific product aspects like "battery life", "display", "performance", etc.

How It Works

  1. Browse Products: View laptop products with detailed specifications
  2. Open Sentiment Filter: Click the "Sentiment Filter" button in the results section
  3. Enter Aspects: Type aspects you care about (e.g., "battery life, display, performance")
  4. Apply Filter: Products are analyzed using AI and ranked by sentiment scores
  5. View Results: Each product shows sentiment badges for the aspects you selected

Key Features

  • โœจ AI-Powered Analysis: Uses Hugging Face Gradio API (sathvik1223/Aspect_based_sentiment_analysis)
  • ๐ŸŽฏ Smart Ranking: Products ranked by overall sentiment score
  • ๏ฟฝ Automatic Aspect Detection: Extracts aspects from your search query automatically
  • ๐Ÿค Aspect Merging: Combines auto-detected aspects with manually added ones
  • ๏ฟฝ๐Ÿ’พ Caching: Results cached in localStorage for 24 hours for faster subsequent queries
  • ๐ŸŽจ Beautiful UI: Animated sentiment badges (positive/negative/neutral)
  • ๐Ÿ“ฑ Responsive: Works seamlessly on mobile and desktop
  • ๐Ÿ“Š Review-by-Review Breakdown: See sentiment for each individual review

Technical Implementation

Frontend Stack:

  • React 19.1.1
  • Vite 7.1.7
  • Tailwind CSS 4.1.13
  • @gradio/client 1.10.0
  • GSAP 3.13.0 for animations
  • Lucide React for icons

New Components:

  • AspectFilterModal.jsx - Modal UI for aspect input
  • SentimentBadge.jsx - Sentiment pill badges
  • aspectSentimentService.js - API integration and caching

Data:

  • /public/data/products.json - 8 laptop products with reviews

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v18 or higher recommended)
  • npm or yarn

Installation

  1. Install dependencies:
npm install

Running the Project

Start the development server:

npm run dev

The application will open at http://localhost:5173

Building for Production

npm run build

Preview Production Build

npm run preview

Linting

npm run lint

๐Ÿ“– Usage Guide

Testing the ABSA Feature

  1. Start the app and wait for products to load
  2. Click "Sentiment Filter" button in the results section
  3. Try these example aspects:
    • battery life, display
    • performance, build quality
    • keyboard, speakers, trackpad
  4. Select a category (optional): Gaming, Ultrabook, Professional, etc.
  5. Click "Apply Filter" and wait for analysis (may take 30-60 seconds)
  6. View ranked products with sentiment badges

Understanding Sentiment Badges

  • ๐ŸŸข Positive (Green): Customers are happy with this aspect
  • ๐Ÿ”ด Negative (Red): Customers are unhappy with this aspect
  • โšช Neutral (Gray): Mixed or neutral sentiment

Performance Tips

  • Results are cached for 24 hours - re-analyzing same aspects is instant
  • Analyzing all products may take 1-2 minutes on first run
  • Use category filter to analyze fewer products faster
  • Clear cache from browser DevTools if needed: localStorage.clear()

๐Ÿ—๏ธ Project Structure

product-recommendation-s-ver-main/
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ data/
โ”‚       โ””โ”€โ”€ products.json          # Product data with reviews
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ AspectFilterModal.jsx  # ABSA filter modal
โ”‚   โ”‚   โ”œโ”€โ”€ SentimentBadge.jsx     # Sentiment badges
โ”‚   โ”‚   โ”œโ”€โ”€ DotGrid.jsx            # Interactive background
โ”‚   โ”‚   โ””โ”€โ”€ DotGrid.css
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ aspectSentimentService.js  # ABSA API & caching
โ”‚   โ”œโ”€โ”€ App.jsx
โ”‚   โ”œโ”€โ”€ ProductRecommendationApp.jsx   # Main component
โ”‚   โ”œโ”€โ”€ main.jsx
โ”‚   โ”œโ”€โ”€ index.css                      # Global styles + ABSA styles
โ”‚   โ””โ”€โ”€ App.css
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ vite.config.js
โ”œโ”€โ”€ tailwind.config.js
โ””โ”€โ”€ README.md

๐Ÿ”ง Configuration

Gradio API Configuration

The ABSA service connects to: sathvik1223/Aspect_based_sentiment_analysis

To modify caching settings, edit src/services/aspectSentimentService.js:

const CACHE_EXPIRY_HOURS = 24;  // Change cache duration

Adding More Products

Edit public/data/products.json and add products with this structure:

{
  "id": 9,
  "product_name": "Product Name",
  "brand": "Brand",
  "category": "gaming|ultrabook|professional|business|budget",
  "reviews": [
    "Review text 1 mentioning various aspects",
    "Review text 2 with sentiment",
    "Review text 3 with opinions"
  ],
  // ... other product fields
}

๐Ÿ› Troubleshooting

ABSA Analysis Fails

  • Check internet connection: API requires network access
  • Try fewer products: Use category filter
  • Clear cache: Run localStorage.clear() in browser console
  • Check console logs: Open DevTools > Console for detailed errors

Products Not Loading

  • Ensure public/data/products.json exists
  • Check browser console for fetch errors
  • Verify file path is correct

Slow Performance

  • First analysis takes longer (building cache)
  • Subsequent analyses are much faster (cached)
  • Reduce number of aspects (3-4 recommended)
  • Use category filter to analyze fewer products

๐ŸŽ“ Team Members

  • Abdulla Shahensha Razwaa (22BCE9149)
  • Binayak Sinha (22BCE8642)
  • Vudathu Rahul (22BCE9172)
  • Kanithi Tirumala Satya Sathvik (22BCE8492)

๐Ÿ“ Plugins Available

๐Ÿš€ Advanced Product Recommendation System with Aspect-Based Sentiment Analysis

An AI-powered product recommendation system built with React, Vite, and Hugging Face's Aspect-Based Sentiment Analysis API. This capstone project combines modern web technologies with intelligent sentiment analysis to help users find the perfect products based on specific aspects they care about.

โœจ Features

๐ŸŽฏ Core Features

  • AI-Powered Product Discovery - Modern, responsive interface for product search
  • Aspect-Based Sentiment Analysis (ABSA) - Analyze products based on specific aspects using Hugging Face AI
  • Automatic Aspect Detection - Extracts aspects from user search queries automatically
  • Intelligent Product Ranking - Products ranked by sentiment scores for queried aspects
  • Review-by-Review Analysis - See individual sentiment breakdown for each review
  • Caching System - LocalStorage caching to improve performance and reduce API calls
  • Fallback Analysis - Keyword-based sentiment analysis if API fails
  • Visual Search (Image-based) - Upload an image to find visually similar products (configurable endpoint)
  • Multilingual UI (EN/ES) - Switch language from the navbar

๐ŸŽจ UI/UX Features

  • Beautiful gradient animations and effects
  • Interactive sentiment badges (positive/negative/neutral)
  • Expandable review details with sentiment visualization
  • Responsive design for all devices
  • Real-time loading indicators
  • Modal-based filtering interface

๐Ÿ› ๏ธ Tech Stack

  • Frontend Framework: React 19.1.1
  • Build Tool: Vite 7.1.7
  • Styling: Tailwind CSS 4.1.13 + Custom CSS
  • Icons: Lucide React
  • Animations: GSAP 3.13.0
  • AI Integration: Hugging Face Gradio Client (@gradio/client)
  • Language: JavaScript (ES6+)

๐Ÿ“ฆ Installation

Prerequisites

  • Node.js 16+ and npm

Setup Steps

  1. Clone the repository
git clone https://github.com/yourusername/product-recommendation-system.git
cd product-recommendation-system
  1. Install dependencies
npm install
  1. Start development server
npm run dev
  1. Open in browser
http://localhost:5173

## ๐Ÿ“ท Visual Search Configuration

Set a visual search API endpoint that accepts `multipart/form-data` with field `image` and returns one of: `{results: []}`, `{products: []}`, or a raw array `[]`.

Create `.env` in the project root:

VITE_VISUAL_SEARCH_ENDPOINT=https://your-api/visual-search


Use the โ€œSearch by Imageโ€ button on the home page to upload a photo.

## ๐ŸŒ Multilingual Support

- Language selector is in the navbar (EN/ES).
- Add more languages by creating `src/i18n/locales/<lang>.json` mirroring the keys from `en.json`.
- The selected language is persisted in `localStorage` as `lang`.

๐Ÿš€ Usage

Basic Search

  1. Enter a product query in the search box
  2. View all available products with detailed specifications

Aspect-Based Sentiment Search (Automatic)

  1. Enter a query mentioning specific aspects:
    • "laptop with good battery life and display"
    • "I need excellent performance and keyboard"
  2. System automatically detects aspects
  3. Products are analyzed and ranked by sentiment
  4. View sentiment badges on each product

Manual Aspect Filtering

  1. Click the "Sentiment Filter" button
  2. Enter aspects (comma-separated): battery life, display, performance
  3. Optionally select a product category
  4. Click "Apply Filter"
  5. View ranked products with sentiment analysis

View Detailed Analysis

  1. Click "Review-by-Review Analysis" on any product card
  2. See individual sentiment for each review
  3. Understand how the overall sentiment was calculated

๐ŸŽฏ Detected Aspects

The system recognizes these aspects automatically:

Aspect Keywords
Battery Life battery, power, charge, charging, hours
Display display, screen, monitor, resolution, brightness, colors
Performance performance, speed, fast, processor, cpu, gpu, gaming
Keyboard keyboard, typing, keys, keypad
Build Quality build, construction, material, solid, sturdy, premium
Speakers speakers, audio, sound, volume, bass
Trackpad trackpad, touchpad, mouse, cursor
Cooling cooling, heat, temperature, fan, thermal

๐Ÿ“Š How ABSA Works

Complete Flow

User Search Query
    โ†“
Aspect Extraction (if aspects mentioned)
    โ†“
Load Product Data (8 products)
    โ†“
For Each Product:
    โ”œโ”€ For Each Review (4 reviews/product)
    โ”‚   โ”œโ”€ Call Hugging Face API
    โ”‚   โ”‚   - Model: sathvik1223/Aspect_based_sentiment_analysis
    โ”‚   โ”‚   - Input: review text + aspects
    โ”‚   โ”‚   - Output: sentiment per aspect
    โ”‚   โ”œโ”€ OR Use Fallback (keyword-based)
    โ”‚   โ””โ”€ Store Result
    โ”œโ”€ Aggregate All Reviews
    โ”œโ”€ Calculate Sentiment Score
    โ””โ”€ Cache Result
    โ†“
Rank Products by Sentiment Score
    โ†“
Display Results with Badges

API Integration

import { Client } from "@gradio/client";

const client = await Client.connect("sathvik1223/Aspect_based_sentiment_analysis");
const result = await client.predict("/predict", {
  sentence: "The battery life is amazing but display is just okay",
  aspects: "battery life, display"
});

// Output: "battery life: positive, display: neutral"

๐Ÿ“ Project Structure

product-recommendation-s-ver-main/
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ data/
โ”‚       โ””โ”€โ”€ products.json          # Product data with reviews
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ AspectFilterModal.jsx  # Filter modal UI
โ”‚   โ”‚   โ”œโ”€โ”€ SentimentBadge.jsx     # Sentiment display badges
โ”‚   โ”‚   โ”œโ”€โ”€ ReviewAnalysisDetails.jsx # Review breakdown
โ”‚   โ”‚   โ””โ”€โ”€ DotGrid.jsx            # Background effects
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ””โ”€โ”€ aspectSentimentService.js # API integration & analysis
โ”‚   โ”œโ”€โ”€ ProductRecommendationApp.jsx  # Main app component
โ”‚   โ”œโ”€โ”€ App.jsx                    # App wrapper
โ”‚   โ”œโ”€โ”€ main.jsx                   # Entry point
โ”‚   โ”œโ”€โ”€ index.css                  # Global styles + ABSA styles
โ”‚   โ””โ”€โ”€ App.css                    # Component styles
โ”œโ”€โ”€ ABSA_FEATURE_GUIDE.md          # Detailed ABSA documentation
โ”œโ”€โ”€ AUTO_ASPECT_DETECTION.md       # Auto-detection guide
โ””โ”€โ”€ TESTING_GUIDE.md               # Testing instructions

๐Ÿงช Testing

Test Queries

# Test auto-aspect detection
"laptop with good battery life and display"
"I need excellent performance and keyboard quality"
"Looking for great build quality and speakers"

# Test manual filter
1. Click "Sentiment Filter"
2. Enter: "battery life, display, performance"
3. Apply filter

Debug Mode

Open browser console (F12) to see:

  • Aspect extraction logs
  • API calls and responses
  • Sentiment parsing process
  • Aggregation calculations
  • Final rankings

๐ŸŽ“ Capstone Team

  • Abdulla Shahensha Razwaa - 22BCE9149
  • Binayak Sinha - 22BCE8642
  • Vudathu Rahul - 22BCE9172
  • Kanithi Tirumala Satya Sathvik - 22BCE8492

๐Ÿ”ง Available Scripts

# Development
npm run dev          # Start dev server

# Production
npm run build        # Build for production
npm run preview      # Preview production build

# Linting
npm run lint         # Run ESLint

๏ฟฝ๏ธ Visual Search (New)

Enable image-based search by setting an endpoint that accepts multipart/form-data with the field image and returns results in one of these shapes: {results: []}, {products: []}, or a raw [].

  1. Create a .env file (or copy .env.example):
VITE_VISUAL_SEARCH_ENDPOINT=https://your-api/visual-search
  1. In the homepage, click โ€œSearch by Imageโ€, upload a photo, and similar products will be fetched from your endpoint.

Notes

  • Requests are cancelable via the appโ€™s abort controller.
  • Returned items are normalized to ensure each has an id.

๐ŸŒ Multilingual UI (New)

The app now supports basic i18n for UI strings. A language selector is available in the navbar.

Current locales

  • English (en)
  • Spanish (es)

Add a new language

  1. Create src/i18n/locales/<lang>.json
  2. Copy keys from src/i18n/locales/en.json
  3. The selected language is saved in localStorage under lang

๏ฟฝ๐Ÿ› Troubleshooting

All sentiments showing as neutral?

  • Check browser console for API errors
  • Fallback keyword-based analysis should activate automatically
  • Verify network connection for Hugging Face API

No products showing?

  • Check if public/data/products.json exists
  • Verify fetch API call in console
  • Clear browser cache

๐Ÿ“ License

This project is created as a capstone project for educational purposes.

๐Ÿ™ Acknowledgments

  • Hugging Face for the ABSA model (sathvik1223/Aspect_based_sentiment_analysis)
  • React and Vite communities
  • Tailwind CSS team
  • Lucide Icons

๐Ÿ”— Resources


Built with โค๏ธ for VIT Capstone Project 2025

๐Ÿ”ฎ Future Enhancements

  • Add more product categories
  • Implement product comparison feature
  • Add sentiment trend visualization
  • Support multiple languages
  • Add user authentication
  • Implement product wishlist

๐Ÿ“„ License

ยฉ Advanced Product Recommendation System | Capstone Project

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages