How to build a Multilingual Voice Bot

Rasa Voice Bot | Innovate Yourself

A chatbot is that we can build easily but we need a voice bot that can talk to us, but there are people who don’t understand the English language. Either they understand their local language or they are not really good in English speaking and feel proud of speaking their local language. So they only prefer their local language. So this session is for them who prefer their local language for speaking.

This is an awareness post for all to tell them about the coronavirus, to help them be safe, prevent them from getting into the contact of coronavirus. What are the symptoms, vaccination availability, incubation, concerns, etc?

In this post, you will learn and understand how to build a voice bot that can talk to you in your local language whichever you will prefer to talk to someone. Also, you will learn and understand how to write the code to do it.

Now let’s get started and understand how to build a voice bot that can talk to you in different languages. Firstly, we have to build a chatbot that can be used with the voice bot to spread awareness for coronavirus. If you are new to Rasa then check out this link to learn how to build a rasa chatbot:

Build your end-to-end Conversational bot with UI

Also, you can check this session to learn how to build the Rasa chatbot,

When you have your chatbot ready with you now we can start further to convert it to the voice bot and how to do this conversion we have already done in our previous post.

Now when we are done with the conversion of the rasa chat bot to the voice bot (in English language). It’s time to learn how to take the input in any language other than English and to reply accordingly. For this step we have to make changes in the file which we have created during the conversion process.

First, install a module named “translate” which will be used here to translate one language to the other. To install this firstly activate the environment in terminal where you have all the packages installed for the rasa chatbot and then type:

pip install translate

this will install the module translate and also all the dependencies that are required for the module.

After the installation, we have to merge the below code as and where the language translation is required:

from translate import Translator 
translator = Translator(from_lang='en',to_lang='hi')
translation = translator.translate("hello")

In the above code we are importing the class name Translator from the module which is created to take the input in any language(for example. Hindi) to any language(for example. English). Here translator is the object that is make sure what will be the input language and what will be the output language and accordingly the method name “translate” from the object “translator” will take the input text in the language specified in “from_lang”and convert it into the language specified in “to_lang”.

Also, if in case you don’t know the input language of the spoken phrase then you can leave “from_lang” and only specify the “to_lang”. In this case google will automatically detect the input language and accordingly translate it into the language mentioned.

You can get the complete code on my git repository. To get the full code with the working goes to this link:

Download Full Code for Corona Virus voice bot

Also, if you wish to see the practical implementation of the project the do check this session as well:

For any doubts or queries related to the topic, feel free to leave a comment below in the comment section. Also, do comment on your valuable feedback so as to appreciate/improve ourselves. For any further information or queries, you can also WhatsApp me at +91 8209829808.

Till then stay tuned and happy learning 🤗

Leave a Reply

Your email address will not be published. Required fields are marked *