Skip to content

Commit b8670f3

Browse files
committed
Prettify examples and add Twilio example
1 parent 182b564 commit b8670f3

17 files changed

Lines changed: 209 additions & 4 deletions

README.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,39 @@ trigger/response pairs for building up a bot's intelligence.
88

99
This library is compatible with both Python 2 and Python 3.
1010

11+
## INSTALLATION
12+
13+
This module is available on [PyPI](https://pypi.python.org/) and can be
14+
installed via pip:
15+
16+
`pip install rivescript`
17+
18+
To install manually, download or clone the git repository and run
19+
`python setup.py install`
20+
21+
## EXAMPLES
22+
23+
There are examples available in the
24+
[eg/](https://github.com/aichaos/rivescript-python/tree/master/eg) directory of
25+
this project on GitHub that show how to interface with a RiveScript bot in a
26+
variety of ways--such as through the Twilio SMS API--and other code snippets and
27+
useful tricks.
28+
1129
## USAGE
1230

1331
The `rivescript` module can be executed as a stand-alone Python script, or
1432
included in other Python code. When executed directly, it launches an
1533
interactive chat session:
1634

17-
python rivescript ./brain
35+
python rivescript ./eg/brain
1836

1937
When used as a library, the synopsis is as follows:
2038

2139
```python
2240
from rivescript import RiveScript
2341

2442
bot = RiveScript()
25-
bot.load_directory("./brain")
43+
bot.load_directory("./eg/brain")
2644
bot.sort_replies()
2745

2846
while True:

eg/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Examples
2+
3+
These directories include example snippets for how to do various things with
4+
RiveScript-Python.
5+
6+
## RiveScript Example
7+
8+
* [brain](brain/) - The standard default RiveScript brain (`.rive` files) that
9+
implements an Eliza-like bot with added triggers to demonstrate other features
10+
of RiveScript.
11+
12+
## Client Examples
13+
14+
* [twilio](twilio/) - An example that uses the Twilio SMS API to create a bot
15+
that can receive SMS text messages from users and reply to them using
16+
RiveScript.
17+
18+
## Code Snippets
19+
20+
* [js-objects](js-objects/) - Demonstrates adding JavaScript object macro
21+
support to RiveScript-Python. This example assumes a Python RiveScript bot is
22+
serving its responses via a web front-end, so that the JS macros are being
23+
executed in the user's browser via `<script>` tags.
24+
* [perl-objects](perl-objects/) - Demonstrates adding Perl object macro support
25+
to RiveScript-Python. This works by running a Perl script, which uses the Perl
26+
version of RiveScript, and passing essential data about the object call into
27+
the Perl script and retrieving the output.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

eg/js-objects/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# JavaScript Object Macros
2+
3+
This example demonstrates how a RiveScript-Python bot may support JavaScript as
4+
a language for object macros.
5+
6+
This assumes that the Python bot is serving its responses via a web front-end,
7+
and that the end user's browser will be executing the JavaScript macros via
8+
`<script>` tags.

0 commit comments

Comments
 (0)