AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

How To Create Your Own Customised Chatbot For Beginners - Chatbots 101
 
 

How To Create Your Own Customised Chatbot For Beginners - Chatbots 101

  With the recent increase in the popularity of chatbots (due, in large part, to the recent 2011 Chatterbox Challenge), I’ve seen a lot of requests in various places, asking about how someone could create their own chatbot, with many of these questions coming from individuals who have no prior experience or knowledge.
  Basically, there are several options available to the prospective new botmaster for creating a new chatbot, and while I can’t cover every option here, I’ll try to briefly cover some of the more popular options, citing advantages and disadvantages of each. Then I’ll outline a couple of brief, step by step guides to setting up your own chatbot; one of them a stand-alone bot app, and the other one a web-based chatbot. Let’s start with some basics first, though.

Chatbot Types - One Or Many?

  The two main “types” of chatbots are “stand-alone” applications, where the chatbot runs on a single computer, and web-based, which run on a remote server, and are (generally) able to be reached by the general public through a web page. The majority of stand-alone bots also integrate some sort of system interface, allowing your bot to control certain aspects and functions of your computer, such as playing media files, or retrieving documents. They usually also have a graphical component built in, as well, in the form of an avatar (often female) that enhances interaction, thus improving your experience. The basic web-based chatbot, in its simplest form, is nothing more than a blank white web page with a form embedded in it that is the sole interface between the user (you) and the bot. Any “upgrades” or improvements to the interface are solely the option and responsibility of the botmaster.


Pros And Cons: Stand-Alone Chatbot Applications

  Most stand-alone chatbot apps, such as AI Bliss (http://aibliss.com/) and Kari (http://karigirl.com/) have these advantages:

[ul]
[li]Most are simple to install and use[/li]
[li]They have an attractive, engaging graphical interface, and often have a full, rich world to explore.[/li]
[li]The majority have a Text to Speech (TTS) system, adding an audio component that enhances your experience[/li]
[/ul]

However, they also have the following disadvantages:

[ul]
[li]These bots are not “your own”, iun that there are very limited degrees of configuration that help to personalise your bot.[/li]
[li]For the most part, these applications are not free, though most have a “demo” version.[/li]
[li]Many contain (to varying degrees) “mature” content (nudity, adult language, sexual situations, etc.) that may not be welcome if the household contains children or others who would find such content offensive.[/li]
[/ul]

  Now this isn’t true for every stand-alone bot application, as I’ll demonstrate later on. But for the vast majority of stand-alone chatbots, at least one or more of the above is true.


Pros and Cons: Web-Based Chatbots

Just as with a stand-alone chatbot app, there are advantages and disadvantages to creating a web-based chatbot, as well. So let’s start with the “good news”, first:

[ul]
[li]Web-based chatbots allow much more control over behavior and personality.[/li]
[li]For the most part, you can have your bot hosted for free, though there are “premium” options available.[/li]
[li]Since you control your bot’s configuration, you can decide whether you want it to have “mature content”.[/li]
[/ul]

  Unfortunately, there are disadvantages, too:

[ul]
[li]Web based bots aren’t as easy to set up as a stand-alone chatbot application; there are more steps involved, and there is no “installer” available to take care of the process.[/li]
[li]Setting up a web-based chatbot requires at list minimal experience with the following skills :[/li]
[ul]
[li]HTML[/li]
[li]CSS[/li]
[li]JavaScript[/li]
[li]Artificial Intelligence Markup Language (AIML) – for Pandorabots, or other bots that use AIML architecture)[/li]
[/ul]
[/ul]

Any sort of “fancy” features, such as Text To Speech, or an animated avatar, would have to be created and integrated into your bot’s page, and certain features, such as Voice Recognition, are either unavailable, or are severely limited.

  That said, however, I think that building a web-based bot has more potential for being a rewarding challenge, if you have (or are willing to learn) the necessary skills.


Going Rogue - Making EVERYTHING From Scratch (well, almost everything)

