An end-to-end AI-powered book recommendation system that combines semantic search, zero-shot classification, and emotion-based filtering to provide personalized book suggestions.
This project builds a content-based recommendation system using modern NLP techniques. Instead of relying on keywords, it understands the meaning (semantics) of book descriptions.
Users can:
- Describe a book they want
- Filter by category (Fiction / Nonfiction)
- Filter by emotional tone (Happy, Sad, Suspenseful, etc.)
- Receive visually rich recommendations with thumbnails
-
Dataset: 7k Books with Metadata
-
Fields used:
- Title
- Authors
- Description
- Rating
- Categories
- Thumbnail
-
Removed missing values:
descriptionnum_pagesaverage_ratingpublished_year
-
Filtered low-quality data:
- Removed books with descriptions < 25 words
-
Created new features:
title_and_subtitletagged_description(ISBN + description)
-
Handled missing thumbnails:
books["large_thumbnail"] = np.where(
books["thumbnail"].isna(),
"cover-not-found.jpg",
books["thumbnail"]
)- Missing value visualization (heatmaps)
- Correlation analysis (Spearman)
- Description length analysis
- Category distribution
Used Hugging Face model:
facebook/bart-large-mnli
-
Convert messy categories → simple labels:
- Fiction
- Nonfiction
- Evaluate model using 300 Fiction + 300 Nonfiction samples
- Compute accuracy
- Predict missing categories
- Fill missing values in dataset
Each book is tagged with emotional scores:
- Joy
- Sadness
- Anger
- Fear
- Surprise
Used for tone-based filtering in recommendations.
Used local model:
sentence-transformers/all-MiniLM-L6-v2
- Fast
- Lightweight
- No API cost
- Optimized for semantic similarity
- Stored embeddings for all books
- Enabled fast similarity search
- Used persistent storage to avoid recomputation
- User inputs query
- Convert query → embedding
- Retrieve top-k similar books
- Filter by category (optional)
- Rank by emotional tone (optional)
- Return top results
Built an interactive dashboard:
-
Text input for query
-
Dropdown for category
-
Dropdown for emotional tone
-
Gallery output with:
- Book cover
- Title
- Authors
- Short description
python main.py"A story about love and forgiveness"
👉 Output:
- Semantically similar books
- Filtered by category
- Sorted by emotional tone