Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ™οΈ VocalCart - Voice Command Shopping Assistant

A modern, zero-latency, voice-first shopping list manager & e-commerce catalog powered by browser-native Speech Recognition, a client-side NLP intent engine, fuzzy edit-distance matching, smart recommendation algorithms, and an authoritative Monochrome High-Contrast glassmorphic interface.


πŸ–ΌοΈ User Interface Screenshots

Main Catalog & Floating Voice Console

VocalCart Main UI

Shopping Cart Drawer & Smart Reorder Alert Voice Command Guide Modal


πŸ“ Assessment Write-Up (200-Word Approach Summary)

VocalCart is engineered as a zero-latency, voice-first web application built with React 18 and Vite. Speech recognition and text-to-speech feedback are handled client-side via the browser-native Web Speech API (SpeechRecognition & SpeechSynthesis), supporting real-time streaming transcripts and multilingual switching (English, Spanish, Hindi, French).

Command processing relies on a pure JavaScript NLP engine that tokenizes spoken input to extract intents (ADD, REMOVE, SEARCH, FILTER_PRICE, VIEW_CART, GET_SUGGESTIONS), numerical quantities ("two" -> 2), units (bottles, lbs), and price thresholds (under $5). The engine features a custom stem normalizer and Levenshtein edit-distance fuzzy matcher to seamlessly parse plurals and speech typos (e.g. "millks" -> "Organic Whole Milk"). Unlisted items trigger audio feedback indicating unavailability.