Before I set out to create my first chatbot, Morti (http://www.geekcavecreations.com/Morti/), I took a look at several of the options available to me; and since I already had a fair amount of knowledge and experience with web design, web programming, and database management, and since I already had a place where I could host my own chatbot, I decided to take the most difficult route, and host my bot myself, which allowed me to control every aspect of my bot. In addition to the skills I mentioned above, I also had to be VERY familiar with the following:

[ul]
[li]PHP scripting language[/li]
[li]MySQL database management[/li]
[li]A chatbot engine/interpreter (in my case, Program O)[/li]
[li]jQuery (used for Morti’s interface)[/li]
[/ul]

Once I decided that this was the route I wanted to take, I went about “building” my bot in the following way:

[ol]
[li]I downloaded the PHP AIML interpreter, Program O (http://www.program-o.com/), and studied it thoroughly.[/li]
[li]I uploaded the script to Morti’s directory, and ran the installation script that was included, following the instructions, and updating the database information within the script, as needed.[/li]
[li]I obtained the ALICE Annotated AIML set (a list of AIML pattern/response templates, available at http://www.alicebot.org/downloads/sets.html), and incorporated it into Morti’s script, using the Program O Administration page.[/li]
[li]I spent dozens of hours (and counting, since I’m still at it) revising patterns and templates, giving Morti a unique personality, and allowing him to be rid of ALICE’s infamous “green dress”.[/li]
[li]I reviewed the Program O script, improving and expanding its functionality (and again, I’m still at it), and added features, such as determining the user’s gender from the name they entered (not perfect, nor 100% comprehensive, but pretty good), and adding Wiki and Google searches.[/li]
[li]I did LOTS of testing. And then more testing. And more still. And… Well, you get the picture.[/li]
[/ol]

  All told, I’ve probably put in well over 1,000 hours into Morti over the last 10 months, though the initial creation process only took me about a day to complete. The rest of that time has been taken up by experimenting with Morti’s script, updating and modifying his responses, and discovering other areas of improvement; and I still have a long way to go before I’ll have the bot I envisioned in the beginning. Believe me when I tell you that choosing to build a chat bot the way I did is a LOT of work, but if you have the skills, patience, and dedication, it’s the most rewarding option of them all.


NOTE: - I’ve had to split this article into several posts, to keep it within the size limitations of the forums. Please read the next reply to continue. smile

 

 
  [ # 1 ]

Two paths, One Goal: Setting up Your Chatbot - A “Quick” Intro

  As promised earlier, I’ll be discussing two methods of chatbot creation in a step by step manner, covering the basics from beginning to end. These “guides”, as it were, will only cover the “bare-bones” basics; any improvements, upgrades, additions, etc. are all up to you. I’ll also be listing several resources at the end of this article, where you can go to seek out help, should you need it. These resources are, in my opinion, the best of the best, with regards to helping the average beginning botmaster to understand chatbots and their “care and feeding”. The two guides will be for creating chatbots using Bruce Wilcox’s stand-alone app, ChatScript, and setting up a chatbot at Pandorabots. First, let’s take a look at ChatScript.


Part One: The Stand-Alone Method - ChatScript

  Tell me something. does this make any sense to you?:

?: (when will you go home) I go home tomorrow

How about this?:

S: ( I like spinach ) Are you a fan of the Popeye cartoons?

Well, when we get done here, it still may not make sense, but you’ll at least know something about these lines. But i’m getting a bit ahead of myself. Let’s take this from the top, shall we?

1.) ChatScript: Overview

  ChatScript is a stand-alone chatbot engine, complete with its own unique scripting language, created by bruce wilcox, who also created the 2010 loebner prize winning chatbot, suzette. this is one of very few stand-alone chatbot apps that have none of the “disadvantages” I listed earlier for stand-alone bot apps. However, ChatScript has its own set of “disadvantages”:

With ChatScript, There is no graphical interface. This is strictly a “console” application, with just a “DOS prompt” window that you use to enter input/read output.
When first “installed”, there is no “real” bot. There are only a few lines of scripting, designed only to make sure that the application is properly set up. Making the chatbot is up to you.
Since ChatScript has its own unique scripting language, you’re now experiencing your first “learning curve”, and have to learn how the scripting language works. Not to worry, though. it’s easier than it looks.

  Since we’ve covered the “cons”, it’s only fair to cover the “pros”, as well. with ChatScript, You can:

[ul]
[li]Build your bot your way. You can make it (him, her, whatever) funny or serious, silly or sexy. It’s all up to you.[/li]
[li]Program your bot to make use of certain system commands to act like the other stand-alone apps, in that you can have it play media files, open documents, including web pages, open or close other programs, or any number of other tasks. In short, you can use ChatScript to create a “Personal Computer Assistant”.[/li]
[/ul]

  Now that we have a basic idea of what ChatScript is, let’s see about creating a chatbot with it.

2.) Download ChatScript

  The ChatScript app can be downloaded at http://sourceforge.net/projects/chatscript. The package is in zip format, which every version of windows from xp onward can handle without having a zip extracting program. Download it to a location where you can easily find it (many people suggest downloading it to the desktop. I don’t, because that just makes a mess over time). If you don’t already have a “downloads” directory somewhere, I recommend creating one, either in your “my documents” directory, or on your hard drive. Once you have the file downloaded, you’re ready for the next step.

3.) Extract the Package

  ChatScript doesn’t have an installer (yet), so you need to extract the contents of the zip file to a convenient location. Depending on your OS, you may have a few options. The easiest would be to extract the files to your root drive (usually C:), but this is mostly a matter of preference. As long as you know where the files were extracted to, you’re ok. If you’ve never extracted files from a zip archive before, there are several good tutorials on the net, so you can just google it, or post a question on the forums here, asking for help.

4.) RTFM

  In case you’ve never run across that acronym, RTFM stands for “Read The Fine Manual” (Yeah, RIGHT!). And I don’t mean to just skim through it, either. The documentation, which is found in the DOCUMENTATION directory, is your first, and best, source of information on the inner workings of ChatScript. It’s also the best place to gain a fundamental understanding of the scripting language that ChatScript uses for your bot. So please, read the manual. Then read it again. And again. This is important, so I can’t stress it enough. RTFM

