forked from aichaos/rivescript-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample3.py
executable file
·31 lines (22 loc) · 848 Bytes
/
example3.py
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
#!/usr/bin/python3
# Python 3 example
from rivescript import RiveScript
rs = RiveScript()
rs.load_directory("./eg/brain")
rs.sort_replies()
print("""This is a bare minimal example for how to write your own RiveScript bot!
For a more full-fledged example, try running: `python rivescript brain`
This will run the built-in Interactive Mode of the RiveScript library. It has
some more advanced features like supporting JSON for communication with the
bot. See `python rivescript --help` for more info.
example3.py is just a simple script that loads the RiveScript documents from
the 'brain/' folder, and lets you chat with the bot.
Type /quit when you're done to exit this example.
""")
while True:
msg = input("You> ")
if msg == '/quit':
quit()
reply = rs.reply("localuser", msg)
print("Bot>", reply)
# vim:expandtab