Logo Lanfrica

Ataur2019331077/Farmer-Bangla-Chatbot

Domaine:

natural language processingagriculture

Type de record:

softwareproject
Créateur:
Ata
Hôte:
# 🌾 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 …