---
title: "Measure Your Sentence Lengths With a Script You Can Run on Any Post"
url: https://hostmy.blog/measure-quotable-writing/
date: 2026-09-22
modified: 2026-11-04
lang: en
author: "Aditya Sharma"
description: "A script that measures sentence length on any page or draft, with the numbers from one self-published study of Gemini citations for reference."
categories:
  - "AI Search"
image: https://hostmy.blog/wp-content/uploads/2026/11/hmb-card-1888-v2-1024x538.jpg
word_count: 662
---

# Measure Your Sentence Lengths With a Script You Can Run on Any Post

There is a measurable shape to the sentences in the Gemini sample, and most writing advice ignores it.

Daniel Shashko's May 2026 analysis of 11,346 Gemini sentences found the mean extracted sentence ran 9.27 words. The median was 10. The 6 to 10 word band alone carried 45.2 percent of those sentences. The longest was 18 words in that sample.

*Source: Daniel Shashko, [Google Killed Text Fragments in AI Mode. Here Is What 153,425 Citations Say to Do About It.](https://hackmd.io/@A09fyOMpSD2VYIJodmXHqQ/SyKkHeLJfl), May 2026 ([data and code on GitHub](https://github.com/danishashko/ai-citation-patterns)). Sentence-level figures come from the 11,346 Gemini citations that carry a text fragment. We did not collect this data. The study is self-published, not peer reviewed.*

That last number is a property of one sample, not a rule. No sentence over 18 words appears in it, and it covers Gemini only. [Our guide to short, single-claim sentences](/18-word-ceiling/) turns it into an editing habit, which is all we claim for it.

This post gives you a script that measures any page or draft against that distribution. It runs on stock Python 3.

What the script prints, against the citation record
What the script prints, against the citation record
Your post
The benchmark

Mean sentence length
printed
9.27 words

Longest sentence
printed
18 words, longest

Share in the 6 to 10 word band
printed
45.2%

Where cited sentences sit
printed
mean cited position: 37% of the page
11,346 cited Gemini sentences (Shashko, May 2026).

The script gives you four numbers. The right column is what those numbers are being compared against, so a result means something before you edit anything.

## What the script measures, and what it deliberately does not

Four things, all mechanical.

Sentence count and word count per sentence. The share sitting in the 6 to 10 word band. The share running past 18 words. And the same two figures for the front 30 percent of the page. The 30 percent cut is my choice, not a number from the study. The study found the mean cited sentence 37 percent of the way down the page, with 74.9 percent of cited sentences in the first half.

What it does not do is judge your writing. A low band share on a technical reference page is fine. The script gives you a distribution, not a grade. Read it as a description of the shape of your prose, then decide whether that shape suits the page. Point it at your article pages, which is [why the homepage is the wrong page to measure](/homepage-wrong-page-for-ai/).

One more measured detail worth knowing before you start optimising for readability scores. Readability in that dataset was bimodal. Of 11,215 cited Gemini sentences, 22.9 percent scored very easy on Flesch Reading Ease, 20.5 percent scored very confusing, and only 2.6 percent sat in the 50 to 59 middle. The middle was the thinnest part of the distribution in that sample.

## The script

Save this as `quotable.py`.

`#!/usr/bin/env python3
"""Score how quotable a page is, by sentence length.

usage: python3 quotable.py https://example.com/post/
python3 quotable.py draft.txt
curl -sSL -H "Accept: text/markdown" URL | python3 quotable.py -
"""
import re, sys, urllib.request
from html.parser import HTMLParser

SHORT_LO, SHORT_HI, CEILING = 6, 10, 18
SKIP_TAGS = {"script", "style", "nav", "header", "footer", "aside", "noscript", "form"}
ABBREV = {"mr", "mrs", "ms", "dr", "prof", "sr", "jr", "st", "vs", "etc",
"e.g", "i.e", "fig", "no", "inc", "ltd", "co", "approx"}

class TextGrab(HTMLParser):
def __init__(self):
super().__init__()
self.parts, self.depth = [], 0
def handle_starttag(self, tag, attrs):
if tag.lower() in SKIP_TAGS:
self.depth += 1
def handle_endtag(self, tag):
if tag.lower() in SKIP_TAGS and self.depth:
self.depth -= 1
def handle_data(self, data):
if self.depth == 0 and data.strip():
self.parts.append(data)
def text(self):
return re.sub(r"\s+", " ", " ".join(self.parts)).strip()

def load(src):
if src == "-":
html = sys.stdin.read()
elif src.startswith(("http://", "https://")):
req = urllib.request.Request(src, headers={
"User-Agent": "Mozilla/5.0 (compatible; quotable/1.0)"})
with urllib.request.urlopen(req, timeout=30) as r:
raw = r.read()
cs = r.headers.get_content_charset() or "utf-8"
html = raw.decode(cs, "replace")
else:
with open(src, encoding="utf-8", errors="replace") as fh:
html = fh.read()
low = html.lower()
if "