This module is obsolete! Alpha was superceded by a more powerful language,
rewritten from scratch,
called RiveScript.
Chatbot::Alpha was allowed (and will be allowed) to remain here only because there are a few incompatibilities in the reply files.
If you haven't used Alpha yet,
I urge you to use RiveScript instead.
If you've already invested time in writing reply files for Alpha,
know that this module isn't going anywhere.
However,
this module is no longer actively maintained (and hasn't been in a number of years).

Chatbot::Alpha is a Perl module for reading and processing Alpha code.
Alpha code is a command-driven response language,
primarily used for chatterbots.

The language format is quite simple: it's a line-by-line language.
The first character is the command,
followed by the command's data.
The simplest of all Alpha replies is the standard one-way question and answer:

The + symbol is the basis of all your replies. It's the trigger--that is, what the user says to activate that reply. In most cases this command comes first in a reply, followed by supporting commands that tell the bot what to do next.

- (Minus)

The - command has many purposes. In the example above, a single +TRIGGER and a single -REPLY will give you a one-way question-answer case. If you use multiple -REPLY's under one +TRIGGER, then they will become random responses. On *CONDITION'S, the -REPLY's will be called when no condition returns true. On &HOLDERS, the -REPLY is the first thing the bot sends. And the list goes on... we'll get into the many uses for -REPLY later.

% (Percent)

The % command is for "that" emulation. If you've worked with AIML you'll know what that refers to. It's there to help take the A.D.D. syndrome out of your bots. You can make specific replies based on what the bot last said. Like if the bot asks "Do you have any pets?" and the user says "yes", the bot can ask "What kind of pets?" instead of a generic reply to "yes". You'll learn all about this in the tutorial later.

^ (Carat)

The ^ command is to continue from your last -REPLY. For example, if your reply is very long and you want to break it down a few lines in the reply file (as not to have a horizontal scrollbar and be hard to read), this is the command to use. The ^CONTINUE command will adds its data to the last -REPLY you used under the +TRIGGER.

@ (At)

The @ command is for a redirection. Alpha triggers are "dead-on", meaning "hello|hey" is literally "hello|hey", not "hello OR hey". So when you want one to point to the other, use the @REDIRECT command.

* (Star)

The * is for conditionals. You'll learn about these later as well.

& (Amperstand)

This is for simple conversation holders. Emphasis is on the word "simple." They don't always work, so you'd use %THAT if it was really important. The &HOLDER command is slowly becoming deprecated.

# (Pound)

The # command is for executing Perl codes within your reply set. Sometimes Alpha just can't handle the complex tasks you have in mind, and this can fill in all the blanks (assuming you're fluent with Perl anyway).

You'd find it quite tiresome if you had to copy/paste that "hello" trigger for all the possible forms of "hello", wouldn't you? Luckily there's an @ command for redirections. Here's the example I just mentioned:

The carat command ^ can be used to continue replies for the really long ones. Examples:

+ tell me about turing
- Alan Mathison Turing was born on 23 June 1912, the
^ second and last child (after his brother John) of
^ Julius Mathison and Ethel Sara Turning. The unusual
^ name of Turing placed him in a distinctive family tree
^ of English gentry, .....
+ tell me a poem
- Little Miss Muffet\n
^ sat on her tuffet\n
^ in a nonchalant sort of way.\n
^ With her forcefield around her,\n
^ the spider, the bounder,\n
^ is not in the picture today.

As I mentioned above, the &HOLDER command is buggy. You can use what we call "that", which is an emulation of AIML's <that> functionality. It's to give your bot a cure of its A.D.D.

The %THAT command must come directly after the +TRIGGER, before any other command. Here are some examples...

+ ask me a question
- Do you have any pets?
+ yes
% do you have any pets
- What are their names?
+ *
% what are their names
- Those are cool names.
////////////////////////
+ i am *
- Are you really?
+ yes
% are you really
- How long have you been?

The data of the %THAT command would be the bot's last response, lowercase and with no puncuation. This is a much better method of holding onto conversations than the &HOLDER command is.

If their next message doesn't have a "that" attached to it (i.e. if the bot asks if they have any pets and they don't say yes), it will get another reply as normal. However if they do say "yes", it will ask them what their names are, rather than give a generic reply to "yes".

DISCLAIMER: Executing Perl codes in your replies is potentially dangerous. I'd recommend you do more than a simple *CONDITION check to see if one can use any replies that execute Perl code. I cannot be held liable for any damages a malicious hacker might perform as a result of using the #CODE command.

The # command can be used to execute Perl within your replies. Sometimes Chatbot::Alpha just isn't powerful enough to do what you want, and this can fill in the gaps.