1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
|
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>rivescript - A command line frontend to the Perl RiveScript interpreter.</title>
<link rel="stylesheet" href="rivescript.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#options">OPTIONS</a></li>
<li><a href="#usage">USAGE</a></li>
<ul>
<li><a href="#interactive_mode">Interactive Mode</a></li>
<li><a href="#json_mode">JSON Mode</a></li>
<ul>
<li><a href="#end_of_message">End of Message</a></li>
</ul>
</ul>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#author">AUTHOR</a></li>
<li><a href="#license">LICENSE</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>rivescript - A command line frontend to the Perl RiveScript interpreter.</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
$ rivescript [options] [path to RiveScript documents]</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This is a command line front-end to the RiveScript interpreter. This script
obsoletes the old <code>rsdemo</code>, and can also be used non-interactively by third
party programs. To that end, it supports a variety of input/output and session
handling methods.</p>
<p>If no RiveScript document path is given, it will default to the example brain
that ships with the RiveScript module, which is based on the Eliza bot.</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<dl>
<dt><strong><a name="debug_d" class="item">--debug, -d</a></strong></dt>
<dd>
<p>Enables debug mode. This will print all debug data from RiveScript to your
terminal. If you'd like it to log to a file instead, use the <code>--log</code> option
instead of <code>--debug</code>.</p>
</dd>
<dt><strong><a name="log_file" class="item">--log FILE</a></strong></dt>
<dd>
<p>Enables debug mode and prints the debug output to <code>FILE</code> instead of to your
terminal.</p>
</dd>
<dt><strong><a name="json_j" class="item">--json, -j</a></strong></dt>
<dd>
<p>Runs <code>rivescript</code> in JSON mode, for running the script in a non-interactive
way (for example, to use RiveScript in a programming language that doesn't have
a native RiveScript library). See <a href="#json_mode">JSON Mode</a> for details.</p>
</dd>
<dt><strong><a name="strict_nostrict" class="item">--strict, --nostrict</a></strong></dt>
<dd>
<p>Enables strict mode for the RiveScript parser. It's enabled by default, use
<code>--nostrict</code> to disable it. Strict mode prevents the parser from continuing
when it finds a syntax error in the RiveScript documents.</p>
</dd>
<dt><strong><a name="depth_50" class="item">--depth=50</a></strong></dt>
<dd>
<p>Override the default recursion depth limit. This controls how many times
RiveScript will recursively follow redirects to other replies. The default is
<code>50</code>.</p>
</dd>
<dt><strong><a name="help" class="item">--help</a></strong></dt>
<dd>
<p>Displays this documentation in your terminal.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="usage">USAGE</a></h1>
<p>
</p>
<h2><a name="interactive_mode">Interactive Mode</a></h2>
<p>This is the default mode used when you run <code>rivescript</code> without specifying
another mode. This mode behaves similarly to the old <code>rsdemo</code> script and lets
you chat one-on-one with your RiveScript bot.</p>
<p>This mode can be used to test your RiveScript bot. Example:</p>
<pre>
$ rivescript /path/to/rs/files</pre>
<p>
</p>
<h2><a name="json_mode">JSON Mode</a></h2>
<p>This mode should be used when calling from a third party program. In this mode,
data that enters and leaves the script are encoded in JSON.</p>
<p>Example:</p>
<pre>
$ rivescript --json /path/to/rs/files</pre>
<p>The format for incoming JSON data is as follows:</p>
<pre>
{
"username": "localuser",
"message": "Hello bot!",
"vars": {
"name": "Aiden"
}
}</pre>
<p>Here, <code>username</code> is a unique name for the user, <code>message</code> is their message to
the bot, and <code>vars</code> is a hash of any user variables your program might be
keeping track of (such as the user's name and age).</p>
<p>The response from <code>rivescript</code> will look like the following:</p>
<pre>
{
"status": "ok",
"reply": "Hello, human!",
"vars": {
"name": "Aiden"
}
}</pre>
<p>Here, <code>status</code> will be <code>"ok"</code> or <code>"error"</code>, <code>reply</code> is the bot's response to
your message, and <code>vars</code> is a hash of the current variables for the user (so
that your program can save them somewhere).</p>
<p>
</p>
<h3><a name="end_of_message">End of Message</a></h3>
<p>There are two ways you can use the JSON mode: "fire and forget," or keep a
stateful session open.</p>
<p>In "fire and forget," you open the program, print your JSON input and send the
EOF signal, and then <code>rivescript</code> sends you the JSON response and exits.</p>
<p>In a stateful session mode, you must send the text <code>__END__</code> on a line by
itself after you finish sending your JSON data. Then <code>rivescript</code> will
process it, return its JSON response and then also say <code>__END__</code> at the end.</p>
<p>Example:</p>
<pre>
{
"username": "localuser",
"message": "Hello bot!",
"vars": {}
}
__END__</pre>
<p>And the response:</p>
<pre>
{
"status": "ok",
"reply": "Hello, human!",
"vars": {}
}
__END__</pre>
<p>This way you can reuse the same pipe to send and receive multiple messages.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>RiveScript</em>, the Perl RiveScript interpreter.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Noah Petherbridge, <a href="http://www.kirsle.net">http://www.kirsle.net</a></p>
<p>
</p>
<hr />
<h1><a name="license">LICENSE</a></h1>
<pre>
RiveScript - Rendering Intelligence Very Easily
Copyright (C) 2008 Casey Kirsle
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</pre>
</body>
</html>
|