lab_bot using python
Project Description: Lab Component Inventory Voice Assistant This Python-based voice assistant helps users check the availability of components in a lab by responding to voice commands. The project utilizes several Python libraries, such as speech_recognition, pyttsx3, and nltk, for voice recognition, text-to-speech (TTS), and natural language processing (NLP). Additionally, component data is stored in a JSON file to facilitate easy management of the lab's inventory.
Key Features: Voice Input Recognition:
The system listens to the user’s voice input using the speech_recognition library, allowing users to ask about the availability of specific components in the lab. Component Availability Check:
The bot checks for the requested component's availability and attributes, such as resistance for resistors, inductance for inductors, and capacitance for capacitors. Component data is stored in contents_lab.json. Text-to-Speech (TTS):
The bot responds verbally using the pyttsx3 library, allowing for a hands-free interaction experience. Natural Language Processing (NLP):
Using the nltk library, the bot tokenizes and filters the user’s question to focus on important keywords like component names and attributes (e.g., resistance, inductance). Custom JSON Inventory:
The project includes a contents_lab.json file that stores component names, attributes, and availability in a structured format, making it easy to manage the lab inventory. How it Works: The user asks questions such as, "Do we have 10-ohm resistors in the lab?" or "Is the 555 timer IC available?". The system listens to the input and preprocesses the question using the nltk library by removing stopwords and irrelevant tokens. The bot checks the contents_lab.json file for the requested component and its attributes. If the component is available, the system responds with details such as availability and count (if applicable). If the requested component or attribute isn't found, the bot informs the user accordingly. Code Overview: contents_lab.json: Stores the lab components with attributes such as resistance (for resistors), inductance (for inductors), capacitance (for capacitors), etc. Each component has availability and count information.
Core Functions:
load_components(): Loads the component data from contents_lab.json. preprocess_question(): Tokenizes and preprocesses the user's voice input using nltk to extract relevant keywords. check_availability(): Searches the JSON data for the requested component and its attributes. provide_audio_feedback(): Converts text responses into audio using pyttsx3. get_speech_input(): Listens for user input using the microphone and processes it using speech_recognition. Example Interaction: User: "Do we have a 10-ohm resistor?"
Bot: "Yes, we have 20 resistors of 10 ohms available in the lab."
User: "Is the IRF540 MOSFET available?"
Bot: "Yes, this MOSFET is available in the lab."
Requirements: Python 3.x Libraries: pyttsx3: For text-to-speech. speech_recognition: For speech-to-text. nltk: For natural language processing. json: For handling the JSON component data.
Please review this project ad accept the pull request. This project (lab-bot)will be the extended project of text to speech project in your repo .This project details are also present in my account.