What's the time?

~1 minutes 22 seconds reading

About six thirty. But in all seriousness you may have noticed the time that is appended to the top of each of my blogs along the lines of “~2 minutes 50 seconds reading”. This is an approximated reading time for that particular blog.

Why?

I decided to add this to each of my posts after seeing them on the GitHub guides pages (https://guides.github.com/). It got me thinking about how often I look at a blog post and don't read past the first few lines because I see how long it is. Most of the time that length wouldn't equate to more than a few minutes reading, but in this fast paced world where micro-blogging is king that doesn’t seem to register. I then reflected on the fact that I had more often read the post when told before hand roughly how long I'd be reading it for, so the decision to implement it myself seemed like a no brainer.

How?

I did a little reading and found that the average reading time on a screen is about 200 word per minute. I then wrote myself a little script in Python that I can just plug the blog into and have it spit out the reading time.

#!/usr/bin/python3
from math import floor
text = input("Paste text...\n").strip().split(" ")
if len(text)/200 < 1:
print("~%d seconds reading" % (float(len(text))*0.3))
else:
print("~%d minutes %d seconds reading" % (floor(len(text)/float(200)), ((len(text)/float(200))-floor(len(text)/float(200)))*60))

It's a bit dirty, but it gets the job done. I had it set to support both minutes and seconds because some of my blogs (looking at you book reviews) otherwise read as 0.28 minutes which is just silly.


comments powered by Disqus