Discovering the proper ebook to match your temper or pursuits may be overwhelming. Conventional search engines like google usually depend on easy key phrase matching and lack the power to know the true which means behind what a reader is in search of.
To resolve this, I constructed a Semantic E book Advice System β a full-stack AI internet utility that understands pure language, feelings, and classes to ship good, personalised ebook suggestions.
This submit covers the what, why, and the way of this venture β from semantic search to emotional filtering and full-stack deployment.
Semantic E book Advice System is an AI-powered internet app that:
- Lets customers search utilizing pure language, key phrases, or feelings.
- Returns books primarily based on semantic similarity, tone, and style.
- Prioritizes actual title matches for improved accuracy.
- Helps dynamic pagination, filters, and an intuitive interface.
π Dwell App: semantic-book-recommendation-system.onrender.com
π» GitHub Repo: github.com/yaswanthreddy3/Semantic-Book-Recommendation-Systemπ§ Tech Stack
- Backend: Python, Flask
- AI/NLP: HuggingFace Sentence Transformers, LangChain, Chroma DB
- Frontend: HTML, CSS, JavaScript
- Information Dealing with: Pandas, NumPy
- Deployment: Render, Heroku (or any cloud supporting Flask)
Letβs stroll by the key parts of the system:
1. Information Loading & Preprocessing
- Reads a CSV containing metadata like
title
,writer
,scores
,feelings
, and so forth. - Masses descriptions from a tagged textual content file.
- Prepares thumbnails, authors, and classes for frontend use.
2. Embedding with HuggingFace
Every ebookβs description is embedded utilizing a pre-trained sentence transformer (all-MiniLM-L6-v2
), changing the textual content into dense vectors that seize semantic which means.
embedding = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
3. Vector Search with Chroma DB
These vectors are saved in ChromaDB, a quick and scalable vector database. On each consumer question, the system performs semantic similarity search to seek out essentially the most related matches.
db = Chroma.from_documents(paperwork, embedding=embedding)
recs = db.similarity_search_with_score(question, okay=50)
4. Emotion-Based mostly Filtering
Books are tagged with emotion scores like pleasure, anger, concern, disappointment, and shock. Customers can filter books by deciding on a tone similar to:
- Pleased
- Unhappy
- Suspenseful
- Indignant
- Stunning
The outcomes are re-ranked by the chosen emotional rating.
5. Sensible Matching & Title Precedence
- Semantic outcomes are returned first.
- Actual title matches are boosted to the highest of the outcomes for higher UX.
- If no outcomes are discovered, it gracefully falls again to the highest-rated books.
6. Frontend and Pagination
The frontend shows ebook playing cards with:
- Cowl picture
- Title & authors
- Truncated description
- Rankings & printed 12 months
It additionally helps pagination to load massive units of outcomes effectively.
- β Semantic Search utilizing language embeddings
- π Emotion-aware filtering
- ποΈ Style/class filters
- π E book particulars: title, authors, scores, description, thumbnails
- π Dynamic pagination
- π§ Title-priority for actual match enchancment
Say you sort in:
"heartwarming story about friendship"
Tone:Pleased
Class:Fiction
The system will:
- Embed the enter question.
- Discover semantically comparable ebook descriptions.
- Re-rank outcomes primarily based on pleasure/emotion scores.
- Prioritize books with comparable titles or themes.