Voice Assistant Chatbot
This repository contains a simple voice assistant chatbot built using Python. The chatbot is capable of understanding user speech, processing it, and generating a spoken response. It utilizes various libraries, including SpeechRecognition, TextBlob, gTTS, and playsound, to handle speech recognition, sentiment analysis, text-to-speech conversion, and audio playback, respectively.
Getting Started
To run the voice assistant chatbot, follow these steps:
-
Prerequisites
Make sure you have Python installed on your system. You can download Python from the official website.
- Install Required Libraries
You need to install the following libraries if you haven’t already:
- SpeechRecognition
- TextBlob
- gTTS
- playsound
Install them using pip:
-
Run the Chatbot
Run the nlp.py
script to start the voice assistant chatbot:
- Interact with the Chatbot
Speak to the chatbot, and it will respond based on the input provided. To stop the chatbot, say “stop”.
Functionality
The voice assistant chatbot offers the following functionality:
- Speech recognition: Capturing audio from the microphone and converting it to text using Google’s Web Speech API
- Sentiment analysis: Analyzing the sentiment of the user input using TextBlob
- Text-to-speech conversion: Converting the response text to speech using gTTS
- Diverse responses: Generating various responses based on user input, sentiment, and knowledge
File Structure
nlp.py
: The main script that runs the chatbot
Contributing
Contributions are welcome! If you have any suggestions or feature requests, please open an issue or submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgements
- SpeechRecognition: A Python library for performing speech recognition, with support for various engines and APIs.
- TextBlob: A Python library for processing textual data.
- gTTS: A Python library and CLI tool to interface with Google’s Text-to-Speech API.
- playsound: A simple Python module for playing sounds using the
winsound
module on Windows and the afplay
or aplay
command on macOS and Linux.