diff --git a/tools/reading_time.py b/tools/reading_time.py new file mode 100644 index 0000000..b5cda21 --- /dev/null +++ b/tools/reading_time.py @@ -0,0 +1,19 @@ +# tool: reading_time +# description: Estimates reading time in minutes (assuming 200 wpm) +# author: @PurpleSwtr +# example: reading_time "400 words of text here" -> "2" + + +import sys + + +def run(*args) -> str: + text = args[0] if args else sys.stdin.read() + + word_count = len(text.strip().split()) + + if word_count == 0: + return "0" + + minutes = (word_count + 100) // 200 + return str(minutes)