5.) First Run

  According to the manual (you did read the manual, right? No? Back to step 4 with you!) On page three, there’s a fairly simple way to make sure that everything is running as it should. simply run chatscript.exe, watch as some stats appear in the console window, and then the prompt “Enter user name” is printed. Simply enter the name you want the bot to know you by, and hit enter. You’ll get a “welcome to chatscript” message, and can now begin “chatting” with your new bot. For now, though, the bot is severely limited, in that it only knows how to respond to just four inputs: “What is your name”, “How was your childhood”, “What are you afraid of”, and “What is your history”. it’s up to you now to turn your bot into the conversational genius and paragon of dialogue that you’ve always dreamed your bot could become.

6.) Learning The Language

  The manual has a much more comprehensive explanation of the syntax of the scripting language than i’ll outline here, but i’ll briefly touch on a couple of lines, and explain what they mean. Take, for example, the following line:

?: (when will you go home) I go home tomorrow

  This is a typical question “tag” (?:), along with the pattern (in parentheses) and the desired response. Any time chatscript receives an input in the form of a question (determined not only by punctuation, but also by how the input is formed), it tries to find an input pattern that matches the input, and if found, outputs the correct response. So now we know how to handle a user’s questions. But what if they make a statement?

s: ( I like spinach ) Are you a fan of the popeye cartoons?

  As you can see, the syntax is basically the same, where a “type label” (s:) is followed by a pattern (enclosed by parentheses), and a response. Each of these above lines constitutes a “rule”, and the vast majority of rules follow this same syntax. The manual, as I said, covers all of this, and more, in much greater detail than I can here, so be sure to refer to it often.


7.) On Your Own

  Now that I’ve outlined the basics, it’s up to you to take the next step, and build your chatbot. Best of luck to you, and don’t forget that, if you get “stuck”, the forums that I’ve listed below are a great place to ask questions, and get answers.

