Giter VIP home page Giter VIP logo

rivescript-java's Introduction

Java RiveScript Interpreter

This is a Java implementation of a RiveScript interpreter, per the Working Draft at http://www.rivescript.com/wd/RiveScript.html

This is BETA QUALITY SOFTWARE and hasn't been field tested as much as some of the other RiveScript libraries in other languages.

It is feature complete syntax-wise: it supports all of the RiveScript directives and tags, but it doesn't natively support any dynamic language for object macros. You can define object macros in Java at compile-time, and there's an example that bridges Perl code; long-term plans include building in native support for JavaScript.

This repository is a little bit light on examples; most of the examples for how to do things are found in the source of RSBot.java and the RiveScript files in the Aiden/ directory. These demonstrate things like Java object macros, using the Perl macro bridge, etc.

If you find a way to crash this library, please tell me how you did it so I can improve this library!

Contributions are welcome. See CONTRIBUTING.md for more information.

Documentation

Documentation is available at https://www.rivescript.com/docs/java/

RSBot Demo Script

The RSBot.java is a simple implementation of a Java RiveScript bot. You can use it to quickly chat with the Eliza-based bot in the Aiden/ folder.

These commands may be used at your input prompt in RSBot:

/quit        - Quit the program
/dump topics - Dump the internal topic/trigger/reply struct (debugging)
/dump sorted - Dump the internal trigger sort buffers (debugging)
/last        - Print the last trigger you matched.

Makefile

I use a GNU Makefile to simplify builds and other commands (feel free to send a pull request to switch to Ant or something). Useful commands:

  • make build: compiles RSBot.java and, therefore, RiveScript.
  • make run: compiles RSBot.java and immediately runs it.
  • make test: run unit tests with JUnit.
  • make clean: cleans up .class files.
  • make javadoc: deletes the doc/ folder and recreates it with the javadoc command, for generating library documentation.

QUICK START

Compile RSBot.java using make build. If you're running on Windows and don't have a Make program installed, you can compile the bot with the javac command directly:

Unix:   $ make build
Win32:  > javac RSBot.java

Then execute RSBot to begin chatting with the demo Eliza-based bot that tends to ship with RiveScript libraries.

Unix:   $ java RSBot
Win32:  > java RSBot

Unit Testing

This library is tested using JUnit. To run the test suite, make sure that JUnit is available on your $CLASSPATH, for example by adding the jar file:

export CLASSPATH="$CLASSPATH:/path/to/junit-4.10.jar"

And then type make test to run the unit tests.

License

The MIT License (MIT)

Copyright (c) 2016 Noah Petherbridge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

AUTHOR

Noah Petherbridge, https://www.kirsle.net/

rivescript-java's People

Contributors

diogoneves avatar kirsle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.