Building a Multi-Lingual Bot on the Oracle Chatbot Platform
First things first, if you are new to building Chatbot using the Oracle Cloud Platform, here are some quick videos to get you started on the platform and its capabilities. There is also an online MOOC (Massive Open Online Course) available on how to build your first BOT using the Oracle Platform and access the Bot through Facebook Channel.
Now that we understand how to build a bot let’s turn the Bot that can recognise the input from the end user conversing in his/her own language and respond accordingly.
The Bot platform allows you to bring your own translation keys (Google / Bing) and the Bot can be configured to detect the language. The bot further converts the user input to English, intent recognition by the NLP engine kicks off, based on the dialogue flow the bot structures the response in English which is again translated back into the language in which the question was asked by the user.
Let’s see that this in action :
Step 1: Enabling Google Translation Service on the Google Cloud Console.
Choose your translation service and acquire the keys. Here I am interested in configuring my Bot with Google Translation. So let’s find out how to get the Translation key from Google.
Sign up with Google and navigate to https://console.cloud.google.com/
Create a New Project. (E.g : GoogleTest) and navigate to the “APIs & Services.”
Enable the Translation API : Search for Translation API and Enable the service.
If this is the first time you are enabling the APIs on Google Platform, it prompts you to set up the Billing Account. Google provides with a $400 trial valid for 1 year which is good enough for Demo/pilot builds.
The next step is to create the Credentials: Note: Do Not click “Create Credentials”. instead, click on the “key” icon or credentials on the left menu.
Step 2: Configure Google Translation URL on Oracle Bots Platform.
Login to the BOTs UI and navigate to the Translation Service menu configuration screen next to Import Bot:
Create a new Service and Select Google from the Drop Down Menu.
Provide the Base URL as below: https://translation.googleapis.com/language/translate/v2
Copy the API key from the Google Console that we created earlier and use it for the Authorization Token.
Open your Bot, and define the below context variables in your dialogue flow:
Create the below states with the language specific components for the translation service to be detected automatically:
Add the source variable in the Intent flow that holds the English Translation of the user input :
That’s is all we need for auto-translation. You can test your Bot in the simulator and you should start seeing the conversation shaping based on the user’s language input.
Few Examples :
Spanish Detection :
In the next Post, I will talk about how we can override some of the Bot responses using the Language Bundle Packs bundled with the platform if Google/ Bing Translation outputs don’t fit the customer’s requirements.