Hello!
Thank you so much for this library - I've been using it quite a bit for the last few months.
My question is about the contents of the Brain. I have a large set of RiveScript files and I'm wrapping this library with a Flask web server so that clients can make HTTP requests and respond based on the user calling in. Unfortunately on each reply, loading the Brain takes quite a while.
Question: Has anyone solved for a means of caching the parsed content in memory for a large set of RiveScript files (~ 130 files, 500 - 1000 lines each)?
Examples:
I tried to cache a lot of the RiveScript class's private variables (_global, _var, etc) in Redis as JSON-encoded strings and load them using json.loads but the parsing process from string to dictionary is rather expensive.
I also tried MongoDB, but the _sorted dictionary of sort buffers exceeds a document's maximum size of 16MB.
Another data point - every private dictionary in RiveScript (minus _handlers and _regexc stored as one large JSON object in a file is about 200MB.
Any feedback, either potential solutions or commentary on any relevant architecture decisions, is much appreciated.
Hello!
Thank you so much for this library - I've been using it quite a bit for the last few months.
My question is about the contents of the Brain. I have a large set of RiveScript files and I'm wrapping this library with a Flask web server so that clients can make HTTP requests and respond based on the user calling in. Unfortunately on each reply, loading the Brain takes quite a while.
Question: Has anyone solved for a means of caching the parsed content in memory for a large set of RiveScript files (~ 130 files, 500 - 1000 lines each)?
Examples:
I tried to cache a lot of the
RiveScriptclass's private variables (_global,_var, etc) in Redis as JSON-encoded strings and load them usingjson.loadsbut the parsing process from string to dictionary is rather expensive.I also tried MongoDB, but the
_sorteddictionary of sort buffers exceeds a document's maximum size of 16MB.Another data point - every private dictionary in
RiveScript(minus_handlersand_regexcstored as one large JSON object in a file is about 200MB.Any feedback, either potential solutions or commentary on any relevant architecture decisions, is much appreciated.