Chatbot Wiki
Advertisement

A Chatbot is a software that can have intelligent conversation with a human being.

This site lets you participate in collaborative creation of chatbots.

You can go into the brain chatbot, edit the code, and immediately have a chat with your creation!

Let's take a guided tour.

Chatting with a bot

We will start our tour with an extremely simple chatbot - a chatbot that just echoes everything you say.

Please open this page (preferrably in a new window): Echo.js

As you can see, it is written in Javascript - a simple, general purpose language. Currently this is the only language that the site supports. In the future, we hope to support chatbot-specific languages, such as AIML, ChatScript, RiveScript and more.

The chatbot code contains a comment that tells the server what class (type of chatbot) it is. Then come two functions: greet - for starting a conversation with a user, and hear - for responding to user input.

You can probably guess what this chatbot does, but why guess when you can try? Click the link chat with the bot, on top of the bot, and you should find yourself in a chatroom. As you can see, when you enter the room, the chatbot greets you using the "greet" function.

Now say something, and see what happens. As you can see, the "hear" function is called.

Matching patterns

To do anything interesting, our chatbot must be able to understand what the user says. The simplest form of "understanding" is pattern matching.

Please open this page (preferrably in a new window): Pattern.js

There are two main differences between this and the previous chatbot:

  • In greet, we select a greeting at random - to make it a bit more interesting.
  • In hear, we use Javascript's regular expression capabilities in order to guess what the user is talking about.

Click the link chat with the bot, and have a little chat with the bot.

There's a lot more to Javascript - complex regular expressions, variables and more. But this site is not about teaching Javascript - it's about collaborative editing of chatbots. So let's proceed right to -

Editing chatbots

Return to the Pattern.js page, Near the heading, there is a blue edit button. Click it, and you will find yourself in an editable textbox that contains the source code of the bot.

You are now free to edit the bot! Don't be afraid to change things; if anything goes wrong, you can always go to a previous version: from the edit menu, click history.

As an exercise, try to add a new pattern, for example, have the bot speak about your favorite animal, book, city, whatever. After you finish, write something in the Summary line below, to explain what you did, and then click the Publish button.

The code is not updated automatically on the server - you have to update it manually. While in the chatroom, click the Reload Chatbots button at the top-right. The bot leaves the room, changes its brain, and re-enters. Now you can speak with the bot to test your changes. If your code contains errors, the bot will alert about them when you reload it. He might say something like this: Pattern: gwtchat.chat.ChatRoomException: Run-time error in bot code: sun.org.mozilla.javascript.internal.EvaluatorException: syntax error (line #23) This can give you a hint where the bug is, but it may be difficult to use this hint, as the wikia editor does not have line numbers. You may find it easier to copy the code to a file on your computer, edit it, and then copy it back to the wikia editor.

Reading wiki pages

When developing a complex chatbot, it may be convenient to split the bot into several files. For example, you may want to put localized strings in different files, to let different people work on them simultaneously. Let's see an example.

Open the following page: WikiReader.js.

As you can see, the greeting for a new user is taken from another page: WikiReader.js/Greeting.txt. If you click chat with the bot you will see that the bot greets you with the text in that page.

You can edit the greeting just like you edited the bot in the previous section. After you edit, click the upload link on top of the page, to update the text on the server. Click reload chatbots in the chatroom, and the bot will greet you with the new message.

The bot asks you about your language. If you say English, Spanish or Hebrew, you will see the greeting in that language. If you say another language, you will see an error message because the corresponding language file do not exist yet. But, of course you can create it if you want!

Suppose you want to add French:

  • Click the button add a page. For a title, enter WikiReader.js/French.txt.
  • In a different tab/window, open an existing language file (e.g. WikiReader.js/English.txt), edit it, copy the source and paste in the new page you created.
  • Change the text to French.
  • Click publish at the bottom of the page.
  • Click upload at the top of the page.

The French translation is now on the server, and if you tell the chatbot that your language is French, you should see your new text!

More bots

  • Eliza.js - the well-known psychotherapist. Javascript implementation by George Dunlop.
  • WikiReader.js - demonstrates how you can read text from this wiki from within your bot.

Experimental bots:

Text Transformers:

Advertisement