Logo Lanfrica

Ataur2019331077/Farmer-Bangla-Chatbot

Domain:

natural language processingagriculture

Record type:

softwareproject
Creator:
Ata
Host:
# 🌾 Bengali Farmer Assistant Chatbot This project is a **context-aware Bengali question-answering system** for farmers. It uses **multilingual semantic search** (via the E5 embedding model), **MongoDB vector search**, and **Gemini LLM** to respond to agricultural queries with precise, context-driven answers. --- ## πŸ“Œ Features - 🧠 **Semantic Search** using `intfloat/multilingual-e5-base` - πŸ’¬ **Query Understanding** in Bengali (or other supported languages) - πŸ” **MongoDB Vector Search** for paragraph retrieval - πŸ€– **Response Generation** using Google's Gemini API - πŸ“„ **Text Ingestion Pipeline** that splits, embeds, and stores agricultural content - πŸ” Interactive command-line chatbot --- ## βš™οΈ Technologies Used - Python 3.11+ - HuggingFace Transformers - PyTorch - MongoDB Atlas (with vector search index) - Gemini API (Google's Generative Language Model) - dotenv (for secure key management) --- ## πŸ“ Project Structure ```plaintext BanglaBot/ β”œβ”€β”€ .env # Environment variables β”œβ”€β”€ rice.txt # Input Bengali agricultural text β”œβ”€β”€ bot.py # Main chatbot loop β”œβ”€β”€ embed.py # Embedding and MongoDB storage logic β”œβ”€β”€ search.py # Semantic search using MongoDB └── README.md # Project documentation ``` --- ## πŸš€ Work Procedure & Flow ### πŸ”Ή Step 1: Text Ingestion and Embedding 1. Read a Bengali text document (`rice.txt`). 2. Split it into paragraphs using regex. 3. Use `intfloat/multilingual-e5-base` model to generate embeddings (mean-pooled CLS vectors). 4. Store each paragraph and its vector in MongoDB with the following structure: ```json { "text": "ΰ¦¬ΰ§€ΰ¦œΰ¦€ΰ¦²ΰ¦Ύ ঀৈরি করার জন্য...", "embedding": [0.123, -0.456, ...] } ``` --- ### πŸ”Ή Step 2: MongoDB Vector Search Setup 1. Use MongoDB Atlas with **Vector Search** enabled. 2. Create a vector index (`embedding_knn_index`) with: - Field: `embedding` - Similarity: `cosine` - Dimensions: `768` - Type: `knnVector` --- ### πŸ”Ή Ste …