Sunday, November 6, 2011

How to Configure a Non-English Second Life Pandorabot

I receive frequent requests from Pandorabot owners asking me how they can get their Pandorabot to respond in a non-English language. The default behavior of all Pandorabots including the Pandorabot METAbolt Add-On, Pandorabot Actorbot Add-On, Smart Dance Pole, Inner Spheres, and Pandorabot V5 is to look for trigger phrases in English and respond in English. Some default responses are non-English where translations have been provided in the Artificial Intelligence Markup Language (AIML) the Pandorabot is using at pandorabots.com. Here's how you can configure your Pandorabot to recognize non-English trigger phrases and respond in a non-English language.

The following settings in the Configuration notecard control language preferences in Pandorabots:


Quick & Easy

Edit the Configuration notecard in your Pandorabot and add the following two lines to the top of the notecard:

    LANG_CODE = xx
    WIKIPEDIA_TRIGGERS =what is ,?,what's ,?,what're ,?,what is a ,?,what is an ,?,what is the ,?,what are the ,?,what's a ,?,what's an ,?,who is,?,who are,?,who're,?,who's,?,,?

Where "xx" is one of the 2 letter language codes from the "Wiki" column in the table at http://meta.wikimedia.org/wiki/List_of_Wikipedias

More Difficult

Add translations of the Wikipedia triggers in the language you prefer. For example, to configure your Pandorabot to query the French Wikipedia when it detects "who is", "what is", or "who are" in French spoken in local chat, set the following:

    LANG_CODE = fr
    WIKIPEDIA_TRIGGERS =what is ,?,what's ,?,what're ,?,what is a ,?,what is an ,?,what is the ,?,what are the ,?,what's a ,?,what's an ,?,who is,?,who are,?,who're,?,who's,?,ce qui est ,?,qui est ,?,qui sont ,?,,?

Similarly, add translations for the EMAIL_TRIGGERS, SPELL_TRIGGERS, and SHUTOFF_TRIGGERS

Detailed & Thorough

Edit the Configuration notecard in your Pandorabot and modify the following notecard settings:

LANG_CODE
Use one of the 2 letter codes from the "Wiki" column in the table at http://meta.wikimedia.org/wiki/List_of_Wikipedias
For instance, to query the Italian Wikipedia, set
    LANG_CODE = it
If no Wikipedia article exists for your query in the preferred language then the Pandorabot will try the English Wikipedia.

LANG_CODES
A list of 2 letter language codes which will be selectable via the Pandorabot dialog menu.

LANG_NAMES
A list of language names that correspond to the LANG_CODES list. This is what will be displayed in the Pandorbot dialog menu buttons.

UNWIKIABLE_PHRASES
This is a list of phrases which should not be passed to Wikipedia. To accomodate non-English speaking guests, you can translate these phrases into your guests' language(s) and either replace or add to the list.

WIKIPEDIA_TRIGGERS
These phrases trigger a Wikipedia query. Add to this list similar phrases in the language(s) your guests will be using. Alternatively, to force every message the Pandorabot hears to Wikipedia, add an empty string to the list of triggers. For example:

        WIKIPEDIA_TRIGGERS =what is ,?,what's ,?,what're ,?,what is a ,?,what is an ,?,what is the ,?,what are the ,?,what's a ,?,what's an ,?,who is,?,who are,?,who're,?,who's,?,ce qui est ,?,qui est ,?,qui sont ,?,,?

ALPHA_TRIGGERS
These phrases indicate the resident wishes to query Wolfram Alpha for a factual answer. The default Wolfram Alpha triggers are “wolfram alpha”, “wolfram “, and “alpha “. For example, to ask Wolfram Alpha for the cube root of 387 you could say “wolfram what is the cube root of 387”. If you wish to provide Wolfram Alpha triggers in another language, add them to this list.

EMAIL_TRIGGERS
These phrases indicate the resident wishes to send email. Add to this list similar phrases in the language(s) your guests will be using.

SPELL_TRIGGERS
These phrases indicate the resident wishes to check the spelling of a word. Add to this list similar phrases in the language(s) your guests will use.

SHUTOFF_TRIGGERS
These phrases will shut the Pandorabot off until touched. By default the Pandorabot will stop responding when it hears either “Be quiet” or “Shut up” in local chat. Add to this list similar phrases in the language(s) your guests will be using.

Greeting New Arrivals

To set the greeting issued to new arrivals, edit the Greeter_Config notecard and set the GREET_1, GREET_2, GREET_3, and GREET_4 variables with a welcome message in the language of your preference.

Custom Language AIML

Many of the Pandorabot responses are generated with the Artificial Intelligence Markup Language (AIML) at pandorabots.com. Even with all of the above settings configured for a non-English language the Pandorabot will still draw some responses from either the English language Wikipedia, Wolfram Alpha, or the AIML responses at pandorabots.com. Many of the responses at pandorabots.com have been translated into German and French. However, most are English only.

To provide for non-English pandorabots.com responses it will either be necessary to translate the existing default AIML or create a custom set of AIML files in the preferred language. If you have a custom set of AIML files already prepared and used by a public Pandorabot at pandorabots.com then you can configure your Second Life Pandorabot to use that AIML by setting
    BOT_ID = that-pandorabots-id
in the Configuration notecard.

No comments:

Post a Comment