View Single Post
Old January 13 2012, 04:36 AM   #1
Sho
Fleet Captain
 
Sho's Avatar
 
Location: Berlin, Germany
Tabulated review threads sorted by average score

I have trouble sleeping tonight, so I got back up and banged together a little toy program that goes over a text file full of TrekBBS review thread URLs and computes a HTML file that tabulates them sorted by average score.

The average score is determined as follows: Each vote is given a weight from 1 for "Poor" to 5 for "Outstanding". Then the sum of all votes is divided by the number of votes and rounded to two places.

Here's the output: http://www.eikehein.com/stuff/trekbb...w_threads.html

This is static, i.e. it'll be outdated as soon as any new vote comes in past the time I generated the page (see below regarding future plans).

Here's the source code, under GPL v3: http://paste.kde.org/186488/03186132/

And the URL file used as input, put together manually via a search for "review thread": http://paste.kde.org/185954/64256221/

It's written in Python 3 and requires the lxml library. I ran it on Linux, but it should run equally well on Windows and other operating systems, with an invocation la "python3 threads.py threads.txt > threads.html". Beware that this was written hurriedly while suffering sleep deprivation, so it may eat babies or attract Borg cubes.

Obviously there are tons of things that could be improved, starting with the scoring algorithm: The Children of Kings comes out on top with a single "Outstanding" vote at present (edit: the output has since been regenerated to reflect additional votes), because the number of voters is not taken into account (luckily this is the only thread with a sample size that's too small to be useful). It would also be nice to output a little fancier HTML, with sortable table columns. And the review thread discovery could be automated, obviating the need to prepare an input file.

At least it does already take care to reject threads that don't follow the "standard poll format", so the data should be reliable .

Stay tuned, I'll probably revisit this and make it a proper, live website at some point - or, of course, you can grab the source and beat me to it if you want!

Thanks to Thrawn who inspired me to do this with this post.

Last edited by Sho; January 14 2012 at 02:07 AM.
Sho is offline   Reply With Quote