Chatbot Wiki
Advertisement

This site lets you participate in collaborative creation of chatter bots.

You can go into the "brain" of every 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.

Both functions get as an input a structure called chatter, which contains some information about the current person speaking with the system. The functions use only the chatter.name field. Currently the name is always Human, but in the future there may be a way to personalize this.

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.

back in the Echo.js page, You can click the view the recent chats to see what conversations other people had with this chatbot.

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.

BTW, that's why the page names of the bots end with ".js". It's so you can save them as files on your computer, open them with a standard source-code editor, and automatically have Javascript syntax highlighting.

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.

We could use any other page name, but using a page name that starts with "WikiReader.js/" has the advantage that it automatically creates a link from that page back to the main chatbot 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!

Creating new pages

Suppose you want to add French:

  • Click the blue add a page button. You can find it on top of the main page, or on the right of any other page. For a title, enter WikiReader.js/French.txt. If you see a menu with 2 layout options, choose the second option, Blank Page.
  • 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!

Using text transformers (beta)

A text transformer is a tool that takes a certain text and returns another text. There are many potential uses to a transformer. Let's see a simple example.

Open the following page: YesNo.txt.

As you can see, it contains two subtitles: yes and no. Each of them has several items whose meaning matches the title.

Above the yes title, there is a line that says that this page defines an 'ExactTextTransformer. This is the simplest possible transformer - it transforms any item text to the text of the corresponding title.

You can see the transformer in action by clicking the train and try online link at the top. Click the button labeled train, then enter some text under "Say:" and see the result in the log pane.

This simple transformer is still quite useful for defining concepts.

To see how it can be used in a chatbot, open Pooh.js.

Pooh wants to know whether you answered "yes" or "no" to his question, but there are many ways to say "yes" or "no". So, in the hear function, Pooh uses the YesNo transformer that we just saw, to transform the message into either "yes" or "no".

A transformer can be used not only for NLU (=understanding the user's input), but also for NLG (=generating output). For example, if Pooh wants to say "yes" or "no" in a random manner, he can untransform his answer and get a random item from the appropriate list.

Combine this with the idea from the previous section, and you can have a different transformer for each language, which makes it very easy to translate your chatbot to other languages!

You can see Pooh in action by clicking chat with the bot. Alternatively, you can use the link view the recent chats to view Pooh's chat log.

Psychotherapy

Do you remember Eliza, the first chatbot? Well, she's here, too - at Eliza.js! Javascript implementation by George Dunlop.

Future Work

This site is only a proof-of-concept - it intends to prove the feasibility of using a wiki platform for developing chatbots.

The concept can be extended in several ways:

  • Support chatbot-specific languages, such as AIML, ChatScript, RiveScript and more. This requires writing Java code for interpreting these languages.
  • Support several instances of the same bot. Currently, all users that click chat with the bot go to the same chatroom and speak with the same instance of the bot (same thread). changing this requires a good deal of load testing.
  • Support common NLP operations such as sentence detection, tokenization, POS tagging, chunking (shallow syntactic parsing), textual entailment, and machine translation. There are already open-source tools for these tasks. Adding them to the platrofm requres writing Java code for transformers that use these tools.

More bots

Some more experimental bots:

Text Transformers:

Advertisement