Wednesday, November 23, 2011

How to Create Custom Pandorabot Responses

Second Life Pandorabots come preconfigured with AI response capabilities using Wikipedia, Wolfram Alpha, and an Artificial Linguistic Internet Computer Entity (A.L.I.C.E.) programmed in AIML. By default, all Pandorbots use a customized Bot ID at pandorabots.com for their AIML responses. This default Bot ID has been extensively customized for use in Second Life by the Second Life Pandorbots. However, some owners of Second Life Pandorabots may wish to customize their Pandorabot to provide responses specific to their deployment (e.g. shop attendant, tour guide, roleplay bot, etc).

Create Your Own Bot At Pandorabots.com
In order to provide site specific customized responses for your Pandorabot you need to create your own Bot at pandorabots.com. First, sign-up for an account at pandorabots.com by visiting http://pandorabots.com/botmaster/en/new-account. After you have registered for an account and logged in, click "Create a Pandorabot". Enter a name for your Pandorabot in the name field and select one of the "Startup AIML" choices. The default Pandorabot Bot ID uses Dr Wallace's A.L.I.C.E. for the startup AIML and this is the one you should select if you are going to be copying the Second Life Pandorabots AIML (see below).

Train Your New Bot
Once you have entered a name and selected a startup AIML, click "Create Pandorabot". You are now ready to either train or program your customized Pandorabot. The easiest way to provide custom responses is by "training" the Pandorabot. Click on the "Train" button near the top of the page. This allows you to enter phrases a human might say to your Pandorabot, see what the Pandorabot would reply, and type in the response that you would like your Pandorabot to give instead.

Edit Your New Bot's Properties
In addition to training your Pandorabot for specific phrase recognition and custom responses you can edit the Properties of your Pandorabot by clicking on the "Properties" button near the top of the page. Fill in, add, or change any of the Property fields on this page and click "Submit Changes" at the bottom of the page.

Upload Replacement And New AIML Files
Advanced botmasters can more extensively program the Pandorabot by editing the AIML (Artificial Intelligence Markup Language). This allows you to more generally specify patterns to recognize, categories, and templates with which to respond. To edit your Pandorabot's AIML, click on the "AIML" button near the top of the page. Here you can download, modify, and upload the AIML files your Pandorabot uses. First, let's see how you would replace some of your Pandorabot's AIML files with the ones I have customized for use in Second Life.

To use the AIML I have customized download a zip file of my AIML files at http://tinyurl.com/c433udn . My modified AIML files have been  named "AnaA", "AnaB", and so on denoting they replace the default AIML files named "A", "B", and so on.

Once you have downloaded my custom AIML return to the AIML tab at pandorabots.com. In the right hand column, uncheck the AIML files you will be replacing (e.g. uncheck A.aiml if you will be uploading my AnaA.aiml). At the bottom of the page, upload the custom AIML files you wish to use (e.g. the ones you downloaded from Scribd).

In addition to uploading my custom AIML replacement files you can create your own new AIML file specifying the responses you wish your Pandorabot to use. Copy an existing AIML file, rename it, and modify the categories, patterns, and templates to suit your individual bot's deployment. For instance, copy the "pandorabots" AIML file and rename it "MyShop.aiml" replacing the categories, patterns, and templates with phrases to match and responses suited to your shop. Upload your new AIML file(s).

Publish Your New Bot And Copy The Bot ID
Once you have customized your Bot as pandorabots.com you must "Publish" it to get a Bot ID. Click on the bot's name then the "publish" link. You will be taken to a page which says:
This pandorabot is published at:
http://www.pandorabots.com/pandora/talk?botid=blablabla 
Where "blablabla" above is your Bot ID. Copy this string.
Edit the Configuration notecard in your Second Life Pandorabot.
Add a line at the top of the notecard something like:
    BOT_ID = b8dad52dce344c95
but instead of "b8dad52dce344c95" use the Bot ID you copied
above. Save the notecard. You're done.

Subsequent changes to AIML you make at pandorabots.com will
be reflected immediately in your Second Life Pandorabot once
you republish your bot at pandorabots.com.

Monday, November 21, 2011

How to Setup Your Wolfram Alpha App ID

