rikeripsum
rikeripsum copied to clipboard
Ditch use of pickle
A couple people on reddit mentioned Pickle has some inadequacies and probably isn't necessary for this project.
http://www.reddit.com/r/Python/comments/1gzb50/rikeripsum_a_lorem_ipsum_type_text_generator_but/capdbrx
I could probably just use a flat text file for data.
How about a sqlite store? That way, you can still index by sentence length quickly.
Yea. But I'm wondering if sqlite performs less than pickle. Maybe flat text is better for something so simple.
If you go with a sqlite store, you could extend this to include all of the main characters and fetch conversational fragments between them, or grab lines from just one or two characters:
tngipsum.generate_paragraph(sentences=6)
tngipsum.generate_sentence(characters=(PICARD, RIKER, CRUSHER), words=8)
You could also use the json module. It has a nearly identical API to pickle, and is plenty portable.