Artificial Intelligence Scripting Language

Kirsle's Web Blog

[ Older > ]
MIT License

Posted by Kirsle on Tuesday, Nov 25 2014 @ 12:23 PM
Starting today, all four of my first-party RiveScript libraries are now released under the MIT License instead of the GNU General Public License.

What that basically means is that you can use these libraries in your own software without needing to release your entire program as open source under the GPL. This should make RiveScript more usable for more people. The only requirement is that the original copyright notice and a copy of the MIT License is provided with any derivative works of the software.

The following are the version numbers at which each library was switched from the GPL over to MIT (earlier versions of these libraries are still under the GPL so you'll need to use the versions below or any later version to be using the MIT licensed code):

Language Version Release Date
Perl v1.36 Nov 26 2014
Python v1.06 Nov 25 2014
JavaScript v1.0.4 Nov 25 2014
Java v0.03 Nov 26 2014

Categories: General

[ 0 comments | Add comment | Permalink ]

Compile RiveScript to Binary

Posted by Kirsle on Thursday, Sep 18 2014 @ 9:15 PM
I'm working on an experimental new feature for the Python version of RiveScript: compiling your source files to binary for better performance!

It uses Google's Protocol Buffers under the hood. When the Python RiveScript module is loading your RS source files from disk, instead of loading it directly into memory it will build up a Protocol Buffer and save it to disk at the end as a .rivec file. These work just like Python's .pyc files do: in the future when your bot loads your RiveScript replies on disk, it will load them directly from the compiled binary .rivec file instead of parsing your code again. But, if you make a change to your source file, RiveScript will re-compile it.

This brings the benefit of having your replies able to be loaded from disk much more quickly. The binary format is very close to the internal format RiveScript uses when it loads the replies into memory, so it's a very straightforward process for it to load the binary version.

I did some benchmarks to compare the speed difference. I loaded the A.L.I.C.E. reply set (AliceRS-0.03.tar.gz from here).

On the old version of Python RiveScript, it took about 40 seconds to load A.L.I.C.E.'s replies from disk. With the new version, on the first load it takes longer (~78 seconds) because it's busy compiling them down to binary, but on subsequent loads it only takes 25 seconds!

If you were working on a bot the size of A.L.I.C.E., the increased loading speed would be really helpful. And as you're actively developing your source files, RiveScript would only need to re-compile the files you changed, instead of having to rebuild ALL the files.

Another nice side benefit is that it made the whole parsing code a bit simpler for me. Since it's not directly loading your plain text RiveScript documents into memory, there's less need for juggling around temporary variables (i.e. dealing with the %Previous stuff), instead the parsing code just focuses on turning your plain text into a structured binary format that accurately represents the original text. Once that's all organized, it's then pretty straightforward (and simpler) to get it into memory for the bot to actually use it for chatting with people!

If you wanna play around with it, it's on the protobuf branch on the GitHub repo. If you prefer a simple .zip file download, you can get that here.

Categories: Python

[ 0 comments | Add comment | Permalink ]

Chatbots 3.3

Posted by Kirsle on Saturday, Mar 23 2013 @ 11:06 AM
I just did my presentation about using RiveScript in web applications at the Chatbots 3.3 Conference in Philadelphia.

The video of it was recorded at aimlinstructor on, and a PDF copy of my presentation is available here: Chatbots-3.3.pdf.

Categories: General

[ 0 comments | Add comment | Permalink ]

Chatbot Hosting Service

Posted by Kirsle on Tuesday, Aug 14 2012 @ 6:06 PM
I'm working on a chatbot hosting service for RiveScript bots. This will enable you to get your own chatbot up and running without needing any programming experience. There will be a beta of this service up and running here in the near future.

Some early FAQ's about it:

Q: Will it be free?
A: Absolutely! Chatbots are a pretty difficult thing to monetize anyway, and I think the majority of my users will be running relatively "small" chatbots that won't put too much stress on my server anyway. However, I may introduce fees for hosting very large bots (ones with tens of thousands of custom responses) since these will require more resources to run on my server.

Q: Can I have an Alice clone?
A: Kind of. You will have a choice of a "Base Brain" to use for your bot. Alice will be one of the options for the base brain.

Q: How do Base Brains work?
A: You'll be able to create custom responses for your bot, for example you can say, "when the user says hello, the bot should say Hi there!". Whenever a user says something to your bot that matches one of your custom replies, they will get the reply you created. But, if they say something that doesn't match any of your custom replies, the Base Brain will be the one that provides them with a response instead. So, if you use Alice as your base brain, Alice will be the "fall back" source of responses for your bot.

Q: What are the options for Base Brains?
A: The options are going to be Alice (Dr. Wallace's Alice, who has about 90,000 responses), and Eliza (the classic therapist bot by Joseph Weizenbaum). However, you can elect to not use a base brain at all, in which case your bot's custom responses will be the only source of replies.

Q: How many custom replies can I have?
A: To start out with, there will be a limit of several thousand custom replies. This, I think, is more than enough for the majority of users. Alice has about 90,000 custom replies, and it takes a RiveScript interpreter several seconds to load that many responses from disk. If everybody who runs a RiveScript bot were to upload their own individual copies of Alice, this would put the server under a lot of stress for each message the bots receive. The limit will probably be about 10,000 custom responses.

Q: How is the Alice base brain going to work then?
A: The Alice base brain will run as a background service on the server. This way she only needs to be loaded from disk once and will be able to serve as the backup reply source for many bots simultaneously.

Q: Will there be a way to host bots as large as Alice?
A: We'll cross that bridge when we get to it. One idea I have will be to run large custom bots as background services like the Alice base brain.

Q: Will my bots be able to sign on to AIM, MSN, or Yahoo?
A: The bot hosting service, at least to begin with, will only host web-based bots (ones where you chat with them via a web browser). However, there will be an API (Application Programming Interface) for third party developers to be able to hook their apps into the hosting service. So, somebody could write an AIM bot for example that uses the RiveScript hosting service to get responses for users over instant messenger.

Q: What will the limitations be?
A: There will be a limitation on the number of custom responses you can have (somewhere around 10,000) due to server load issues. You also won't be allowed to use your own custom Perl or JavaScript object macros in your RiveScript code (because it would be dangerous to run custom code on the web server). However, there will be a handful of pre-defined objects available to use in your code.

I think that should cover it for now. Stay tuned!

RiveScript? In my web browser?

Posted by Kirsle on Tuesday, Aug 07 2012 @ 6:35 PM
Introducing... RiveScript.js!

This is a RiveScript interpreter written in JavaScript! It can run in your web browser (using ajax to load documents) and it can run in node.js!

There is a demo available right here. That will let you chat with the standard RiveScript brain that tends to ship with all the libraries.

If you're feeling more adventurous, I also have a demo where you can chat with Dr. Wallace's A.L.I.C.E.! Be warned though, Alice is a large A.I. and you'll be running her entirely in your web browser. On my system though she runs just fine, and can respond instantly -- even faster than the Perl and Python RiveScript libraries!

If you'd like to use RiveScript.js, you can check it out on GitHub. There are direct links to the JS files on the RiveScript Interpreters page.

What's so great about RiveScript.js? With this, you can easily add a chatbot to your website, and it doesn't even require any fancy server-side setting up! Unlike the Perl, Python and Java versions of RiveScript, this one will run in your end user's web browser. All your server needs to do is host your RiveScript source files!

The JavaScript library comes with support for using JavaScript to write objects for your RiveScript code. So far, this library has the best JavaScript support out of all of them. ;)

Disclaimer: this library is very recent. While it seems to work and it passes the whole test suite, there may be--and probably are--some bugs. If you find any, let me know so I can fix them!

[ Older > ]