SlideShare a Scribd company logo
Languages to write a chatbot
AIML (1995)
ChatScript (2010) RiveScript (2009)
Hanoi, 6 - 2018
1
Contents
1
2
3
4
5
2
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
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
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
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
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
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
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
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
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
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
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
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
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
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

More Related Content

PDF
Diskusi 7 Hukum Pajak dan Acara Perpajakan Pemeriksaan SPT Pajak oleh Pemerin...
DOCX
Berita acara serah terima roll up banner keluarga sehat
PDF
PROGRAM SEMESTER bahasa jawa untuk semester ganjil dan genap.pdf
PPTX
AIML Introduction
PDF
Going native with html5 web components
PPTX
Chatbots.pptx
PDF
Twig for Drupal 8 and PHP | Presented at OC Drupal
PDF
Joomla tempates talk
Diskusi 7 Hukum Pajak dan Acara Perpajakan Pemeriksaan SPT Pajak oleh Pemerin...
Berita acara serah terima roll up banner keluarga sehat
PROGRAM SEMESTER bahasa jawa untuk semester ganjil dan genap.pdf
AIML Introduction
Going native with html5 web components
Chatbots.pptx
Twig for Drupal 8 and PHP | Presented at OC Drupal
Joomla tempates talk

Similar to Survey on Script-based languages to write a Chatbot (20)

PPT
What Is Hobo ?
PDF
HTML literals, the JSX of the platform
PDF
Drupal 8 - Core and API Changes
PPTX
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
ODP
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
PPTX
Untangling11
DOCX
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
PDF
IT230-Assignment 1 Solved.pdf
PDF
10 Ways To Improve Your Code
PPTX
Autotools, Design Patterns and more
PDF
Wireframing /Prototyping with HTML
PPTX
INTRODUCTIONS OF HTML
ODP
Introduce Django
PDF
IRJET - A Study on Building a Web based Chatbot from Scratch
PPTX
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
PDF
WordCamp US: Clean Code
PPTX
Code generation
PDF
ChatGPT and AI for web developers - Maximiliano Firtman
PDF
No code stewardship - No Code Conf 2019 Demo Theater
What Is Hobo ?
HTML literals, the JSX of the platform
Drupal 8 - Core and API Changes
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Untangling11
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
IT230-Assignment 1 Solved.pdf
10 Ways To Improve Your Code
Autotools, Design Patterns and more
Wireframing /Prototyping with HTML
INTRODUCTIONS OF HTML
Introduce Django
IRJET - A Study on Building a Web based Chatbot from Scratch
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
WordCamp US: Clean Code
Code generation
ChatGPT and AI for web developers - Maximiliano Firtman
No code stewardship - No Code Conf 2019 Demo Theater
Ad

More from Nguyen Giang (8)

PPTX
Introduction to Interpretable Machine Learning
PDF
Show observe and tell giang nguyen
PPTX
Introduction to continual learning
PPTX
Variational continual learning
PPTX
Scalability fs v2
PPTX
How Tala works in credit score
PPTX
Virtual assistant with amazon alexa
PPTX
ECG Detector deployed based on OPENMSP430 open-core
Introduction to Interpretable Machine Learning
Show observe and tell giang nguyen
Introduction to continual learning
Variational continual learning
Scalability fs v2
How Tala works in credit score
Virtual assistant with amazon alexa
ECG Detector deployed based on OPENMSP430 open-core
Ad

Recently uploaded (20)

PPTX
Practice Questions on recent development part 1.pptx
PDF
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
PPTX
Road Safety tips for School Kids by a k maurya.pptx
PDF
classification of cubic lattice structure
PDF
International Journal of Information Technology Convergence and Services (IJI...
PPTX
Ship’s Structural Components.pptx 7.7 Mb
PDF
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPT
Chapter 6 Design in software Engineeing.ppt
PDF
Queuing formulas to evaluate throughputs and servers
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
PPTX
Glazing at Facade, functions, types of glazing
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Geotechnical Engineering, Soil mechanics- Soil Testing.pdf
PDF
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
PPTX
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
PPTX
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
PPTX
AgentX UiPath Community Webinar series - Delhi
PDF
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Practice Questions on recent development part 1.pptx
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
Road Safety tips for School Kids by a k maurya.pptx
classification of cubic lattice structure
International Journal of Information Technology Convergence and Services (IJI...
Ship’s Structural Components.pptx 7.7 Mb
BRKDCN-2613.pdf Cisco AI DC NVIDIA presentation
Lesson 3_Tessellation.pptx finite Mathematics
Chapter 6 Design in software Engineeing.ppt
Queuing formulas to evaluate throughputs and servers
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
Glazing at Facade, functions, types of glazing
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Geotechnical Engineering, Soil mechanics- Soil Testing.pdf
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
Fluid Mechanics, Module 3: Basics of Fluid Mechanics
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
AgentX UiPath Community Webinar series - Delhi
B.Tech (Electrical Engineering ) 2024 syllabus.pdf
Strings in CPP - Strings in C++ are sequences of characters used to store and...

Survey on Script-based languages to write a Chatbot

  • 1. Languages to write a chatbot AIML (1995) ChatScript (2010) RiveScript (2009) Hanoi, 6 - 2018 1
  • 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

  • #4: <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.
  • #7: 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.
  • #8: 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.
  • #9: ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo: dictionary ontologies (wordnet like) interjections/etc.
  • #10: https://play.rivescript.com/ https://www.rivescript.com/try
  • #11: ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo: dictionary ontologies (wordnet like) interjections/etc.
  • #12: ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo: dictionary ontologies (wordnet like) interjections/etc.
  • #13: ChatScript (CS) integration with a foreign language (not English) is possible but it require work todo: dictionary ontologies (wordnet like) interjections/etc.
  • #14: 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.
  • #15: SuperScript: https://github.com/superscriptjs/superscript