All recent Pandorabots can query Wolfram Alpha for factual answers and computational replies. This includes the Pandorabot METAbolt Add-On, Pandorabot Actorbot Add-On, Smart Dance Pole, Inner Spheres, and all Pandorabots. Wolfram Alpha provides what is arguably the largest most intelligent database of publicly accessible information in the world. Wolfram Alpha and Wikipedia enabled Pandorabots are arguably the smartest scripted agents in the world.

However, your Pandorabot is initially configured to access Wolfram Alpha with a shared Application ID that is limited to 2000 queries per month and used by all other unconfigured Pandorabots. It's important to setup your Pandorabot with its own unique Wolfram Alpha AppID.

To configure your Pandorabot with a unique Wolfram Alpha AppID, signup for a Wolfram Alpha Application ID by visiting http://products.wolframalpha.com/api and click the "Sign up" button. Fill out the form with a valid email address, any name you wish, and a brief description of your Pandorabot. Check the terms of use agreement box and enter the password you wish to use and confirm your password. Click "Sign up" again.

You should now be signed in to the Wolfram Alpha Developer Portal and, on the My Apps tab. Click the "Get an AppID" button and fill out the "Get a New AppID" form. Use any Application name and description you like. Click the "Get AppID" button. Copy the APPID string and click "OK".

The APPID string you copied should be stored somewhere. This is the Wolfram Alpha AppID you will use in your Pandorabot. Edit the Pandorabot Configuration notecard by right clicking on the Pandorabot or base prim and selecting "Edit". Click on the Contents tab and right click on the Configuration notecard selecting "Open". Add the following line at the top of the notecard:
    ALPHA_APP_ID = the-appid-string-you-copied
Save the notecard and close the edit window.

To recap:
  • Visit http://products.wolframalpha.com/api and click "Sign up"
  • Fill out the form and click "Sign up"
  • Click "Get an AppID" and fill out the form
  • Click "Get AppID
  • Copy the APPID string and click "OK"
  • Edit the Configuration notecard and set ALPHA_APP_ID

Wednesday, November 16, 2011

How to Start METAbolt Every Time Windows Starts

The PC on which your METAbolt client is running can restart for a variety of reasons. Microsoft frequently installs updates which require a restart. Power interruptions, system crashes, and other temporary failures can cause your computer to reboot. You can easily configure your system to restart METAbolt when this happens thus keeping your bot(s) active and logged into Second Life.

Follow the procedure outlined previously and create a BAT file to start your METAbolt bot(s).

Copy the BAT file(s) to the Windows System Startup Folder:

Start -> All Programs -> Startup on the Start Menu

On Windows 7 this is the folder: 

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
Windows 7 does not allow shortcuts in this Startup folder so a copy of your BAT file rather than a shortcut must be created. Earlier versions of Windows will allow a shortcut.

Monday, November 7, 2011

Pandorabots Can Now Query Wolfram Alpha

The latest major upgrade to all Pandorabots includes support for Wolfram Alpha queries. Wolfram Alpha, created by Wolfram Research, is the world's most sophisticated answer engine. The combination of Wikipedia query, Wolfram Alpha query, and custom AIML responses from pandorabots.com make Pandorabots the smartest scripted agents in Second Life. Or anywhere, for that matter.

Wolfram Alpha query support has been added to all Pandorabots including the Pandorabot METAbolt Add-On, Pandorabot Actorbot Add-On, Restless Studio Smart Dance Pole, Inner Spheres, Pandorabot V5, and Subgenius Pandorabot.

To trigger a Wolfram Alpha query simply preface your local chat with one of the trigger phrases setup in the Configuration notecard. By default the Wolfram Alpha trigger phrases are "wolfram", "alpha", and "wolfram alpha". So, for example, chatting "wolfram what is the cube root of 387" would get a response from your Pandorabot:
Input :
387^(1/3)

Exact result :
3^(2/3) 43^(1/3)

Decimal approximation :
7.2873616311218428454286590881202865642949650868366337582348...

Continued fraction :
[7; 3, 2, 11, 1, 23, 1, 27, 2, 1, 1, 2, 2, 1, 28, 1, 47, 1, 5, 1, 3, 25, 5, 3, 1, ...]
Initially the Pandorabot is configured to use a shared demonstration Wolfram Alpha application ID limited to 2000 queries per month. Configure your Pandorabot with a unique application ID obtained by registering at http://products.wolframalpha.com/api . Edit the Configuration notecard and set ALPHA_APP_ID  to your App ID.

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.