Skip to content

superscriptjs/superscript

Repository files navigation

Build Status Dependencies Status Slack Chat Code Climate

SuperScript

SuperScript is a dialog system and bot engine for creating human-like conversation chat bots. It exposes an expressive script for crafting dialogue and features text-expansion using WordNet and information retrieval using a fact system built on a Level interface.

Note: This version (v1.x) is designed to work with and tested against the latest Node 6.x and above.

Why SuperScript?

SuperScript's power comes in its topics and conversations, which mimic typical human conversations. If you're looking to create complex conversations with branching dialogue, or recreate the natural flow of talking about different topics, SuperScript is for you!

What comes in the box

  • Dialog engine.
  • Multi-user platform for easy integration with group chat systems like Slack.
  • Message pipeline with NLP tech such as POS tagging, sentence analysis and question tagging.
  • Extensible plugin architecture to call your own APIs or do your own NLP if you want to!
  • A built in graph database using LevelDB. Each user has their own sub-level, allowing you to define complex relationships between entities.
  • WordNet, a database for word and concept expansion.

Install

npm install superscript

Getting Started

bot-init

If you've installed superscript globally (npm install -g superscript), a good way to get your new bot up and running is by running the bot-init script:

bot-init myBotName --clients telnet,slack

This will create a bot in a new 'myBotName' folder in your current directory. You can specify the clients you want with the --clients flag.

Then all you need to do is run:

cd myBotName
npm install
parse
npm run build
npm run start-[clientName]

This will start the server. You then need to connect to a client to be able to talk to your bot! If you're using the telnet client, you'll need to open up a new Terminal tab, and run telnet localhost 2000.

Note: The parse step is a bin script that will compile your SuperScript script. By default, it will look at the chat folder in your current directory.

Clone a template

Alternatively, check out the hello-superscript repo for a clean starting point to building your own bot. There's no guarantee at present that this is using the latest version of SuperScript.

Using Heroku's one-click deploy

Thanks to @bmann we now have a one-click deploy to Heroku! More info can be found over at superscript-heroku.

Express Client

Deploy

Slack Client

The slack-client branch creates a superscript powered bot that sits in your Slack. You'll need to create a bot and give it a name in the Slack apps directory in order to get a token that lets your bot connect to your Slack.

Deploy

Creating the bot in the Slack directory means you'll see the bot appear in your Slack as offline. When your server from above is running correctly, the status of the bot will go green, and you can say "Hi" to it and it will respond.

Upgrading to v1.x

Information on upgrading to v1.x can be found on the wiki.

Documentation

Visit superscriptjs.com for all the details on how to get started playing with SuperScript. Or read the wiki

Example Script - Script Authoring

+ hello human
- Hello Bot

+ matches all input types

- Is the reply sent back to the user.

Optional and Alternates - Script Authoring

+ [hey] hello (nice|mean) human
- Hello Bot

[] are for optional words, they may or may not appear in the input match

() are alternate words. One MUST appear.

Capturing results - Script Authoring (wildcards)

+ * should *~2 work *1
- I have no idea.

* Matches ZERO or more words or tokens

*~n Matches ZERO to N words or tokens

*n Matches exactly N number of words or tokens

And More

The above is just a tiny fraction of what the system is capable of doing. Please see the full documentation to learn more.

Additional Resources

Further Reading

Further Watching

Thanks

SuperScript is based off of a fork of RiveScript with idiom brought in from ChatScript. Without the work of Noah Petherbridge and Bruce Wilcox, this project would not be possible.

License

The MIT License (MIT)

Copyright © 2014-2017 Rob Ellis