NOTE - Only one more section to go. Read on, my friends. Read on. smile

 

 
  [ # 2 ]

Part Two: A Web-Based Chatbot - Pandorabots

  Ok, now that we’ve covered the basics of creating a chatbot with a stand-alone app, let’s look at the process involved for creating a web-based bot. I don’t pretend to know which bot hosting provider is the simplest to use, but I’ve been through the process at Pandorabots, and it’s pretty simple. Pandorabots is also one of the most popular chatbot hosting companies, so this is why i’m going to use them.


1.) Visit the website and sign up for an account

  Let’s head on over to http://www.pandorabots.com/botmaster/en/home, and get started. On the main page, there’s a link that says “Account Sign-up” near the upper left corner of the page. Setting up an account is both free and simple. Just provide a little bit of information, read and agree to the ToS, and we’re on our way.

2.) Plan Your Bot

  I’m sure that by now you’re eager to jump right in and start making your new bot, but let’s take a step back, and think about things for a moment. Like just about every other thing in life that we do, success depends on careful planning. this is no different. everything from the bot’s name, to it’s personality and attitude, and the role that it will play in your life (and that of others) really needs to be thought out, and it’s far better to iron these details out in advance. so grab a “pad and pencil” (or a text editor and your keyboard), and ask yourself these questions:

Will my new bot be for entertainment, education, support, or promotion (advertising and sales)?
In what ways (if any) will my bot interact with the general public?
Do I want my chatbot to “wear a green dress”? (long standing alice joke)
Do I want my bot to have any mature content?

  Once you have your chatbot’s role and personality mapped out, it’s time to begin its creation.


3.) The Work Begins: Create Your Bot

  Back at the pandorabots website, log into your account. Towards the top, you’ll see a link labelled “create a pandorabot”. Click on that, and you’ll be asked to provide the name of your chatbot, along with a list of options as to which (if any) “aiml set” you wish to use. Since this is your first chatbot, you likely won’t have any aiml files created yet, and there will be options later to change this, so I suggest choosing either the standard aiml set, or the annotated alice aiml set (unless, of course, you want your new bot to speak german or italian). If you choose the last option, “no initial content”, your bot won’t have anything at all to say. When you’ve made your choices, and named your bot, you’re ready for the next step. Let’s do some “tweaking”, shall we?


4.) Customise Your Bot

  Ok, you’re now the proud owner of a chatbot on Pandorabots. HURRAY! But you have two challenges ahead of you. First off, your bot isn’t “published” yet, which means that it’s not accessible to the web yet. We’ll address that in a moment, but first, let’s work a little on making your bot truly yours.

  The page you should be looking at now should have the PB (Pandorabots) logo in the upper left corner, sitting above two rows of buttons. Feel free to explore here. When you’re ready, we’ll be starting with the link labelled “Properties”. Click on that, and you should see a form that contains some of your bot’s attributes, such as Birthday, what kinds of music it likes, the bot’s gender, and the like. Take some time to fill these out to match your preferences. You can also add whatever other attributes you like (I’ve added “petpeeves” to mine, with a value of “poor spelling”). Later on, if you create another chatbot, you can “borrow” these bot properties for your new chatbot. Click “Submit Changes” to continue.


5.) Side Trip – Learn AIML

  Your new chatbot on Pandorabots uses Artificial Intelligence Markup Language (AIML) to store input patterns, output “templates”, and other data that the server uses to create the output that the users to your bot type in. In order for you to be able to alter the responses your chatbot give to any given input, you need to have at least a basic understanding of how AIML works. Unfortunately, describing AIML is the subject of a rather large article all by itself, so I’m going to suggest that you do some independent study here, to gain that basic understanding. There are a lot of resources available for this, and the search engine of your choice is a great place to start. Good luck, and come see me here when you’re ready to continue.


