Easy Steps 2 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 why now we’ll start building a multilingual voice bot to help everyone talk to the bot into there preferred language.

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 with the help of a multilingual voice bot. 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.

How to build a Multilingual Voice Bot

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 multilingual 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(to make it multilingual). For this step we have to make changes in the Voice_bot.py 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 make it multilingual). 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 makes 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(to make it multilingual).

multilingual voice bot

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:

Time to wrap up now. Hope you liked our content on How to build a multilingual bot with rasa chatbot. See you in our next blog, thanks for reading our blog and do leave a comment below to help us improve the content to serve you all of our experience with you. Stay tuned with us for more Rasa Chatbot contents.

Also check out our other playlist Rasa Chatbot, Internet of things, Docker, Python Programming, etc.
Become a member of our social family on youtube here.

Till then stay tuned and happy learning 🤗

Ashish Saini
Ashish Saini

I am a software developer for Python/Machine Learning. Also, I’m Rasa Hero at Rasa. Also, I’m a youtuber where I regulary uploads the videos to help this generation learn about the technology just like they are playing games.

5 thoughts on “Easy Steps 2 build a Multilingual Voice Bot

  1. Hello sir, I have to use the Multilingual Command in the website I don’t want to use the Command Line for the Voice can you please guide How to bring it on website, Also if you have resource plz share.

      1. (chatbotenv) C:\Users\HARSHAL\mybott\.harshalbot\actions>python Voice_bot.py
        Bot says, Traceback (most recent call last):
        File “Voice_bot.py”, line 27, in
        myobj = gTTS(text=translator.translate(bot_message),lang=’hi’)
        File “C:\Users\HARSHAL\anaconda3\envs\chatbotenv\lib\site-packages\gtts\tts.py”, line 134, in __init__
        assert text, “No text to speak”
        AssertionError: No text to speak

Leave a Reply