diff --git a/README.md b/README.md index f7b96ec..09962c7 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,8 @@ Weight Converter | [Weight Converter](https://github.com/Wa | Word to PDF | [Word to PDF](https://github.com/DhanushNehru/Python-Scripts/tree/master/Word%20to%20PDF%20converter) | A Python script to convert an MS Word file to a PDF file. | | Youtube Downloader | [Youtube Downloader](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Downloader) | Downloads any video from [YouTube](https://youtube.com) in video or audio format! | Youtube Playlist Info Scraper | [Youtube Playlist Info Scraper](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Playlist%20Info%20Scraper) | This python module retrieve information about a YouTube playlist in json format using playlist link. +| Rajasthan Chatbot | [Rajasthan Chatbot](https://github.com/DhanushNehru/Python-Scripts/tree/master/Rajasthan-Chatbot) | A chatbot designed to answer questions and provide information about engineering colleges of Rajasthan. | + ## Gitpod diff --git a/Rajasthan Chatbot/README.md b/Rajasthan Chatbot/README.md new file mode 100644 index 0000000..8ffa8a6 --- /dev/null +++ b/Rajasthan Chatbot/README.md @@ -0,0 +1,96 @@ + +# Rajasthan Engineering College Chatbot + +This project is a chatbot designed to provide detailed information about engineering colleges in Rajasthan. It can answer questions regarding cutoffs, fees, placements, and other important details for 30 colleges in the state. The chatbot interacts with users via a command-line interface, helping them find information based on their inputs like exam scores, desired colleges, and more. + +# My Project + +Here is an image of the project: +![Project Screenshot](ss1.png) +![Project Screenshot](ss2.png) + + +## Features + +- **Cutoff Information**: Get cutoff details for specific colleges across different years. +- **College Eligibility**: Based on a user's exam score and exam type (e.g., JEE Main, BITSAT), the chatbot will return a list of eligible colleges. +- **Fee Structure**: Provides annual fee details for available courses at various colleges. +- **Placement Packages**: Information about average and highest placement packages offered by the top recruiters. +- **Best College Suggestion**: Recommends the best college based on weighted criteria, such as average package, highest package, rating, and cutoff. + +## Problem Statement + +The goal of this project is to create a Few Shot Language Agnostic Keyword Spotting (FSLAKWS) system capable of localizing and classifying keywords in variable duration audio files. The system should be language-agnostic, support various sample rates, and be able to upgrade to include additional keywords. + +While this chatbot doesn’t fully implement all aspects of the FSLAKWS system, it serves as a working prototype to explore key features such as keyword localization and handling different query types. + +## Tech Stack + +- **Programming Language**: Python +- **Libraries**: + - `pandas`: For data handling and processing. + - `cohere`: For language model-based responses. + - `fuzzywuzzy`: For fuzzy string matching to enhance college name recognition. + - `dotenv`: To load API keys from environment files. +- **External APIs**: + - Cohere API: Used to generate natural language responses. +- **Environment Management**: `dotenv` for API key security. + +## Setup + +### Prerequisites + +Ensure you have Python 3.x installed and a virtual environment setup. + +1. Clone the repository: + ```bash + git clone https://github.com/yourusername/rajasthan-college-chatbot.git + cd rajasthan-college-chatbot + ``` + +2. Install dependencies: + ```bash + pip install -r requirements.txt + ``` + +3. Set up your environment variables. Create a `.env` file with the following content: + ``` + COHERE_API_KEY=your-cohere-api-key + ``` + +### Running the Chatbot + +After setting up your environment: + +```bash +python chatbot.py +``` + +You'll be greeted with a prompt where you can type questions like: +- "Which colleges can I get with a JEE Main score of 150?" +- "What is the cutoff for BITS Pilani in 2023?" +- "What are the fees for MNIT Jaipur?" + +### Example Queries + +- **Eligibility**: "Which colleges can I get with a JEE Main score of 180?" +- **Cutoff Info**: "Tell me the cutoff for BITS Pilani in 2022." +- **Fees**: "What are the fees for LNMIIT Jaipur?" +- **Best College**: "Which college is the best among my options?" + +### Notes + +- The dataset is limited to 30 colleges from Rajasthan. +- The project utilizes a pre-defined dataset and fuzzy matching for college names to account for variations in user input. +- You can improve or extend the dataset by adding more colleges and related information. + +## To-Do / Future Improvements + +- Add more colleges and exams to the dataset for broader applicability. +- Improve the language understanding and handling of more complex queries. +- Implement a web interface for ease of use and integration with other platforms. +- Add support for multiple languages. + +## License + +This project is licensed under the MIT License. diff --git a/Rajasthan Chatbot/dataset3.json b/Rajasthan Chatbot/dataset3.json new file mode 100644 index 0000000..d7f68dd --- /dev/null +++ b/Rajasthan Chatbot/dataset3.json @@ -0,0 +1,1187 @@ +[ + { + "name": "BITS Pilani", + "location": "Pilani", + "type": "Private", + "rating": 4.5, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 245000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 245000 + }, + { + "name": "B.Tech Electrical and Electronics Engineering", + "duration": "4 years", + "annual_fee": 245000 + }, + { + "name": "B.Tech Chemical Engineering", + "duration": "4 years", + "annual_fee": 245000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 245000 + } + ], + "admission": { + "exam": "BITSAT", + "cutoff": { + "2023": 320, + "2022": 315, + "2021": 310 + } + }, + "placements": { + "average_package": 2500000, + "highest_package": 6000000, + "top_recruiters": ["Microsoft", "Google", "Amazon", "Oracle", "Goldman Sachs"] + }, + "facilities": ["Wi-Fi campus", "Smart classrooms", "Advanced labs", "Sports complex", "Incubation center"] + }, + { + "name": "Malaviya National Institute of Technology (MNIT)", + "location": "Jaipur", + "type": "Public", + "rating": 4.4, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 125000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 125000 + }, + { + "name": "B.Tech Electronics and Communication Engineering", + "duration": "4 years", + "annual_fee": 125000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 125000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 20000, + "2022": 22000, + "2021": 23000 + } + }, + "placements": { + "average_package": 1800000, + "highest_package": 5500000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Adobe"] + }, + "facilities": ["Library", "Hostel", "Sports facilities", "Research labs", "Wi-Fi"] + }, + { + "name": "Manipal University Jaipur", + "location": "Jaipur", + "type": "Private", + "rating": 4.2, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 210000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 200000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 200000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 200000 + } + ], + "admission": { + "exam": "MET", + "cutoff": { + "2023": 15000, + "2022": 16000, + "2021": 17000 + } + }, + "placements": { + "average_package": 1200000, + "highest_package": 4500000, + "top_recruiters": ["Accenture", "Capgemini", "Infosys", "HCL", "IBM"] + }, + "facilities": ["Library", "Hostel", "Wi-Fi", "Sports complex", "Cafeteria"] + }, + { + "name": "Rajasthan Technical University (RTU)", + "location": "Kota", + "type": "Public", + "rating": 4.0, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 80000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 80000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 80000 + }, + { + "name": "B.Tech Electronics and Communication Engineering", + "duration": "4 years", + "annual_fee": 80000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 30000, + "2022": 32000, + "2021": 35000 + } + }, + "placements": { + "average_package": 800000, + "highest_package": 2000000, + "top_recruiters": ["Tech Mahindra", "L&T", "IBM", "Siemens", "Samsung"] + }, + "facilities": ["Hostel", "Library", "Labs", "Sports facilities", "Cafeteria"] + }, + { + "name": "JK Lakshmipat University", + "location": "Jaipur", + "type": "Private", + "rating": 4.1, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 180000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 175000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 175000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 175000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 35000, + "2022": 36000, + "2021": 37000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 3000000, + "top_recruiters": ["Deloitte", "Cognizant", "Wipro", "TCS", "Infosys"] + }, + "facilities": ["Wi-Fi campus", "Library", "Labs", "Sports complex", "Cafeteria"] + }, + { + "name": "Poornima University", + "location": "Jaipur", + "type": "Private", + "rating": 3.9, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 150000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 145000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 145000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 145000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 40000, + "2022": 41000, + "2021": 42000 + } + }, + "placements": { + "average_package": 900000, + "highest_package": 2500000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Sports complex", "Cafeteria"] + }, + { + "name": "JECRC University", + "location": "Jaipur", + "type": "Private", + "rating": 4.0, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 170000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 165000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 165000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 165000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 38000, + "2022": 39000, + "2021": 40000 + } + }, + "placements": { + "average_package": 1100000, + "highest_package": 3000000, + "top_recruiters": ["Infosys", "TCS", "Wipro", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Swami Keshvanand Institute of Technology (SKIT)", + "location": "Jaipur", + "type": "Private", + "rating": 4.1, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 130000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 130000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 130000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 130000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 35000, + "2022": 36000, + "2021": 37000 + } + }, + "placements": { + "average_package": 950000, + "highest_package": 2200000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Jaipur Engineering College & Research Centre (JECRC)", + "location": "Jaipur", + "type": "Private", + "rating": 4.2, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 140000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 40000, + "2022": 42000, + "2021": 43000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 2800000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Arya College of Engineering & IT", + "location": "Jaipur", + "type": "Private", + "rating": 3.8, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 125000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 125000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 125000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 125000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 45000, + "2022": 46000, + "2021": 47000 + } + }, + "placements": { + "average_package": 850000, + "highest_package": 2100000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Global Institute of Technology", + "location": "Jaipur", + "type": "Private", + "rating": 3.9, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 140000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 48000, + "2022": 49000, + "2021": 50000 + } + }, + "placements": { + "average_package": 900000, + "highest_package": 2400000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Vivekananda Global University (VGU)", + "location": "Jaipur", + "type": "Private", + "rating": 4.0, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 160000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 44000, + "2022": 45000, + "2021": 46000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 3000000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Jagannath University", + "location": "Jaipur", + "type": "Private", + "rating": 3.7, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 135000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 135000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 135000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 135000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 47000, + "2022": 48000, + "2021": 49000 + } + }, + "placements": { + "average_package": 800000, + "highest_package": 2000000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "LNM Institute of Information Technology (LNMIIT)", + "location": "Jaipur", + "type": "Private", + "rating": 4.3, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 240000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 240000 + }, + { + "name": "B.Tech Electrical and Electronics Engineering", + "duration": "4 years", + "annual_fee": 240000 + }, + { + "name": "B.Tech Communication & Computer Engineering", + "duration": "4 years", + "annual_fee": 240000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 20000, + "2022": 21000, + "2021": 22000 + } + }, + "placements": { + "average_package": 1500000, + "highest_package": 4000000, + "top_recruiters": ["Amazon", "Microsoft", "Google", "Adobe", "Flipkart"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + + + + { + "name": "Amity University Rajasthan", + "location": "Jaipur", + "type": "Private", + "rating": 4.3, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 220000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 215000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 215000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 215000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 30000, + "2022": 31000, + "2021": 32000 + } + }, + "placements": { + "average_package": 1200000, + "highest_package": 3500000, + "top_recruiters": ["TCS", "Wipro", "Infosys", "IBM", "Cognizant"] + }, + "facilities": ["Library", "Hostel", "Wi-Fi", "Sports complex", "Labs"] + }, + { + "name": "Jaipur National University", + "location": "Jaipur", + "type": "Private", + "rating": 4.0, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 175000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 170000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 170000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 170000 + } + ], + "admission": { + "exam": "JEE Main", + "cutoff": { + "2023": 45000, + "2022": 46000, + "2021": 47000 + } + }, + "placements": { + "average_package": 900000, + "highest_package": 2500000, + "top_recruiters": ["Wipro", "Infosys", "Capgemini", "Cognizant", "HCL"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Cafeteria"] + }, + { + "name": "Maharishi Arvind Institute of Engineering & Technology", + "location": "Jaipur", + "type": "Private", + "rating": 4.1, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 150000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 145000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 145000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 145000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 41000, + "2022": 42000, + "2021": 43000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 3000000, + "top_recruiters": ["TCS", "Wipro", "Infosys", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Suresh Gyan Vihar University", + "location": "Jaipur", + "type": "Private", + "rating": 4.2, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 200000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 195000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 195000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 195000 + } + ], + "admission": { + "exam": "SGVU CET", + "cutoff": { + "2023": 25000, + "2022": 26000, + "2021": 27000 + } + }, + "placements": { + "average_package": 1100000, + "highest_package": 2800000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "HCL"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Rajasthan Institute of Engineering and Technology (RIET)", + "location": "Jaipur", + "type": "Private", + "rating": 4.0, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 165000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 160000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 38000, + "2022": 39000, + "2021": 40000 + } + }, + "placements": { + "average_package": 900000, + "highest_package": 2400000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Cafeteria"] + }, + { + "name": "Mody University of Science and Technology", + "location": "Laxmangarh", + "type": "Private", + "rating": 4.4, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 250000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 245000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 245000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 245000 + } + ], + "admission": { + "exam": "MUST CET", + "cutoff": { + "2023": 15000, + "2022": 16000, + "2021": 17000 + } + }, + "placements": { + "average_package": 1300000, + "highest_package": 3500000, + "top_recruiters": ["TCS", "Wipro", "Infosys", "IBM", "Cognizant"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Institute of Engineering and Technology, Alwar", + "location": "Alwar", + "type": "Private", + "rating": 4.1, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 145000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 140000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 140000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 43000, + "2022": 44000, + "2021": 45000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 2900000, + "top_recruiters": ["TCS", "Wipro", "Infosys", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Arya Institute of Engineering and Technology", + "location": "Jaipur", + "type": "Private", + "rating": 4.0, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 155000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 150000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 150000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 150000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 39000, + "2022": 40000, + "2021": 41000 + } + }, + "placements": { + "average_package": 950000, + "highest_package": 2600000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Cafeteria"] + }, + { + "name": "Rajasthan Technical University", + "location": "Kota", + "type": "Public", + "rating": 4.5, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 90000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 85000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 85000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 85000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 15000, + "2022": 16000, + "2021": 17000 + } + }, + "placements": { + "average_package": 1200000, + "highest_package": 3500000, + "top_recruiters": ["TCS", "Wipro", "Infosys", "Cognizant", "IBM"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Banasthali Vidyapith", + "location": "Tonk", + "type": "Public", + "rating": 4.6, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 180000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 175000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 175000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 175000 + } + ], + "admission": { + "exam": "Banasthali Aptitude Test", + "cutoff": { + "2023": 10000, + "2022": 11000, + "2021": 12000 + } + }, + "placements": { + "average_package": 1300000, + "highest_package": 4000000, + "top_recruiters": ["TCS", "Wipro", "Infosys", "IBM", "Cognizant"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "Poornima College of Engineering", + "location": "Jaipur", + "type": "Private", + "rating": 4.2, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 165000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 160000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 37000, + "2022": 38000, + "2021": 39000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 2800000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Cafeteria"] + }, + { + "name": "Birla Institute of Technology and Science, Pilani (BITS Pilani)", + "location": "Pilani", + "type": "Private", + "rating": 4.9, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 400000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 390000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 390000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 390000 + } + ], + "admission": { + "exam": "BITSAT", + "cutoff": { + "2023": 2500, + "2022": 2600, + "2021": 2700 + } + }, + "placements": { + "average_package": 2400000, + "highest_package": 6000000, + "top_recruiters": ["Google", "Microsoft", "Facebook", "Amazon", "Flipkart"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Sports complex"] + }, + { + "name": "JECRC University", + "location": "Jaipur", + "type": "Private", + "rating": 4.3, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 175000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 170000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 170000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 170000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 30000, + "2022": 31000, + "2021": 32000 + } + }, + "placements": { + "average_package": 1100000, + "highest_package": 2800000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Cafeteria"] + }, + { + "name": "Global Institute of Technology (GIT)", + "location": "Jaipur", + "type": "Private", + "rating": 4.1, + "courses": [ + { + "name": "B.Tech Computer Science", + "duration": "4 years", + "annual_fee": 160000 + }, + { + "name": "B.Tech Mechanical Engineering", + "duration": "4 years", + "annual_fee": 155000 + }, + { + "name": "B.Tech Civil Engineering", + "duration": "4 years", + "annual_fee": 155000 + }, + { + "name": "B.Tech Electrical Engineering", + "duration": "4 years", + "annual_fee": 155000 + } + ], + "admission": { + "exam": "REAP", + "cutoff": { + "2023": 35000, + "2022": 36000, + "2021": 37000 + } + }, + "placements": { + "average_package": 1000000, + "highest_package": 2700000, + "top_recruiters": ["Infosys", "Wipro", "TCS", "Cognizant", "Capgemini"] + }, + "facilities": ["Library", "Hostel", "Labs", "Wi-Fi", "Cafeteria"] + } + +] diff --git a/Rajasthan Chatbot/model.ipynb b/Rajasthan Chatbot/model.ipynb new file mode 100644 index 0000000..36783df --- /dev/null +++ b/Rajasthan Chatbot/model.ipynb @@ -0,0 +1,444 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "8da630ad", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: cohere in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (5.9.0)\n", + "Requirement already satisfied: types-requests<3.0.0,>=2.0.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (2.31.0.6)\n", + "Requirement already satisfied: httpx-sse==0.4.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (0.4.0)\n", + "Requirement already satisfied: pydantic>=1.9.2 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (2.8.2)\n", + "Requirement already satisfied: parameterized<0.10.0,>=0.9.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (0.9.0)\n", + "Requirement already satisfied: typing_extensions>=4.0.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (4.12.2)\n", + "Requirement already satisfied: requests<3.0.0,>=2.0.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (2.28.1)\n", + "Requirement already satisfied: pydantic-core<3.0.0,>=2.18.2 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (2.20.1)\n", + "Requirement already satisfied: tokenizers<1,>=0.15 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (0.19.1)\n", + "Requirement already satisfied: httpx>=0.21.2 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (0.27.2)\n", + "Requirement already satisfied: fastavro<2.0.0,>=1.9.4 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (1.9.5)\n", + "Requirement already satisfied: boto3<2.0.0,>=1.34.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from cohere) (1.35.11)\n", + "Requirement already satisfied: jmespath<2.0.0,>=0.7.1 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from boto3<2.0.0,>=1.34.0->cohere) (0.10.0)\n", + "Requirement already satisfied: botocore<1.36.0,>=1.35.11 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from boto3<2.0.0,>=1.34.0->cohere) (1.35.11)\n", + "Requirement already satisfied: s3transfer<0.11.0,>=0.10.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from boto3<2.0.0,>=1.34.0->cohere) (0.10.2)\n", + "Requirement already satisfied: certifi in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from httpx>=0.21.2->cohere) (2022.12.7)\n", + "Requirement already satisfied: idna in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from httpx>=0.21.2->cohere) (3.4)\n", + "Requirement already satisfied: httpcore==1.* in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from httpx>=0.21.2->cohere) (1.0.5)\n", + "Requirement already satisfied: sniffio in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from httpx>=0.21.2->cohere) (1.3.1)\n", + "Requirement already satisfied: anyio in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from httpx>=0.21.2->cohere) (3.5.0)\n", + "Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from httpcore==1.*->httpx>=0.21.2->cohere) (0.14.0)\n", + "Requirement already satisfied: annotated-types>=0.4.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from pydantic>=1.9.2->cohere) (0.7.0)\n", + "Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from requests<3.0.0,>=2.0.0->cohere) (1.26.14)\n", + "Requirement already satisfied: charset-normalizer<3,>=2 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from requests<3.0.0,>=2.0.0->cohere) (2.0.4)\n", + "Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from tokenizers<1,>=0.15->cohere) (0.24.6)\n", + "Requirement already satisfied: types-urllib3 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from types-requests<3.0.0,>=2.0.0->cohere) (1.26.25.14)\n", + "Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from botocore<1.36.0,>=1.35.11->boto3<2.0.0,>=1.34.0->cohere) (2.8.2)\n", + "Requirement already satisfied: pyyaml>=5.1 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers<1,>=0.15->cohere) (6.0)\n", + "Requirement already satisfied: tqdm>=4.42.1 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers<1,>=0.15->cohere) (4.64.1)\n", + "Requirement already satisfied: fsspec>=2023.5.0 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers<1,>=0.15->cohere) (2024.6.1)\n", + "Requirement already satisfied: filelock in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers<1,>=0.15->cohere) (3.9.0)\n", + "Requirement already satisfied: packaging>=20.9 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers<1,>=0.15->cohere) (22.0)\n", + "Requirement already satisfied: six>=1.5 in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.36.0,>=1.35.11->boto3<2.0.0,>=1.34.0->cohere) (1.16.0)\n", + "Requirement already satisfied: colorama in c:\\users\\dev2005\\anaconda3\\lib\\site-packages (from tqdm>=4.42.1->huggingface-hub<1.0,>=0.16.4->tokenizers<1,>=0.15->cohere) (0.4.6)\n", + "Note: you may need to restart the kernel to use updated packages.\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\dev2005\\anaconda3\\lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\dev2005\\anaconda3\\lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\dev2005\\anaconda3\\lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\dev2005\\anaconda3\\lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\dev2005\\anaconda3\\lib\\site-packages)\n", + "WARNING: Ignoring invalid distribution -rotobuf (c:\\users\\dev2005\\anaconda3\\lib\\site-packages)\n" + ] + } + ], + "source": [ + "\n", + "pip install cohere" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "cb0c25ed", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "8c60a77f", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Welcome to the Rajasthan Engineering College Chatbot!\n", + "You can ask about college eligibility based on these exams: BITSAT, JEE Main, MET, REAP, SGVU CET, MUST CET, Banasthali Aptitude Test\n", + "You can also ask about college fees, placements, and general information.\n", + "Type 'quit' to exit.\n", + "\n", + "You: which colleges can i get, my jee main rank is 1200\n", + "\n", + "Chatbot: Based on your JEE Main score/rank of 1200, you may be eligible for the following colleges:\n", + "\n", + " name location rating\n", + " Malaviya National Institute of Technology (MNIT) Jaipur 4.4\n", + " JK Lakshmipat University Jaipur 4.1\n", + " JECRC University Jaipur 4.0\n", + "Jaipur Engineering College & Research Centre (JECRC) Jaipur 4.2\n", + " Global Institute of Technology Jaipur 3.9\n", + " Vivekananda Global University (VGU) Jaipur 4.0\n", + " LNM Institute of Information Technology (LNMIIT) Jaipur 4.3\n", + " Amity University Rajasthan Jaipur 4.3\n", + " Jaipur National University Jaipur 4.0\n", + "\n", + "You: which college is best amongst all\n", + "\n", + "Chatbot: The best college is Malaviya National Institute of Technology (MNIT) in Jaipur.\n", + "\n", + "AI Explanation: MNIT is known for its strong academic programs and prominent placement opportunities, making it one of the best engineering institutes in the country. Here are some reasons why MNIT stands out:\n", + "\n", + "1. High Placement Statistics: MNIT enjoys excellent placement records, attracting top companies throughout its recruitment process. This is evident from its average package of ₹1800000, which demonstrates the high demand for its graduates in the job market.\n", + "\n", + "2. Strong Academic Curriculum: MNIT offers a wide range of enriching\n", + "\n", + "You: tell me more about the life at BITS pilani\n", + "\n", + "Chatbot: Birla Institute of Technology & Science, Pilani (BITS Pilani) is a private university in Rajasthan that offers undergraduate and graduate programs in engineering and technology. \n", + "\n", + "Life at BITS Pilani is known to be vibrant and engaging due to the numerous academic and extracurricular opportunities available on campus. Here are some key aspects of life at BITS Pilani:\n", + "\n", + "1. Academic Rigor: BITS Pilani is known for its rigorous and highly competitive academic environment. The curriculum is designed to be comprehensive and practical, covering both theoretical and applied aspects of engineering and technology. \n", + "\n", + "2. Industry Partnerships: BITS Pilani has established partnerships with industry leaders and corporations, allowing students to benefit from internships, collaborations, and competitive placements. These connections ensure that the curriculum stays relevant and in sync with industry requirements. \n", + "\n", + "3. Experiential Learning: Along with traditional classroom learning, BITS Pilani emphasizes hands-on learning through projects, experiments, and industry internships. This enables students\n", + "\n", + "You: which are the top recruiters in Rajasthan Engineering colleges\n", + "\n", + "Chatbot: There are many prominent recruiters across various engineering disciplines across Rajasthan. Some of the top recruiters in Rajasthan engineering colleges are: \n", + "\n", + "1. IBM \n", + "2. Amazon\n", + "3. Adobe\n", + "4. Bank of America\n", + "5. Cummins \n", + "6. Eaton Corporation\n", + "7. Honeywell\n", + "8. Siemens\n", + "9. Adani Group\n", + "10. JCBL Ltd \n", + "\n", + "These companies offer lucrative packages to the students ranging between 3.5-7 Lakhs annually, depending on the profile and the engineering branch. \n", + "\n", + "It is important to note that the availability of these recruiters is subject to the reputation and accreditation of the engineering college in Rajasthan. Therefore, it is recommended to refer to reputed national surveys and research for a more comprehensive understanding of the latest recruitment trends and companies involved.\n", + "\n", + "You: quit\n", + "Thank you for using the chatbot. Goodbye!\n" + ] + } + ], + "source": [ + "import json\n", + "import pandas as pd\n", + "import cohere\n", + "import re\n", + "from fuzzywuzzy import fuzz\n", + "import os\n", + "from dotenv import load_dotenv\n", + "\n", + "load_dotenv('api.env')\n", + "\n", + "def load_data(file_path='dataset3.json'):\n", + " try:\n", + " with open(file_path, 'r') as f:\n", + " data = json.load(f)\n", + " return pd.json_normalize(data)\n", + " except FileNotFoundError:\n", + " print(f\"Error: File {file_path} not found.\")\n", + " return None\n", + " except json.JSONDecodeError:\n", + " print(f\"Error: Unable to parse JSON from {file_path}.\")\n", + " return None\n", + "\n", + "df = load_data()\n", + "if df is None:\n", + " print(\"Exiting due to data loading error.\")\n", + " exit(1)\n", + "\n", + "# Set up Cohere client\n", + "cohere_api_key = os.getenv('COHERE_API_KEY')\n", + "if not cohere_api_key:\n", + " print(\"Error: COHERE_API_KEY not found in api.env file.\")\n", + " exit(1)\n", + "\n", + "try:\n", + " co = cohere.Client(cohere_api_key)\n", + "except Exception as e:\n", + " print(f\"Error initializing Cohere client: {str(e)}\")\n", + " exit(1)\n", + "\n", + "def parse_user_input(user_input):\n", + " score = ''.join(filter(str.isdigit, user_input))\n", + " score = int(score) if score else None\n", + " \n", + " college_match = re.search(r\"(?:cutoff|information|fees|package|salary|life|placements|recruiters).*?\\b([A-Za-z\\s]+)\\b\", user_input, re.IGNORECASE)\n", + " college_name = college_match.group(1).strip() if college_match else None\n", + " \n", + " year_match = re.search(r'\\b(2023|2022|2021)\\b', user_input)\n", + " year = year_match.group(0) if year_match else '2023'\n", + " \n", + " return score, college_name, year\n", + "\n", + "def get_unique_exams():\n", + " return list(df['admission.exam'].unique())\n", + "\n", + "unique_exams = get_unique_exams()\n", + "\n", + "def fuzzy_match_college(college_name, threshold=70):\n", + " if not college_name:\n", + " return None\n", + " def match_score(x):\n", + " full_name_score = fuzz.ratio(x.lower(), college_name.lower())\n", + " acronym_score = fuzz.ratio(''.join(word[0] for word in x.split() if word).lower(), college_name.lower())\n", + " return max(full_name_score, acronym_score)\n", + "\n", + " best_match = max(df['name'], key=match_score)\n", + " if match_score(best_match) > threshold:\n", + " return best_match\n", + " return None\n", + "\n", + "def get_college_cutoff(college_name, year='2023'):\n", + " matched_college = fuzzy_match_college(college_name)\n", + " if matched_college:\n", + " college = df[df['name'] == matched_college]\n", + " if not college.empty:\n", + " cutoff_column = f'admission.cutoff.{year}'\n", + " if cutoff_column in college.columns:\n", + " cutoff_info = college.iloc[0][cutoff_column]\n", + " if pd.notna(cutoff_info):\n", + " return f\"The cutoff for {matched_college} in {year} is {cutoff_info}.\"\n", + " else:\n", + " return f\"Cutoff information for the year {year} is not available.\"\n", + " else:\n", + " return f\"Cutoff information for the year {year} is not available.\"\n", + " return f\"College '{college_name}' not found.\"\n", + "\n", + "def normalize_column(column):\n", + " return (column - column.min()) / (column.max() - column.min())\n", + "\n", + "def find_best_college(eligible_colleges):\n", + " if eligible_colleges is None or eligible_colleges.empty:\n", + " return \"There are no eligible colleges available. Please ask for eligible colleges first.\"\n", + "\n", + " eligible_colleges['normalized_avg_package'] = normalize_column(eligible_colleges['placements.average_package'].astype(float))\n", + " eligible_colleges['normalized_rating'] = normalize_column(eligible_colleges['rating'].astype(float))\n", + " eligible_colleges['normalized_highest_package'] = normalize_column(eligible_colleges['placements.highest_package'].astype(float))\n", + " eligible_colleges['normalized_cutoff'] = 1 - normalize_column(eligible_colleges['admission.cutoff.2023'].astype(float))\n", + "\n", + " weights = {\n", + " 'avg_package': 0.4,\n", + " 'rating': 0.1,\n", + " 'highest_package': 0.2,\n", + " 'cutoff': 0.3\n", + " }\n", + "\n", + " eligible_colleges['composite_score'] = sum(weights[param] * eligible_colleges[f'normalized_{param}'] for param in weights)\n", + "\n", + " best_college = eligible_colleges.loc[eligible_colleges['composite_score'].idxmax()]\n", + "\n", + " #NEW FEATURE ADDED --> Now the reason behind being the best college will get generated using AI\n", + " ai_prompt = f\"The best college is {best_college['name']} in {best_college['location']}. It has an average package of ₹{best_college['placements.average_package']} and a rating of {best_college['rating']}. Please provide a reason why this college is the best based on its rating, placement, and cutoff score.\"\n", + " \n", + " try:\n", + " explanation = co.generate(\n", + " model='command',\n", + " prompt=ai_prompt,\n", + " max_tokens=100,\n", + " temperature=0.7\n", + " ).generations[0].text.strip()\n", + "\n", + " return f\"The best college is {best_college['name']} in {best_college['location']}.\\n\\nAI Explanation: {explanation}\"\n", + "\n", + " except Exception as e:\n", + " return f\"The best college is {best_college['name']} in {best_college['location']} but there was an issue generating an AI explanation: {str(e)}\"\n", + "\n", + "def get_colleges_by_score(score, exam):\n", + " eligible_colleges = df[df['admission.exam'] == exam]\n", + " \n", + " if exam in [\"JEE Main\", \"REAP\", \"MET\"]:\n", + " eligible_colleges = eligible_colleges[eligible_colleges['admission.cutoff.2023'].astype(int) >= score]\n", + " elif exam == \"BITSAT\":\n", + " eligible_colleges = eligible_colleges[eligible_colleges['admission.cutoff.2023'].astype(int) <= score]\n", + " else:\n", + " return f\"I'm sorry, but I don't have specific information about how to interpret scores for the {exam} exam.\"\n", + " \n", + " if eligible_colleges.empty:\n", + " return f\"I'm sorry, but with the given {exam} score/rank of {score}, you may not be eligible for any of the colleges in our database. Consider exploring other options or improving your score.\"\n", + " else:\n", + " result = eligible_colleges[['name', 'location', 'rating']].head(10).to_string(index=False)\n", + " return f\"Based on your {exam} score/rank of {score}, you may be eligible for the following colleges:\\n\\n{result}\", eligible_colleges\n", + "\n", + "def get_college_fees(college_name):\n", + " matched_college = fuzzy_match_college(college_name)\n", + " if matched_college:\n", + " college = df[df['name'] == matched_college]\n", + " if not college.empty:\n", + " courses = college.iloc[0]['courses']\n", + " fees_info = \"\\n\".join([f\"{course['name']}: ₹{course['annual_fee']} per year\" for course in courses])\n", + " return f\"Annual fees for {matched_college}:\\n{fees_info}\"\n", + " else:\n", + " return f\"College '{college_name}' not found.\"\n", + "\n", + "def get_median_salary(college_name):\n", + " matched_college = fuzzy_match_college(college_name)\n", + " if matched_college:\n", + " college = df[df['name'] == matched_college]\n", + " if not college.empty:\n", + " avg_package = college['placements.average_package'].iloc[0]\n", + " return f\"The average package for {matched_college} is ₹{avg_package} per annum.\"\n", + " return f\"College '{college_name}' not found.\"\n", + "\n", + "def get_college_info(college_name):\n", + " matched_college = fuzzy_match_college(college_name)\n", + " if matched_college:\n", + " college = df[df['name'] == matched_college]\n", + " if not college.empty:\n", + " info = college.iloc[0]\n", + " return f\"\"\"\n", + "College: {info['name']}\n", + "Location: {info['location']}\n", + "Type: {info['type']}\n", + "Rating: {info['rating']}\n", + "Admission Exam: {info['admission.exam']}\n", + "Average Package: ₹{info['placements.average_package']}\n", + "Highest Package: ₹{info['placements.highest_package']}\n", + "Top Recruiters: {', '.join(info['placements.top_recruiters'])}\n", + "Facilities: {', '.join(info['facilities'])}\n", + " \"\"\"\n", + " return f\"College '{college_name}' not found.\"\n", + "\n", + "# NOW the chatbot will be able to handle open ended question.\n", + "def handle_general_questions(user_input):\n", + " try:\n", + " ai_prompt = f\"\"\"\n", + " You are an expert on engineering colleges in Rajasthan. Answer the following question in a detailed and helpful manner:\n", + " {user_input}.\n", + " \n", + " Provide a clear, factual, and informative response based on common knowledge about Rajasthan engineering colleges, their environment, placements, facilities, and courses.\n", + " \"\"\"\n", + " \n", + " response = co.generate(\n", + " model='command',\n", + " prompt=ai_prompt,\n", + " max_tokens=200,\n", + " temperature=0.7\n", + " )\n", + " return response.generations[0].text.strip()\n", + " except Exception as e:\n", + " return f\"An error occurred while using AI: {str(e)}\"\n", + "\n", + "def process_query(user_input):\n", + " global eligible_colleges\n", + " lower_input = user_input.lower()\n", + " score, college_name, year = parse_user_input(user_input)\n", + " \n", + " if \"which colleges can i get\" in lower_input:\n", + " if score is not None:\n", + " exam = next((exam for exam in unique_exams if exam.lower() in lower_input), None)\n", + " if exam:\n", + " result, eligible_colleges = get_colleges_by_score(score, exam)\n", + " return result\n", + " else:\n", + " return \"Please specify a valid exam (e.g., JEE Main, BITSAT, REAP, MET).\"\n", + " else:\n", + " return \"Please provide a valid rank or score.\"\n", + "\n", + " elif \"which college is best\" in lower_input:\n", + " if eligible_colleges is None:\n", + " return \"Please specify a score and exam first to find eligible colleges.\"\n", + " return find_best_college(eligible_colleges)\n", + " \n", + " elif \"cutoff\" in lower_input:\n", + " if college_name:\n", + " return get_college_cutoff(college_name, year)\n", + " else:\n", + " return \"I'm sorry, I couldn't find the college name in your request.\"\n", + " \n", + " elif \"fees\" in lower_input:\n", + " if college_name:\n", + " return get_college_fees(college_name)\n", + " else:\n", + " return \"Please provide a college name for fee information.\"\n", + "\n", + " elif \"median salary\" in lower_input or \"average package\" in lower_input:\n", + " if college_name:\n", + " return get_median_salary(college_name)\n", + " else:\n", + " return \"Please provide a college name for placement package information.\"\n", + " \n", + " else:\n", + " # AI-powered handling for general open-ended questions\n", + " return handle_general_questions(user_input)\n", + "\n", + "def run_chatbot():\n", + " print(\"Welcome to the Rajasthan Engineering College Chatbot!\")\n", + " print(f\"You can ask about college eligibility based on these exams: {', '.join(unique_exams)}\")\n", + " print(\"You can also ask about college fees, placements, and general information.\")\n", + " print(\"Type 'quit' to exit.\")\n", + " \n", + " while True:\n", + " user_input = input(\"\\nYou: \")\n", + " if user_input.lower() == 'quit':\n", + " print(\"Thank you for using the chatbot. Goodbye!\")\n", + " break\n", + " \n", + " response = process_query(user_input)\n", + " print(f\"\\nChatbot: {response}\")\n", + "\n", + "if __name__ == \"__main__\":\n", + " run_chatbot()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "483ed17e", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/Rajasthan Chatbot/ss1.png b/Rajasthan Chatbot/ss1.png new file mode 100644 index 0000000..ed9e618 Binary files /dev/null and b/Rajasthan Chatbot/ss1.png differ diff --git a/Rajasthan Chatbot/ss2.png b/Rajasthan Chatbot/ss2.png new file mode 100644 index 0000000..1eee4ad Binary files /dev/null and b/Rajasthan Chatbot/ss2.png differ