6.) Publish your bot

  Now it’s time for you to bring your creation to the world. You’ve named your chatbot, given it some default responses, and set up its “personality”. But the “world” can’t yet know the joy that is conversing with your masterpiece! Let’s correct that, shall we? Start by going to the Pandorabots home page, and logging in. There, you should see a list of all your chatbots. Pick the one you want to work on (at this point, there should be only one, unless you’ve been busier than most) by clicking on the name. You should get a warning that your bot is not yet published, and that’s what we’re here to take care of, so click on the link labelled “publish”, and let’s continue. The next page will let you know that your bot is now published, and will give you a URL that you can use to access it. Write it down (type it somewhere, copy and paste, whatever) for later use. From here, you’ll also see options for adding a Flash interface, an Oddcast vHost avatar, or customizing your chatbot’s page. You can also view conversation logs, and see some basic statistics for your bot here. Please note that any time you make changes to your bot, no matter what type of changes, and no matter how large or small, they won’t show up for the public unless you re-publish your bot. Usually, the PB page will let you know about this, so publishing the changes isn’t hard to do.


7.) That’s all, Folks!

  If you’re still with me, then you now have the “bare-bones” basics needed for creating a chatbot on Pandorabots. To be sure, there are a LOT more steps and options available for you to take, but from this point on, what happens to your new chatbot is entirely up to you. If you run into any trouble, or need to ask a question about anything related to your new chatbot, take a look at the list of resources below for links to various websites that can prove useful to you.

Summary, Recap, and Resources

  Talking to a chatbot can be a lot of fun, and if you have the desire, dedication and skills (or are willing to learn the skills needed), creating and maintaining your own chatbot can be even more so. Whether you choose a fully stand-alone “virtual companion”, like AI Bliss, or take on the challenge of creating your own stand-alone bot through ChatScript, or even create your own web-based bot through Pandorabots, you could find your days filled with hours of rewarding (if sometimes frustrating) work (or play, depending on your outlook). Whatever road you take, it can be a rather enjoyable journey.

  And, of course, if you ever find yourself in need of assistance with your chatbot, there is a huge community of other folks who are willing to help. many have had the same or similar experiences, and are only too happy to pass on what they’ve learned. the list below is only a small sampling of places that you can visit, to ask questions, get (or give) answers, or just to discuss chatbots in general, or your chatbot, specifically:

[ul]
[li]chatbots.org - Artificial Intelligence and chatbot help and discussion.[/li]
[li]AI Dreams Forums - More chatbot discussion and help – also many other subjects of interest.[/li]
[li]AI Nexus Forums - AIML and Pandorabots support – highly dedicated members, and very useful information[/li]
[li]Pandorabots Q&A Forums - specifically for Pandorabots, this is a “first look” site for answers.[/li]
[li]AI Bliss Forum - there’s really not much there, but i’m sure you can ask questions.[/li]
[li]Program O Forum - just in case you choose to do things “the hard way. smile[/li]
[/ul]

Ii think that pretty much covers the basics. as I stated before, feel free to do your own research here, and don’t forget to use the resources above to ask question and find information. building your own chatbot can be a truly rewarding, fun experience, and I wish you all the best.


