Chatbot

From Blue Mars Developer Guidebook

Jump to: navigation, search

The CHAT-L language definition contained herein is hereby made openly available for all academic, private, and commercial use. You may create and deploy runtime systems that support this language specification.

Send questions or comments on the chatbot documentation to gowilcox@gmail.com.

A sand-box test version of a CHAT-L runtime system executable is available at http://avatar.vo.llnwd.net/o37/tools/chatbot/chat-l.zip. This executable is copyright 2009-2010 Avatar Reality (latest revision Jan31 2010) and MAY NOT be used for commercial purposes, but is available for all academic and private use. It runs under Windows as a stand-alone client and provides a series of script data files suitable for writing your own chatbot scripts and practicing your CHAT-L.

The accompanying data files comprise script and facts and data found on the internet and can be used in any way you choose without restriction. The data does not include Suzette personality data, but does have illustrations of interesting scripts.

If you write a sufficiently interesting bot or topic, maybe you can get it included in Blue Mars or the Suzette chatbot. All questions on this runtime system should be addressed to gowilcox@gmail.com .


Contents

Purposes of a chatbot

Need a virtual store clerk? A bartender? How about NPC city inhabitants? Or a tour guide for your city? Or your personal replicant for when you are off-line?

Actually chatbots have many potential uses.

  1. entertainment - engage in entertaining conversation with a user
  2. assistance – provide useful information to a user
  3. education – teach material to a user
  4. propoganda – deliver advertising to a user
  5. sales – virtual sales assistant to a user

Nowadays you can find chatbots engaging in sales and assistance on many corporate websites, including Paypal, Ikea, Ford, Lloyds TSB, Alaska Airlines, British Telecom, Royal Bank of Scotland, Renault, Citroen, and One Railway. Even some cities have them, like the City of San Carlos. To see a sample extended conversation between Suzette and a human, see Transcript.

Blue Mars has the most advanced chatbot technology to create chatbots. It can parse user input and/or perform keyword matching against it. This input is matched against relevant topic scripts to decide how to respond. The response can intermix text speech output with control over the avatar body's actions.

The chatbot not only carries on a current conversation with you, but it stores information about you across chats, so it can sustain a relationship lasting from first encounter through to the current interaction. This same ability allows the chatbot to act as your replacement when you are off-line.


Topics Overview

A topic in human conversation is a specialized area of knowledge. A topic can be anything. The purpose of a topic is to provide information and continuity on a subject.

A topic for the chatbot is a script written in CHAT-L that lets the chatbot react to questions or statements in a subject area, as well as allowing it to volunteer information on its own. Topics are independent and allow you to organize your information and responses in whatever way seems natural and convenient to you. The script of a topic can be created using a simple text editor.

The Blue Mars Suzette chatbot comes with several hundred topics, which you can keep, augment, or replace.


Most topics are intended as conversation. They provide a mix of questions to pose to the user, volunteered opinions, answers for user questions, reactions to user statements, and bits of relevant humor.

Some topics accomplish other specialized tasks and are not intended as conversation. The calculate topic answers math questions. The geography topic answers questions in geography including route-finding. The psychology test topic gives you a multiple choice quiz to determine your degree of extroversion/introversion. The trash talk topic will engage in trash talking with you while the mock combat topic is ready to play a verbal combat game. The I Ching topic will tell you your fortune and the Dream topic will analyze your dream.

You could create a programmed learning topic to teach a subject if you want to.

Then there are system topics. These help manage conversation and topic flow, provide stalling and quibbling behavior for unrecognized input, and add emotional overlays into the conversation. For example Suzette can get bored with a topic if you don’t evince interest in it yourself; she can become hostile or paranoid if you are nasty to her; and she can become more animated and voluable when you are on a roll.


Topics naturally vary in script size. Common topics like book and film currently occupy about 10,000 bytes each (about 130 independent script lines each), while a minimal topic like apple is only 100 bytes. Much of the byte count comes simply from what you want to say. The apple topic, for example, is only prepared to volunteer 32 bytes of I like braeburn apples the most. Or answer with that if the user asks about the chatbot's favorite kind of apple. This topic can be considered a stub topic for future expansion.


Topics also vary in script complexity. Most consist only of simple rules that give what to say in response to various user inputs (like the apple topic). Others consist of simple rules interspersed with some database queries – the book topic has a lot of personal opinions and questions to ask, but will look up the author or copyright date of a book or tell you books an author has written. Still others are complex scripts – the ourstore topic has items for sale and you can ask about them, put them in your shopping cart or put them back on the shelves, and go thru a pretend checkout with them, paying by cash, credit or debit card. The geography topic will answer questions about how to get from one place to another, whether the place is from within the same state all the way to traveling to a different galaxy.


Topics have characteristics you can assign that control its behavior, including openness and erasability.