A custom recommendation engine provides smart substitute suggestions (e.g. Almond Milk for Whole Milk), date-aware seasonal produce alerts, and localStorage-backed purchase history tracking to alert users when essentials run low. The UI follows a strict Monochrome High-Contrast design system utilizing pure black surfaces (#141313), white glass blurs (backdrop-filter: blur(24px)), Outfit & Inter typography, a bottom-right floating microphone FAB, and animated audio waveforms.


πŸ—οΈ System Architecture & Engineering

                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                             β”‚       User Voice Input (Mic)         β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                                                β–Ό
                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                             β”‚    Layer 1: Web Speech API STT       β”‚
                             β”‚  (SpeechRecognition / lang switcher) β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚ (Raw Transcript Stream)
                                                β–Ό
                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                             β”‚   Layer 2: Local JS NLP & Stemmer    β”‚
                             β”‚  - Action Keyword Intent Classifier  β”‚
                             β”‚  - Quantity & Price Filter Tokenizer β”‚
                             β”‚  - Levenshtein Fuzzy Product Matcher β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚ (Structured Intent Object)
                                                β–Ό
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚                                          β”‚                                          β”‚
     β–Ό                                          β–Ό                                          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Shopping List State     β”‚      β”‚   Recommendation Engine   β”‚      β”‚    Product Catalog State  β”‚
β”‚  - Auto-Categorization    β”‚      β”‚  - Smart Substitutes      β”‚      β”‚  - Price Range Filtering  β”‚
β”‚  - Quantity Steppers      β”‚      β”‚  - Seasonal Produce       β”‚      β”‚  - Organic Attribute Tag  β”‚
β”‚  - LocalStorage Persist   β”‚      β”‚  - Low-Stock History      β”‚      β”‚  - Search Query Filter    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚                                  β”‚                                  β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                β”‚
                                                β–Ό
                             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                             β”‚    Layer 3: Audio TTS & UI Render    β”‚
                             β”‚  - SpeechSynthesis Audio Feedback    β”‚
                             β”‚  - Bottom-Right Floating Mic FAB     β”‚
                             β”‚  - Monochrome High-Contrast Glass    β”‚
                             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Technical Highlights & Algorithms

1. Zero-Dependency NLP & Intent Engine (src/services/nlpEngine.js)

  • Explicit Action Keyword Enforcement: Intent detection requires explicit command verbs (add, buy, need, remove, delete, find, search, suggest). Conversational phrases like "hello" or "testing 123" yield a GREETING or UNKNOWN intent, preventing accidental list modifications.
  • Numeric & Unit Normalization: Converts verbal number words ("one", "two", "a dozen") into integer quantities and extracts standard measurement units (bottles, gallons, lbs, packs).
  • Price Filter Extraction: Regex patterns parse monetary constraints (e.g. "under $5", "less than 10 dollars") into structured price bounds (maxPrice: 5.00).

2. Stemming & Fuzzy Edit-Distance Matching

  • Plural Normalization: Strips trailing plurals ("ies" -> "y", "es" -> "", "s" -> "") and collapses double letters ("millk" -> "milk").
  • Levenshtein Similarity: Calculates string edit distance similarity ($1 - \frac{\text{dist}}{\text{maxLen}}$) to match speech variations (e.g. "millks", "milks", "appels", "strawberries") to exact catalog items (Organic Whole Milk, Honeycrisp Apples, Fresh Strawberries).
  • Strict Store Catalog Check: If an item is not in the store database and yields a similarity score below 0.70, it is rejected with spoken feedback: "Sorry, [item] is currently not available in our store."

3. Smart Business Logic (src/services/recommendationEngine.js)

  • Smart Substitutes: When an item like Whole Milk is added, the app highlights dietary/healthy alternatives (Almond Milk, Oat Milk) with 1-tap swap buttons.
  • Date-Aware Seasonal Produce: Evaluates the current month (new Date().getMonth()) to highlight in-season fruits and vegetables.
  • History-Based Reorder Warnings: Stores item timestamps in localStorage. If an essential item like bread or milk was added over 4 days ago, prompts a low-stock alert.

4. Voice Cart Inquiry

  • Speaking "What is in my cart?", "What's on my list?", or "Show my cart" opens the shopping drawer and generates a natural spoken audio summary: "In your cart, you have 2 Organic Whole Milk and 1 Honeycrisp Apples. Total estimated cost is $14.28."

🎨 Monochrome High-Contrast Design System

The application strictly implements the Monochrome High-Contrast aesthetic:

  • Background Surfaces: Pure Black (#141313, #0E0E0E) for deep, glare-free dark surfaces.
  • Glassmorphism: White glass panels (rgba(255, 255, 255, 0.06) fill, backdrop-filter: blur(24px)), defined by 1px stroke borders (rgba(255, 255, 255, 0.15)).
  • Typography: Outfit for geometric display headings and Inter for body text and data labels.
  • Voice UI: Bottom-Right Floating Action Button (FAB) with animated frequency soundwaves (animate-wave-1 through animate-wave-5) and pulsing mic ripple rings (mic-listening).

πŸ“ Repository Structure

d:\projects\unthinkable\
β”œβ”€β”€ index.html                    # Entry HTML with Outfit & Inter Google Fonts
β”œβ”€β”€ package.json                  # Dependencies (React 18, Vite, Lucide React, Tailwind CSS)
β”œβ”€β”€ vite.config.js                # Vite build configuration
β”œβ”€β”€ tailwind.config.js            # Tailwind v3 theme tokens & colors
β”œβ”€β”€ postcss.config.js             # PostCSS plugins
β”œβ”€β”€ README.md                     # Technical assessment documentation & write-up
└── src/
    β”œβ”€β”€ main.jsx                  # React application root
    β”œβ”€β”€ App.jsx                   # Main state coordinator, NLP dispatcher & speech lifecycle
    β”œβ”€β”€ index.css                 # Monochrome High-Contrast design system tokens & animations
    β”œβ”€β”€ data/
    β”‚   └── productsData.js       # E-Commerce grocery product catalog database
    β”œβ”€β”€ services/
    β”‚   β”œβ”€β”€ nlpEngine.js          # NLP intent classifier, stemmer & Levenshtein matcher
    β”‚   β”œβ”€β”€ speechEngine.js       # Web Speech API (STT & TTS) manager & language switcher
    β”‚   └── recommendationEngine.js # Substitutes map, seasonal matrix & purchase history
    └── components/
        β”œβ”€β”€ Navbar.jsx            # Top bar with transcript streamer, multilingual picker & TTS toggle
        β”œβ”€β”€ VoiceConsole.jsx      # Floating Bottom-Right Mic FAB & glass toast feedback
        β”œβ”€β”€ ProductCatalog.jsx    # Product grid, search bar, price filters & seasonal carousel
        β”œβ”€β”€ ShoppingListSidebar.jsx # Categorized cart drawer, quantity steppers & substitute popovers
        └── QuickGuideModal.jsx   # Voice command cheat-sheet popup

πŸ› οΈ Local Installation & Setup

Prerequisites

  • Node.js (v18 or higher)
  • Google Chrome, Microsoft Edge, Safari, or Brave (for Web Speech API support)

Installation Steps

# 1. Clone the repository
git clone https://github.com/your-username/vocalcart-voice-shopping-assistant.git
cd vocalcart-voice-shopping-assistant

# 2. Install dependencies
npm install

# 3. Start local development server
npm run dev

# 4. Open in browser
# Navigate to http://localhost:3000

Production Build Verification

# Build production bundle
npm run build

# Preview production build locally
npm run preview

🎯 Assessment Feature Verification Summary

Feature Category Assessment Requirement Implementation Status
Voice Input Voice Command Recognition βœ… Native SpeechRecognition API real-time listening
Voice Input Varied Phrasing NLP βœ… Intent tokenizer for add, buy, need, remove, find
Voice Input Multilingual Support βœ… Dynamic language switcher (en-US, es-ES, hi-IN, fr-FR)
Smart Suggestions History Low-Stock Alerts βœ… localStorage timestamp tracker for items >4 days old
Smart Suggestions Seasonal Recommendations βœ… Date-aware seasonal produce carousel
Smart Suggestions Dietary Substitutes βœ… 1-tap substitute popover badges (e.g. Milk -> Almond Milk)
Shopping List Add / Remove / Modify βœ… Complete list state CRUD with spoken TTS audio responses
Shopping List Auto-Categorization βœ… Grouped categories (Produce, Dairy, Bakery, Pantry, etc.)
Shopping List Quantity Management βœ… Extracted numbers ("2") & units ("bottles") with quantity steppers
Voice Search Item & Attribute Search βœ… Voice search by product name, brand, or organic tag
Voice Search Price Range Filtering βœ… Parses "under $5" / "less than $10" and applies live filters
UI / UX Minimalist High-Contrast UI βœ… Pure black surfaces, Outfit & Inter fonts, 24px blurs, Floating Mic FAB

πŸ“„ License

Distributed under the MIT License. Built for Technical Assessment Evaluation.

About

A zero-latency, voice-first smart shopping list assistant featuring real-time Web Speech API recognition, a client-side NLP intent parser with fuzzy edit-distance matching, smart recommendations & substitutes, and a sleek Monochrome High-Contrast UI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages