From 563b48869cee85f345537cce09da0f991da46a9b Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Mon, 9 Feb 2026 22:35:53 +0100 Subject: Word count analysis --- scripts/stats.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/stats.py (limited to 'scripts/stats.py') diff --git a/scripts/stats.py b/scripts/stats.py new file mode 100644 index 0000000..5cef3b6 --- /dev/null +++ b/scripts/stats.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +import json +import math +import sys + +with open(sys.argv[1]) as f: + posts = json.load(f) + +words = [p["wordCount"] for p in posts] +n = len(words) +total = sum(words) +mean = total / n +stddev = math.sqrt(sum(w * w for w in words) / n - mean * mean) + +print(f"Posts: {n}") +print(f"Total: {total} words") +print(f"Mean: {mean:.0f} words") +print(f"Std Dev: {stddev:.0f} words") +print() +print(f"{'Title':<60s} {'Words'}") +print(f"{'-----':<60s} {'-----'}") +for p in posts: + print(f"{p['title']:<60s} {p['wordCount']}") -- cgit v1.3