|
__init__(self,
debug=False,
strict=True,
depth=50,
log='
' )
Initialize a new RiveScript interpreter. |
source code
|
|
|
|
|
|
|
load_directory(self,
directory,
ext=' .rs ' )
Load RiveScript documents from a directory. |
source code
|
|
|
load_file(self,
filename)
Load and parse a RiveScript document. |
source code
|
|
|
|
|
_parse(self,
fname,
code)
Parse RiveScript code into memory. |
source code
|
|
|
|
|
_initTT(self,
toplevel,
topic,
trigger,
what='
' )
Initialize a Topic Tree data structure. |
source code
|
|
|
sort_replies(self,
thats=False)
Sort the loaded triggers. |
source code
|
|
|
_sort_that_triggers(self)
Make a sorted list of triggers that correspond to %Previous groups. |
source code
|
|
|
_sort_trigger_set(self,
triggers)
Sort a group of triggers in optimal sorting order. |
source code
|
|
|
_sort_list(self,
name,
items)
Sort a simple list by number of words and length. |
source code
|
|
|
_init_sort_track(self)
Returns a new dict for keeping track of triggers for sorting. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_uservar(self,
user,
name,
value)
Set a variable for a user. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reply(self,
user,
msg)
Fetch a reply from the RiveScript brain. |
source code
|
|
|
_format_message(self,
msg)
Format a user's message for safe processing. |
source code
|
|
|
_getreply(self,
user,
msg,
context=' normal ' ,
step=0) |
source code
|
|
|
_substitute(self,
msg,
list)
Run a kind of substitution on a message. |
source code
|
|
|
_reply_regexp(self,
user,
regexp)
Prepares a trigger for the regular expression engine. |
source code
|
|
|
_process_tags(self,
user,
msg,
reply,
st=[ ] ,
bst=[ ] ,
depth=0)
Post process tags in a message. |
source code
|
|
|
_string_format(self,
msg,
method)
Format a string (upper, lower, formal, sentence). |
source code
|
|
|
_topic_triggers(self,
topic,
triglvl,
depth=0,
inheritence=0,
inherited=False)
Recursively scan a topic and return a list of all triggers. |
source code
|
|
|
_find_trigger_by_inheritence(self,
topic,
trig,
depth=0)
Locate the replies for a trigger in an inherited/included topic. |
source code
|
|
|
_get_topic_tree(self,
topic,
depth=0)
Given one topic, get the list of all included/inherited topics. |
source code
|
|
|
_is_atomic(self,
trigger)
Determine if a trigger is atomic or not. |
source code
|
|
|
_word_count(self,
trigger,
all=False)
Count the words that aren't wildcards in a trigger. |
source code
|
|
|
_rot13(self,
n)
Encode and decode a string into ROT13. |
source code
|
|
|
_strip_nasties(self,
s)
Formats a string for ASCII regex matching. |
source code
|
|
|
_dump(self)
For debugging, dump the entire data structure. |
source code
|
|