Dave Morton
Geek Cave Creations
http://www.geekcavecreations.com
contact me

 

 

 
  [ # 3 ]

Dave - That is a great article. Well done. I ‘m sure it will be most helpful for newcomers to the chatbot scene.

 

 
  [ # 4 ]

Excellent article, Dave.

Building from existing chatbot packages is a good way to learn, and it is a quick way to get more convincing results. 

However, may I suggest that it is also a lot of fun to start from scratch and build your own robot:

http://79b.org/build-your-own-robot

 

 
  [ # 5 ]

Wow, now the whole article is posted, it’s even more impressive. Looks greats Dave! I’ve already directed people on external forums to this page!

 

 
  [ # 6 ]

Thanks, everyone. smile I plan on writing a more in-depth article on how to create a new ChatScript chatbot in the coming weeks. But before I can do that, I have to actually build one, and with my schedule, that’s been a slow project. I’ll get there, though! cheese

 

 
  [ # 7 ]

Your Welcome Dave,


It is fun to start a new robot design with a limited set of responses.

Down on the right side of my page:  http://79b.org/build-your-own-robot


There is a link to my limited set of responses in XML with regular expressions.

http://79b.org/build-your-own-robot/robot.xml


The basic robot building craft reminds me of the movie:  I, Robot

my responses are limited. You must ask the right question.

 

 

 
  [ # 8 ]

Dave Morton,
  I’m still on the internet researching and trying to learn a little more about aiml bots, I spoke with Morti, but like the other bots he couldn’t remember my dog’s name.  After reading you’re article for about the fourth time I can say it is pretty good.  I’ll mention some problem areas I’ve run into which may help some people new to this topic.  The majority of the Aiml files you will see are outdated, this will make you’re chat bot sound like a robot.  I’m still trying to add the javascript for Rebecca, I’ve downloaded and added java but still can’t get things to work right. 
  Since I’m a long time fan of Ultra Hal, I’ll mention him or her.  It has the learn from chat, choice of characters, a brain editor,  a free 30 trial, forum for help.
Carl Jackson

 

 
  [ # 9 ]

Thanks for your input, Carl. Morti still has a long way to go before I’ll be satisfied with him (even more than I had thought, in fact). I can’t spend as much time with training him as I would like, and my desire to do so waxes and wanes a bit from time to time. But he’ll get there, some day.

I’m aware of the Ultra Hal platform, though I’ve not experimented with it. I’ll probably do so at some point, though I’m not quite sure when. I’ve also heard a few things about Rebecca, but haven’t done any investigating yet. That’s “on the back burner”, too, I’m afraid. Just too many irons in the fire, right now. smile

One of my higher priority projects is to complete the creation of a working chatbot using ChatScript. Once that’s done, I’ll be writing a tutorial (complete with usable, generic bot files attached), with the goal of providing step-by-step instruction on how to write your own rules, and create a usable, functional (if barely) chatbot. don’t expect this tutorial tomorrow, though. With the limits on my time, I’m only able to work on the project a few hours per week, so it’‘s slow going. (one would think that having another sibling here to help me with my Grandmother would free up more free time, not consume what little I already had. raspberry )

 

 
  [ # 10 ]

If you don’t want to build the technology yourself, here are some other places to build a Chatbot:

Bot hosting:
http://inf.net/ - simple
http://www.personalityforge.com/ - advanced, home of Bildgesmythe winner of the CBC2011
http://www.verbots.com/ - some open source tools

Bot Interpreters:
-AIML
http://www.alicebot.org/downloads/programs.html

-Other
ChatScript - http://www.chatbots.org/ai_zone/viewthread/397/
RiveScript - http://www.rivescript.com/?p=aiml

 

 

 
  [ # 11 ]

You can also use <a href=“http://www.chatbot4U.com”>http://www.chatbot4U.com</a> to create your own chatbots smile

 

 
  [ # 12 ]

@Jojchi! (welcome to the AI Zone forums!). Thanks for adding this!

We’ve created a list of platforms to create your own on the homepage:
http://www.chatbots.org/#buildyourown

 

 
  [ # 13 ]

All is fine and article is good for beginners. Good work!
it allows to make a customized chatbot but this way we cant really own our work . Developing from SCRATCH is difficult but an interesting idea. To avoid reinventing the wheel:) i started making one using SQL!

 

 
  [ # 14 ]

While that’s certainly true of Pandorabots (to an extent), the other methods that I’ve outlined allow you to retain ownership of your intellectual property completely, without any restrictions. Even Pandorabots allows you to retain copyright on your work, though the ownership of the files that you upload to the PB servers, or create through the training interface become the property of Pandorabots, according to the Terms of Service.

And there’s certainly nothing wrong with “reinventing the wheel”, either. Otherwise our roller skates would have tiny logs attached to the bottoms of them. :D

 

 
  [ # 15 ]
Dave Morton - Dec 13, 2011:

And there’s certainly nothing wrong with “reinventing the wheel”, either. Otherwise our roller skates would have tiny logs attached to the bottoms of them. :D

Ha! I’ll have to remember this. LOL

 

This topic is closed, it's not possible to reply

 1 2 > 
1 of 2
 
  login or register to react