FANDOM


This site is used for collaborative creation of chat 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 Edit

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 (coming soon), 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 Edit

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 Edit

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 Edit

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 Edit

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 Edit

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 'ExactText transformer. 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.

Regular Expression Transformers (beta) Edit

Usually, you need more than just exact matches. You can get the full power of Java's regular expressions using transformers such as JobNegotiation.regexp. This is a part of a real-world application - a bot that should negotiate effectively with a human in a job-interview scenario. The bot should understand when the human asks a question, what are the human's salary demands, etc.

Since the bot should also have a negotiation strategy, it prefers to work with structured concepts rather than plain text. For example, the input to the bot should be "<question:agreement>" (which the bot interprets as a question about whether we agree on the job conditions), or "<Salary:20000 USD>" (which means a salary of $20,000 per month). This transformer can be used to transform the plain-text human input into the structured input that the bot expects.

During the following explanations, you might want to have the "train and try online" link open in another window, so you can try and see what happens.

The first two lines define the class of the transformer (RegularExpression) and a configuration setting (case insensitive).

Then, each pair of lines defines a single regular expression substitution. Let's take them one by one (NOTE: to fully understand this, you should be familiar with regular expression constructs):

<question:agreement>:
  • Do we agree[?]?

This means that, the concept "<question:agreement>" can be expressed by the regular expression "Do we agree[?]?". The question mark is a special char that means that the character before it is optional. If we want to match a literal question mark, we should quote it using a backslash, or - in this case - brackets. So, that regexp matches either "Do we agree" or "Do we agree?". You can try to Transform of them in the "train and try" window. You can also try to Untransform the concept "<question:agreement>" and see what happens. The bot can use this to generate answers.

<Salary:$1>:
  • a salary of $1 per month

Here, $1 means a variable. So, for example, the concept "<Salary:20000 USD>" can be expressed by the regexp "a salary of 20000 USD per month". Note that the engine performs regular expression replacements, so, if there is more text in the line, it will remain there. So, if you transform "I want a salary of 20 per month" you will get "I want <Salary:20>", and the opposite for untransform.

$1(\d+) USD:
  • [$]$1(\d+)
  • $1(\d+) dollars

This section is used to normalize amounts of dollars to a canonical form. The canonical form "20000 USD" can be expressed also with "$20000" or "20000 dollars". Note the "(\d+)" after the variable "$1". This means that the variable can only be numeric - it will only match strings of one or more digits. You can put any other regular expression inside the parenthesis, to control the format of the variable.

Note that all relevant replacements will be done, so, if you transform "I want a salary of 20000 dollars per month", you will get "I want <Salary:20000 USD>". For "transform", the replacements are done from the bottom up; for "untransform", the replacements are done top down. Therefore, more general concepts should be put at the top, while more specific concepts should be at the bottom.

Psychotherapy Edit

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

Future Work Edit

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 Edit

Some more experimental bots:

Text Transformers:

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.