rikeripsum icon indicating copy to clipboard operation
rikeripsum copied to clipboard

Ditch use of pickle

Open ben174 opened this issue 11 years ago • 4 comments

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.

ben174 avatar Jun 25 '13 03:06 ben174

How about a sqlite store? That way, you can still index by sentence length quickly.

rowedonalde avatar Jun 25 '13 06:06 rowedonalde

Yea. But I'm wondering if sqlite performs less than pickle. Maybe flat text is better for something so simple.

ben174 avatar Jun 25 '13 06:06 ben174

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)

danielquinn avatar Jun 25 '13 09:06 danielquinn

You could also use the json module. It has a nearly identical API to pickle, and is plenty portable.

DanAlbert avatar Jun 26 '13 00:06 DanAlbert