Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Connecting to Pandorabots from Flash Lite

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Article
Created: manikantan (03 Sep 2009)
Last edited: hamishwillee (14 May 2013)

Contents

Introduction

Artificial Intelligence,(AI) bots are now used at many places to emulate a human being, to reply and talk like a real human being. This article describes how to integrate such an AI bot with Flash Lite or how to post queries to the Bot and how to receive and handle the replies from the AI bot.

PandoraBots is a software robot (also known as a bot) hosting service.From any browser, you may create and publish your own robots to anyone via the web. We believe that our technology yields the fastest bots available on the Internet. The bots are based on (Artificial Intelligence Markup Language) AMIL, and is an XML-compliant language, and came entirely from the work of Dr. Richard Wallace and the A.L.I.C.E. and AIML free software community based at http://www.alicebot.org.

There is no charge for using this site.

Here is a conversation, that I had with a BOT -

Human: Ok, what are your interests ?

ALICE: I am interested in all kinds of things. We can talk about anything. My favorite subjects are robots and computers. Hmm.

Human: Computers ?

ALICE: Computers rule.

Human: interesting.

ALICE: Would you like to know more?

Human: Sure

ALICE: OK let's do it. What would you like to know?

Human: Who do you think is smarter, man or the machine ?

ALICE: ALICE is the smartest robot of all.

Human: Thats pride

ALICE: Makes sense to me.

Human: What is the color of the leaves on trees ?

ALICE: Black.

Human: How smart.

ALICE: I am smarter than all the other robots.

PROs and CONs

However, AI bots are still evolving and still cant reply to general world questions. If you for example ask what is the population of some country or island, its very less probable that it knows. Like the conversation shown above. The best part is that, as the creator of the Bot, you can teach it to answer differently. Here is where the key lies, say you run a small company but you cant afford a Customer support center, you can train these bots to understand the query, search and identify the best answer, with context -awareness. It can be your virtual friend, answering to you patiently.

Getting Started

Go and register a bot at their website. Its free as mentioned previously. You can either create a new Bot ( without knowledge) and train or talk to a trained Bot.Either ways, you need to note down the BotID. Or you can simply use the BotID( in the code below), if you don't want to create one.

Code Example

var botSend = new LoadVars();
var botReply = new XML();
botSend.custid = 5; // Some valid Customer no. Doesnot matter much.
botSend.botid = "d0f69734de348d5a"; //valid Bot ID
botSend.input = _root.user.text;
botSend.sendAndLoad("http://www.pandorabots.com/botmaster/en/home/pandora/talk-xml", botReply);
botReply.onLoad = function(success) {
if (success) {
_root.reply.htmlText = botReply.firstChild.firstChild.nextSibling.firstChild.nodeValue;
} else {
_root.reply.htmlText = "<font Color ='#ff0000'> Failed to Connect to server</font>";
 
}
};

As you can see from the code, the return object is a XML and you need to parse. Pretty simple. Fill in the Loadvars object with the input text( your sentence in the conversation), to whom you wish to talk (BotID) and also identify yourself (CustomerID). And use the sendAndLoad() function to communicate and fetch the reply, as shown above.

Download

You can download a sample SWF that demonstrates talking to a Bot, who replies like a friend. Source code at FlashBot.swf

Further reading

Documentation

AIML introduction - AIML Introduction

Author

--manikantan 17:01, 3 September 2009 (UTC)

This page was last modified on 14 May 2013, at 06:14.
71 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×