An intelligent product recommendation system using semantic similarity and sentence transformers. Analyzes conversation context to recommend relevant products across multiple categories.
- 🔍 Semantic Understanding - Uses sentence transformers for context analysis
- 🛍️ Multi-Category Products - Technology, entertainment, fashion, health, food
- 📊 Cosine Similarity Matching - Accurate product relevance scoring
- 💬 Conversation Analysis - Extracts intent from natural language
- 🎯 Keyword Matching - Hybrid approach for better accuracy
- 📈 SamSum Integration - Text summarization capabilities
- Python 3.8+
- ~500MB for sentence transformer model
-
Clone the repository
git clone https://github.com/yourusername/product-recommendation.git cd product-recommendation -
Create virtual environment
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Run the system
python product_recommendation_system.py
product-recommendation/
├── .github/
│ ├── workflows/
│ │ └── ci.yml
│ ├── ISSUE_TEMPLATE.md
│ └── PULL_REQUEST_TEMPLATE.md
├── src/
│ ├── product_recommendation_system.py # Main recommendation engine
│ └── SamSum.py # Text summarization
├── data/
│ └── samsum_data/ # Training data
├── .gitignore
├── .env.example
├── requirements.txt
├── LICENSE
├── CONTRIBUTING.md
├── CHANGELOG.md
└── README.md
| Category | Example Products |
|---|---|
| Technology | Smartphones, Apps |
| Entertainment | Netflix, Concerts |
| Fashion | Clothing, Accessories |
| Health | Supplements, Ergonomic furniture |
| Food | Meal delivery services |
| Books | E-readers, Book subscriptions |
- Input Processing - Receives conversation or query text
- Embedding Generation - Creates semantic embeddings using
all-MiniLM-L6-v2 - Similarity Calculation - Computes cosine similarity with product database
- Keyword Enhancement - Boosts matches based on keyword overlap
- Ranking - Returns top-N most relevant products
from product_recommendation_system import ProductRecommendationSystem
recommender = ProductRecommendationSystem()
# Get recommendations from conversation
conversation = "I've been feeling tired lately and need more energy for work."
recommendations = recommender.get_recommendations(conversation)
for product in recommendations:
print(f"{product['name']}: {product['score']:.2f}")Contributions are welcome! Please read our Contributing Guide.
This project is licensed under the MIT License - see the LICENSE file for details.
Your Name
- GitHub: @yourusername
Made with ❤️ and Sentence Transformers