CLI to calculates the time some text takes the average human to read, based on Medium's read time forumula.
Medium's Help Center says,
Read time is based on the average reading speed of an adult (roughly 265 WPM). We take the total word count of a post and translate it into minutes, with an adjustment made for images. For posts in Chinese, Japanese and Korean, it's a function of number of characters (500 characters/min) with an adjustment made for images.
Double checking with real articles, the English algorithm is:
seconds = num_words / 265 * 60 + img_weight * num_images
With img_weight
starting at 12
and decreasing one second with each image encountered, with a minium img_weight
of 3
seconds.
MacOS or Linux
Python 3.9+
Readtime-CLI stands on the shouders of giants:
poetry add readtime-cli
virtualenv venv
. venv/bin/activate
pip install readtime-cli
readtime version
readtime md FILE_PATH [OPTIONS]
readtime html FILE_PATH [OPTIONS]
readtime text FILE_PATH [OPTIONS]
--wpm INTEGER Word Per Minute [default: 265]
--language [en|pt-br] [default: Languages.en]
--help Show this message and exit.