This document compares three languages that can be used to write chatbots: AIML, RiveScript, and ChatScript. It outlines some flaws with AIML, including that it requires many redundant categories and does not support things like synonyms or wildcards. RiveScript addresses many of AIML's limitations and also supports features like weighted responses. ChatScript is more powerful than RiveScript but also more complex, acting as its own standalone chatbot engine with a unique scripting language. For a smaller chatbot without needing advanced NLP, AIML or RiveScript may be easier to deploy than ChatScript.
3. 1. AIML
• AIML is rule-based, matching a sequence of words to generate either a
completely canned response or a response involving substitution of input
words into an output template.
• A chatbot like A.L.I.C.E. is an expert system. A.L.I.C.E. data is defined using
AIML, an expert system can perform interesting to significant tasks when it
has a limited domain and 30,000 to 50,000 rules for a brain.
• We can teach aiml bot by using learn/learnf tags.
3
4. 1. AIML
• #1 Flaw of AIML
▫ The biggest flaw of AIML is that it is simply too wordy and requires huge numbers
of effectively redundant categories.
▫ Since the pattern matching of AIML is so primitive and generic, it takes a lot of
category information to perform a single general task. If you want the system to
respond to a keyword, either alone or as a prefix, infix, or suffix in a sentence, it
takes you four categories to do so, one for each condition (with three of them
remapping using SRAI to the fourth ).
<category>
<pattern>MOTHER</pattern>
<template> Tell me more about your family. </template>
</category>
<category>
<pattern>* MOTHER</pattern>
<template><srai>MOTHER</srai> </template>
</category>
<category>
<pattern>MOTHER *</pattern>
<template><srai>MOTHER</srai> </template>
</category>
<category>
<pattern>* MOTHER *</pattern>
<template><srai>MOTHER</srai> </template>
</category>
4
5. 1. AIML
• #2 Flaw of AIML
▫ Similarly, the pattern uses an exact word. It would be nice if you could match a list
of synonyms in a single specification.
<category><pattern>I AM JACK</pattern><template><srai>call me
jack</srai></template></category>
<category><pattern>I AM JAKE</pattern><template><srai>call me
jake</srai></template></category>
<category><pattern>I AM JAMES</pattern><template><srai>call me
james</srai></template></category>
<category><pattern>I AM JANE</pattern><template><srai>call me
jane</srai></template></category>
I would much rather write a synonym set for a list of names and write
this as a single pattern
5
6. 1. AIML
• #3 Flaw of AIML
▫ Because you can't use wildcard sets of words, you cannot easily handle generic
set-based sentences. Google, for example, has no problem taking in what is two
hundred plus twelve thousand and 2 and then spitting out the correct answer
<category> <pattern>* PLUS *</pattern> <template><think><set name="x"> <star/></set> <set
name="y"><person><star index="2"/></person></set></think> The answer is
<script language="JavaScript"> var result = <get name="x"/> + <get name="y"/>;
document.write("<br/>result = " + result, "<br/>");</script> </template> </category>
That is, the AIML reference guide says: As soon as the first complete
match is found, the process stops, and the template that belongs to
the category whose pattern was matched is processed by the AIML
interpreter to construct the output. It seems to say nothing about what
happens if the result of the execution of the template is nada. So
seems to me, you really want to have a more reliable match BEFORE
you commit to the template.
6
7. 1. AIML
• #4 Flaw of AIML
▫ AIML creates a system with the potential for many rules that overlap and mask
each other.
▫ <srai> are hard to connect visually to the categories they are remapping to,
making it impossible to see or guess what will happen.
<pattern> DO YOU WANT * </pattern> < template> No, I do not want * </template>
<pattern>DO YOU WANT MOVIES </pattern> < template> <srai> Want Movies </srai></template>
7
8. 2. Rivescript
• Here are all of the things RiveScript has which AIML simply does
not at all:
▫ ! Definition command; Alice bots need a handful of configuration files,
separate from the actual AIML files, to define things such as the bot's
name and other variables. These features are built right in to RiveScript
itself.
▫ Weighted random responses.
▫ Object macros.
▫ Topics can inherit other topics.
▫ Tags that AIML doesn't have:
add
sub
mult
div
env
{!}
8
9. 2. Rivescript
! version = 2.0
+ hello bot
- Hello human.
+ my name is *
- <set name=<formal>>Nice to meet you, <get name>.
+ (what is my name|who am i)
- You're <get name>, right?
+ *
- I don't have a reply for that.
- Try asking that a different way.
9
10. 2. Rivescript
• Intepreter
▫ https://www.rivescript.com/interpreters
• For java
▫ https://github.com/aichaos/rivescript-java
• AiChaos
▫ https://github.com/aichaos
• Training
▫ No script generator
• A collection of known projects that are built on top of RiveScript
▫ https://www.kirsle.net/wiki/Built-with-RiveScript
10
11. 3. Chatscipt
• ChatScript is a stand-alone chatbot engine, complete with its own
unique scripting language, created by bruce wilcox, who also created
the 2010 loebner prize winning chatbot, suzette. this is one of very
few stand-alone chatbot apps that have none of the “disadvantages”
I listed earlier for stand-alone bot apps. However, ChatScript has its
own set of “disadvantages”.
• Tutorial:
▫ https://www.chatbots.org/ai_zone/viewthread/492/
• Tutorial:
▫ Full necessary documents available in PDFDOCUMENTATION
• Editor
▫ https://github.com/bwilcox-
1234/ChatScript/blob/master/Third%20Party%20Tools/README.md
11
12. 3. Chatscipt
• You can define your bot’s dialog flows with a script stored as a
normal text file. This is much simpler than methods that other
chatbot tools use, which often involve browser-based user
interfaces, JSON, or XML.
• Writing your scripts as a text files gives you full control over your
dialog flows. You a can easily process and upgrade your
conversational code with back-end scripts and tools.
• You could even use machine learning tools to mine conversations
logs. This could reveal all kinds of opportunities for you to improve
your dialog flows.
12
13. 3. Chatscipt
• Creating a new chatbot by modifying source code
▫ https://www.youtube.com/watch?v=H9H4NfMepe4
• Download Chatscript platform here
▫ https://sourceforge.net/projects/chatscript/
#include <fstream>
#include <iostream>
#include <string>
#include <chatScript.h> //for example!
using namespace std;
int main()
{
ofstream output;
string str1, str2;
getline(cin, str1);
//This is the ChatScript function that i am looking for!
str2= ChatScript_input(str1);
output.open("output.txt");
output<< "str2";
output.close();
return 0;
}
13
14. RiveScript vs ChatScript
• ChatScript is a more sophisticated scripting language capable of
more Turing-complete-like functionality, whereas RiveScript is a
parsed, line-delimited language.
• ChatScript can combine all of its various rules in complicated ways
that RiveScript can't compete with.
• A converter program could be written to translate RiveScript into
ChatScript, but not the other way around.
• ChatScript is capable of complicated replies that can't be
represented equally in RiveScript.
14
15. 1. RiveScript vs ChatScript
• Right now (so far as I know, at least), the only ChatScript engine
(the software necessary to interpret ChatScript files) is a
Linux/Windows stand-alone application, written in C (I forget
which “flavor”). the chatScript engine can be run as a server (in fact,
that’s the default action in Linux), so just about any scripting
language can access it. I’ve toyed with the notion of creating a
ChatScript interpreter/engine in PHP, but frankly, my time is too
limited to do so. I also think that attempting to do something like
this should only be done with Bruce’s blessing/approval.
• That said, however, there’s nothing stopping anyone from writing an
interface in Python that pre-processes the input using tools like the
NLTK before accessing a ChatScript server and retrieving the
results, and then presenting the output to the user. In fact, I think
that may be something to pursue, if you’re of a mind to do so.
15
16. Conclusion
• Deploying a chatbot with fully customizable by AIML or Rivescript
seems to be easier than Chatscript
• If we decide to apply NLP later, I think we should you AIML for ease
(because I think TIMA system is small enough)
• If we can use Chatscript, we even can ignore NLP and go through
by CS.
16
Editor's Notes
<pattern>_ A COUPLE OF WORDS *</pattern> and <pattern>_ A COUPLE OF WORDS</pattern> is the proper way to use _ if you want to catch every times A COUPLE OF WORDS is inside or at the end of a sentence.
The problem is AIML stop asap it meets the first match. Then if the calculation is: 100 plus 200 and two => make wrong output while google can do it exactly.
The problem is AIML stop asap it meets the first match. Then if the calculation is: 100 plus 200 and two => make wrong output while google can do it exactly.
ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo:
dictionary
ontologies (wordnet like)
interjections/etc.
ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo:
dictionary
ontologies (wordnet like)
interjections/etc.
ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo:
dictionary
ontologies (wordnet like)
interjections/etc.
ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo:
dictionary
ontologies (wordnet like)
interjections/etc.
CS is chatbot engine. It is rule-based, and it might resemble a declarative programming approach similar to writing a configuration file or grammar for an interpreter. Yet, CS is more imperative since you should also use commands to tell how to react to this or that message. It is written in C++ and has binary builds for Windows, Linux, and MacOS platforms.