Kirsle.net logo Kirsle.net

Vanilla RiveScript

July 16, 2018 by Noah

I got this e-mail today about RiveScript and thought my response would be good for a general audience as well.

Orion asked:

Hello Noah i want to know...

  1. What is Vanilla Rivescript?
  2. What can Vanilla Rivescript do?
  3. How can i install or use Vanilla Rivescript?

Hi Orion

"Vanilla RiveScript" refers to the version of RiveScript I originally programmed myself (https://www.rivescript.com/). Some other developers have extended RiveScript and added features of their own on top, or forked it into an entirely different direction from where I wanted to take it.

Some that I know of:

  • Rundexter is a bot hosting service that uses RiveScript but they've extended the language with new commands and tags: https://rundexter.com/
  • Superscript.js is a complete fork of RiveScript that integrates natural language processing libraries (using WordNet and ConceptNet) and had support for a lot of async features that RiveScript.js was lacking (until v2.0.0): http://superscriptjs.com/

RiveScript is implemented in multiple programming languages and I try and maintain feature parity between them all: a RiveScript bot that runs in the JS version should also run in the Python version (object macro support notwithstanding). For example, RiveScript won't do what SuperScript did (including WordNet and ConceptNet) because these NLP libraries are not equally available in all of the programming languages RiveScript has been ported to; I wouldn't want the JS version to diverge from the others, and so, RiveScript generally has zero dependency on external modules in any programming language and the logic is more or less the same everywhere.

See the "RiveScript Goals and Scope" here for more info: https://www.rivescript.com/contributing

What can vanilla RiveScript do?

Here is the language specification for RiveScript that defines all the commands and tags it supports: RiveScript::WD

And a tutorial is here: RiveScript Tutorial

RiveScript was originally written as a Perl module and then I ported it to JavaScript, Java, Python and Go, using the Perl module (or another port) as a reference when creating a new one. This was a bit unfortunate for JavaScript at first, as JavaScript is a heavily asynchronous language whereas all of the others are synchronous by default, and this meant the JS version had certain limitations: Asynchronous Support and more backstory here: RiveScript's Original Niche

The 2.0.0 release of rivescript.js refactored the code to make everything async (with the JavaScript async/await feature), catching it up to its Python, Java and Go counterparts. Async/Await lets you write async code as though it were synchronous, allowing RiveScript's common logic from the other 4 ports to translate perfectly over to JS.

There's an online demo (JS in the browser) here: https://www.rivescript.com/try and a JSFiddle style app here: https://play.rivescript.com/ for testing and sharing code snippets with others.

How can I install or use Vanilla RiveScript?

RiveScript is a program library that can be used to design your own bots, but doesn't implement a full chatbot itself.

The RiveScript module implements the scripting language, letting you write your bot using RiveScript code and get a reply() from it... it's very much designed to be a "black box" library that's self-contained and easy to integrate into any existing program.

The JavaScript port can be used in Node.js as well as embedded into a web page. If you download RiveScript.js from the Releases page on GitHub, it includes a dist/rivescript.js file suitable to embed in a web page (and dist/rivescript.min.js for a minified version). v2.0.0 is still in alpha release mode but you can always get the webpacked script by embedding this: https://unpkg.com/rivescript@latest/dist/rivescript.min.js (or remove the .min if you want non-minified); the JS demo and Playground embed RiveScript via that URL so they stay at the latest version.

Here are links to various implementations of RiveScript in multiple programming languages: RiveScript Interpreters

The Go, Java, JavaScript, Perl and Python versions were written by me, so I was able to ensure they all have feature parity between them. The Java port nowadays I've handed over control to somebody who's more interested in Java than I am. :)

If you're more interested in just running a bot rather than create your own, there are some here: https://www.rivescript.com/bots

A lot of the RiveScript libraries also come with a handful of example scripts in their git repos, showing how to use the library in various ways to accomplish various goals. For example the JS version includes an Express.js API server, a Slack bot, and a web page that embeds RiveScript.js so users can chat with the bot in their own web browsers.

I hope this answered all your questions! :)

Regards,
-Noah

Tags:

Comments

There are 0 comments on this page. Add yours.

Add a Comment

Used for your Gravatar and optional thread subscription. Privacy policy.
You may format your message using GitHub Flavored Markdown syntax.