AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Using RiveScript with PHP
 
 

Hi,
I’m really interested in RiveScript library, but I don’t know how to start using it, I want to make a php project based on RiveScript, can you give me an information about how to start using this library ?
Thank you do much.

 

 
  [ # 1 ]

Greetings, Saad, and welcome to chatbots.org. smile

I was wondering, have you checked out https://www.rivescript.com/ yet? There’s a lot of good information there on how to use RiveScript, including a tutorial. That might be the best place to start.

 

 
  [ # 2 ]

Here’s a third-party PHP implementation of RiveScript that I know about: https://github.com/vulcan-project/rivescript-php but it doesn’t seem very complete.

As an alternative, you can have the PHP script use one of the other RiveScript implementations in other programming languages. There are two general approaches to get PHP to communicate with another programming language: via shell commands or a network.

The Python version includes a command-line client where you can communicate using JSON over standard input/output. i.e., PHP would open a process pipe to `python -m rivescript /path/to/brain`, write a JSON message into its standard input, and read a JSON response from RiveScript’s standard output.

The JavaScript version includes a handful of bot example scripts in its `eg` folder for running RiveScript as various kinds of web services:

* Telnet Server is very similar to the Python CLI client, except it listens on a network socket; a PHP front-end would connect to the socket instead of opening a process pipe but it otherwise would work the same way.
* JSON Server runs a RiveScript bot as a RESTful web API that speaks JSON. PHP could access the bot using standard HTTP request libraries—or you could just have your HTML front-end make ajax requests directly to the RiveScript server and not even need PHP to get involved.

And as a simple option, the JavaScript version of RiveScript can also run directly from the end user’s web browser, without any server-side work needed. The source *.rive files can be loaded via ajax requests. The down side is that anybody could download your .rive sources, and, while you can write object macros in JavaScript to do cool things with the bot, those things are limited by standard web browser security features (can’t do anything that JavaScript can’t normally do in a web browser; but you could post ajax requests to PHP scripts at least).

 

 
  [ # 3 ]
Saad Maxell - Mar 3, 2018:

Hi,
I’m really interested in RiveScript library, but I don’t know how to start using it, I want to make a php project based on RiveScript, can you give me an information about how to start using this library ?
Thank you do much.

As far as I know, before building dialogs, the program needs a database, which will contain information about objects and entities that can be discussed in the dialogue.
I understand correctly that this data needs to be written into the concept dictionary contained in the ChatScript system files? Concepts are written to a file using the ~ character, followed by the name of the concept and the set of words included in it, enclosed in square brackets.

 

 
  [ # 4 ]

Hi Butterfield David,

You have posted about ChatScript in a RiveScript thread. Perhaps a slight misspeak?...miss-post? wink

 

 
  login or register to react