Multilingual Chatbots with Oracle Digital Assistant


Not every person who uses a chatbot, is a native English speaker. As the popularity of chatbots is increasing day by day, a very common scenario in chatbot implementation is to provide support for users in their native languages.

Oracle Digital Assistant provides you a platform to design your enterprise grade chatbots quickly and efficiently. Though the NLP (Natural Language Processing) engine of Oracle Digital Assistant is based on English language, it still allows you to make your multi-lingual chatbots. To do so, you use translation services in Oracle Digital Assistant. In this article, you will become familiar with translation service in Oracle Digital Assistant and how to use them to create native language chatbots.

Out of the box, Oracle Digital Assistant provide support for Google and Microsoft translation services. In order to use either of these services, you will first need to register with Google or Microsoft translation API services based on your preference. After registration, you will get a base URL and an authorization token from your translation service provider. You will need them to configure translation service for your Oracle Digital Assistant.

Your approach towards localizing your chatbot will completely depend on your use case. For instance, it could be that you want your chatbot to support any specific language like Dutch, Spanish, French, etc. Or it could also be a case that you want your chatbot to detect the language in which user provides the input and then based on that your language, your chatbot responds back.

Built-in components which are used to receive user input or provide output to user (fall under "User Interface" component type), in addition to System.Intent, have a boolean "translate" property. It is this property using which you specify whether the specific component needs to be translated or not. By default, it's value is set as false. It is also same i.e. false, when you don't explicitly set it for any component.

While translate property is available to you at component level, you also have context variable "autoTranslate" which is also a boolean type variable. By default, it is set to false (even when you don't define this explicitly). If you set autoTranslate to true, all user interface components defined within your dialog flow will be translated. In case you wish to change this behavior for any specific component, you will need to set the translate property of the component as false. In that case, only those component for which you explicitly set translate property to false will not be translated.

Now that you are familiar with translate property at component level and autoTranslate context variable, you should know about System.DetectLanguage component. System.DetectLanguage component uses your configured translation service to detect the language of text provided by user. This component specially comes handy when you want your bot to support more than one native (non-English) languages. By knowing in which language user provide the input, you can craft your dialog flow accordingly.

When it comes to the translation strategy that you want to follow in your use case, you can adhere to two strategies, as also mentioned in Oracle Digital Assistant documentation, to get user input translated:
  1. Opt-In Translation.
  2. Opt-Out Translation.

Opt-In Translation Approach:

While using this approach, you explicitly set the translate property to true for the components which you want to get translated. Ensure that you set translate property to true for "System.Intent" component as shown below.

#states is where you can define the various states within your flow.
    component: "System.Intent"
      variable: "iResult"
      translate: true
          SomeAction: "someAction"

You may set autoTranslate context variable to false in this case but it is not required neither advisable. So, just don't specify this variable at all under context variable.

Opt-Out Translation Approach:

In this approach, you set the autoTranslate context variable to true. this can be done as shown below.

#context: Define the variables which will used throughout the dialog flow here.
    iResult: "nlpresult"
    autoTranslate: "boolean"

#states is where you can define the various states within your flow.
     component: "System.SetVariable"
        variable: "autoTranslate"
        value: true
    transitions: {}

If you don't wish any specific component to get translated, the set the translate property of that component to false.

How to Implement:

First you will be configuring translation service in your Oracle Digital Assistant instance. To do so, navigate to Settings -> Translations Services as show in below Figure 1.

Figure 1: Configure Translation Service

Once there, click on "+ Service" button. This will provide you a new window where you can add a translation service of your provider, with whom you have already registered. You will need to provide the base URL and your authorization token of your translation service provider which you would have received while registering. Refer to below Figure 2 for reference.

Figure 2: Translations Service Details

Once it is done, your screen should look like below Figure 3.

Figure 3: Configured Translation Service

Next step in the process is to make this configured translation service available for your Skill. Navigate to the skill in which you want to use this newly configured translation service. Once in your skill, navigate to "Settings" from left side menu. Under the "General" tab of the screen, you will find the "Translation Service" drop-down. Refer to below Figure 4.

Figure 4: Adding Translation Service in Skill

Select the translation service you configured in previous steps, and you are good to use it in your skill.

Note: You should never add utterances in native language (non-English) in your intents.

Want to learn more about Oracle Digital Assistant? Refer to our book Oracle Digital Assistant: A Guide to Enterprise-Grade Chatbots written by Luc Bors, Mascha van Oosterhout and myself.


Popular posts from this blog

Working with JMeter for Load Testing Oracle ADF UI Application

Accessing HTTP Response Header Using JavaScript

Chatbot Common Terminology