Building a Multi-Lingual Bot on the Oracle Chatbot Platform

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.”

You should see that there no new services enabled. Click on Enable APIs and 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.

Do Not click “Create Credentials”
Expand the Create credentials and create the API Key
Select the API Key. This creates the API key that we are going to use inside the Bot platform.
Copy the Key to the clipboard.

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.

Click Service, Select Google for the Service Type.

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:

autoTranslate: “boolean”
translated: “string”

Create the below states with the language specific components for the translation service to be detected automatically:

setAutoTranslate:
component: “System.SetVariable”
properties:
variable: “autoTranslate”
value: true
transitions: {}
detect:
component: “System.DetectLanguage”
properties: {}
transitions: {}
translate:
component: “System.TranslateInput”
properties:
variable: “translated”
transitions: {}

Add the source variable in the Intent flow that holds the English Translation of the user input :

intent:
component: “System.Intent”
properties:
variable: “iResult”
sourceVariable: “translated”
confidenceThreshold: 0.4

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 :

English (default) and Bot response

Spanish Detection :

The user asking for the same thing in Spanish and Bot responding in English
Hindi Input and Bot responding back in Hindi

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.

 

4 thoughts on “Building a Multi-Lingual Bot on the Oracle Chatbot Platform”

  1. tried an it didnt work. threw me an error that my intent requires an action under transitions.So i placed transition: action: unresolved. Still didnt work the translation

    intent:
    component: “System.Intent”
    properties:
    variable: “iResult”
    sourceVariable: “translated”
    confidenceThreshold: 0.4

    Like

  2. Try this in the Intent block :
    transitions:
    actions:
    unresolvedIntent: “unresolved”

    The UnresolvedIntent can be routed to the below block of code.

    unresolved:
    component: “System.Output”
    properties:
    text: “uac intent was found”
    transitions:
    return: “done”

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s