Most topics are completely open. When the system has control of the conversation and is looking for something new to discuss, it can randomly pick one of these topics and start volunteering chat from it. Some topics have restricted entry. The various hobby and work topics like accountant job and coin collecting will only be initiated if the user says they are an accountant or collect coins. These topics are only interesting if the user is an expert in these fields.

A topic will normally erase itself as it gets used, so that once some information has been given to you it will not repeat itself in the future. Once you know what my employment is, you don't want me volunteering that again and you won't ask it again. But other topics need to be able to always repeat themselves. This includes the help topic and some specialty topics like geography, calculate, and dream analysis.


You can follow this link to see actual CHAT-L code on the religion topic and a resulting conversational fragment when a human chatted with the bot. You are not expected to understand the code, but how it played it is roughly explained and should show you that the code is not that hard to understand.

Control Script Overview

Topics provide the backbone of information and story in a conversation. But a chatbot is more than that.

The control script of a chatbot determines how it accesses and makes use of the topic data. It enables the chatbot to weave multiple topics together to create a rich multi-sentence response with emotion, transitional phrasing, and actual content. The control script determines how focussed a chatbot is, how often it makes wisecracks, and how it expresses personality and emotion.

Imagine, if you will, a database of subject topics. Fruit, religion, tv, etc are all topics in this database. When the user says “I like apples.” what happens depends on the control script. The chatbot might leap to the fruit topic. Or it might ignore the new area and continue in the old topic. Or it might decide to launch a different topic.

Furthermore, the system can run more than one topic at a time. The main conversational topic can be apples. At the same time, the system may have a topic for simulating a specific personality or emotion or bodily state. Consider a topic that simulates hating the user. Or being paranoid. Or one that simulates feeling sick. They could be run in conjunction with the main conversational topic.

For example, the user says:

  • you're a retarded bot.

An emotion topic could generate a reaction, while the main topic system initiates a new topic. So the chatbot responds:

  • That's just rude. The pot calling the kettle black. Speaking of colorful, I had a half-body rash once.


The control script is just data and the chatbot can change it on the fly. So the chatbot's personality can evolve.

Additional Technologies

In addition to having a parser and topic scripts you can write, the chatbot is integrated with several other technologies.


WordNet- Wordnet is a dictionary of several hundred thousand words that are organized into a world ontology. So the system has access to knowing the membership hierarchy of things. E.g., it knows the list of all possible animals and that collies are dogs are animals are beings. One can write a chat rule that says, for example that if the user mentions any animal at all, it should respond with a statement that it likes that specific animal. The Wordnet dictionary also has definitional text, so if you ask the chatbot what is the meaning of syzygy, it will give you the definition.


Facts- Most chatbots function as pattern matchers that take the input, find the relevant rule, and output the precanned response. Our chatbot is also tied to a knowledge base representation, so we can input fact knowledge and it can perform inference to find it. Think of the knowledge base as a specialized kind of SQL database of information. The chatbot can access fields and perform searches across various records and tables. Accessing SQL would be a good thing for a chatbot, but the fact system has many advantanges over SQL.

To use facts, you have to write script that maps a user’s question into the appropriate knowledge base calls, and you have to design and populate your own knowledge base.

We, for example, have put in various facts from the CIA factbook about nations, including their gdp, population, and area. And have written script for the geography topic so that if you ask what is the population of chile you get an answer it looks up. And if you ask what are the five largest nations, it will get you that list. Or if you ask what is the fifth largest nation it will get you that. Being able to store and retrieve facts makes it easy to write a small number of rules that cover a large amount of data. This is much better than having to write a separate rule for piece of data.

As a different example, we have stored the facts defining a graph of the rough road network of Oahu, Hawaii. The chatbot has a script function that can walk a graph, so we have written script that can tell you how to drive from Pearl Harbor to Waimea Bay,or any travel between any other of major landmarks on Oahu. It’s not a lot of script.


SQL- The chatbot is also tied to an sql database so that it can record and retrieve user answers to questions if we want them. This is not currently a full sql query capabilility, but rather a pre-canned ability to store a sentence by user and keyword and retrieve it again from script.


Learning CHAT-L

This links to the main documentation on CHAT-L, the scripting language used to program chatbots in.


Customizing A Chatbot

This links to how to go about creating your own chatbots on your own server.


Accessing A Chatbot

Aside from accessing avatars from inside of Blue Mars, there are some simple webpages for direct chat. These include: http://66.192.217.122/chat/ which is the internal server (same as blue mars access). and http://66.150.245.139/chat/ which is the publicly visible external access to a different server. They run the same code roughly, with the external server usually up to a day more recent.

Problems with this wiki page? Contact us either by: Support Email or Support Ticket System

Blue Mars Guidebook Privacy Policy
Blue Mars Guidebook Community Guidelines

Personal tools