Implementing a voice enabled chatbot which converses with a user via their voice in natural language. The user should be able to interact with the application like a voice assistant and appropriate response will be returned by the application (also through voice). The number of topics to converse upon will be fixed however the user should be able to converse through natural language.
If we have topics like the weather, location information, inventory information etc the application should be able to converse in that particular topic. Like, if we have questions such as:-
Hey, what is the weather today? - Weather Information
I want to know if there are any shopping stores near me? - Location Information
Will it rain today? - Weather Information
Can you tell me availability of item in store X? - Inventory Information
Initially the application should be able to identify each particular topic and then return the appropriate response. After that, the chatbot should carry on the conversation regarding that particular topic. For eg:
User - I want to know if there are any shopping stores near me.
Chatbot - These are the nearest stores:- A, B, C. Where do you wanna go?
User - I want to go to the most popular one among them
Chatbot- All right, showing you directions to C.
So, mainly the chatbot should formulate appropriate responses to incoming questions and carry on the conversation. Keep in mind, the conversation would be in natural language and the user has returned sufficient information.
Before starting conversation, bot will fetch the location of the user and other details to give personalized results.
Step 1: Speech-2-Text: Given a speech through Microphone, store it and convert it using SpeechRecognition and PyAudio libraries.
Step 2: Topic Modelling: Get Entity and Intent of chat using model with a corpora. To get the trained model, we will use the classifier to categorize it into weather, location and inventory. After that using RASA-NLU with Spacy library, we will extract the entities.
Step 3: After Finding Intent and Entity, we will set the model using the following method: Intent = Weather: Based on entity specified, We will use weather API to fetch data of location. Intent = Location: Following conversation flow: Get Stores located or Any Nearby Stores Choose Store Inventory Details about Store
Step 4: Use cache mechanism to give result about recently used query.
To change the language, enter the BCP-47 code from language support. If you want the language to be English (default), press enter.
Arguments:
For now, you can use it for following domain:
Introduction: Hi, Hello..
Weather: Get weather info
Google Search: get any google search
Wikipedia Search: What is "query"?
Google Places: Get me best places.
You can quit by pressing Ctrl+C
voice-enabled-chatbot
repo locally. In the terminal, run : git clone https://github.com/satyammittal/voice-enabled-chatbot.git
sudo apt-get install portaudio19-dev
(linux) brew install portaudio
(mac) pip install -r requirements.txt
pip install -r requirements_windows.txt
python -c "import nltk; nltk.download('stopwords')"
config.py
file.Run the application using command - python chatbot.py