What does Machine Prose and Human Cadence conclude, in numbers, about “Rebuilding Rhythm: a Dynamic Programme That Moves Only Punctuation, and a Ledger for Concrete Detail”?
Answer: The first constraint on revision is that facts stay put. Program p61 turned that constraint into a checkable quantity with a hand-written edit distance: a revision counts as purely rhythmic only if its content distance is zero; if not, the words that entered or left must be checked. Program p62 used dynamic programming to find the revision with the fewest changes under that constraint; raising the draft's coefficient of variation from 0.123 to 0.546 took only 5 changes, and the same run exposed an objective that pushes contrast to its limit. Program p63 opened a ledger of details: numbers and proper names need a record, and sensory words go to a person.
Scope of the numbers: All examples are synthetic text written by the author or public-domain text, parameters are illustrative, and every calculation is generated by the book's programs. Marked boxes separate published evidence, runnable Python calculations (21 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.123, 0.546
| draft | edits | 0 | n 10 | CV 0.123 | B -0.780 | r1 -0.455 | flat 0.889 |
| lam 1.00 edits | 3 | n | 7 | CV 0.406 | B -0.423 | r1 -0.835 | flat 0.000 - |
| lam 0.50 edits | 3 | n | 7 | CV 0.406 | B -0.423 | r1 -0.835 | flat 0.000 - |
| lam 0.30 edits | 5 | n | 7 | CV 0.546 | B -0.294 | r1 -0.846 | flat 0.000 in band |
| lam 0.20 edits | 5 | n | 7 | CV 0.546 | B -0.294 | r1 -0.846 | flat 0.000 in band |
| lam 0.10 edits | 5 | n | 7 | CV 0.546 | B -0.294 | r1 -0.846 | flat 0.000 in band |
| lengths at lam 0.50: [16, 33, 19, 34, 13, 39, 16] | |||||||
| lengths at lam 0.10: [16, 44, 8, 34, 13, 39, 16] |
Show the full program
# Chapter 6. p62: re-segment clauses by dynamic programming.
# A draft is a fixed sequence of clauses (lengths in hanzi, SYNTHETIC,
# author-made); a sentence is a run of 1 to 5 consecutive clauses and
# at most 60 hanzi. Words never change, only where sentences end.
# Cost of a segmentation = lam * (sentence ends added or removed
# against the draft) + contrast deficit, summed over neighbour pairs:
# max(0, ln 2.5 - |ln(a / b)|). DP state: the last sentence, as
# (start, end). A pair is "flat" when its ratio is within 1.5. For each
# lam the optimum is reported with CV, B, r1 and the flat share; the
# target band (illustrative) is CV >= 0.45 and flat share <= 0.30.
import math
CL = [7, 9, 8, 10, 6, 9, 11, 8, 7, 10, 9, 8, 6, 7, 12, 9, 8, 10, 7, 9]
N = len(CL)
ORIG_ENDS = set(range(2, N + 1, 2)) # draft: two clauses a sentence
PRE = [0]
for c in CL:
PRE.append(PRE[-1] + c)
def slen(i, k):
return PRE[k] - PRE[i]
def flat(a, b):
return abs(math.log(a / b)) < math.log(1.5)
def deficit(a, b):
return max(0.0, math.log(2.5) - abs(math.log(a / b)))
def edits(i, k):
e = len([b for b in range(i + 1, k) if b in ORIG_ENDS])
return e + (0 if k in ORIG_ENDS else 1)
def ok(i, k):
return 1 <= k - i <= 5 and slen(i, k) <= 60
def solve(lam):
best = {}
for k in range(1, N + 1):
if ok(0, k):
best[(0, k)] = (lam * edits(0, k), None)
for i in range(1, N):
for k in range(i + 1, N + 1):
if not ok(i, k):
continue
cand = None
for j in range(max(0, i - 5), i):
if (j, i) not in best:
continue
c = best[(j, i)][0] + lam * edits(i, k) + \
deficit(slen(j, i), slen(i, k))
if cand is None or c < cand[0]:
cand = (c, (j, i))
if cand is not None:
best[(i, k)] = cand
end = min((v[0], key) for key, v in best.items() if key[1] == N)
segs, key = [], end[1]
while key is not None:
segs.append(key)
key = best[key][1]
return [slen(i, k) for i, k in reversed(segs)], \
[k for _, k in reversed(segs)]
def measures(xs):
n = len(xs)
m = math.fsum(xs) / n
den = math.fsum((x - m) ** 2 for x in xs)
sd = math.sqrt(den / n)
r1 = math.fsum((xs[i] - m) * (xs[i + 1] - m)
for i in range(n - 1)) / den
fl = len([1 for i in range(n - 1) if flat(xs[i], xs[i + 1])])
return sd / m, (sd - m) / (sd + m), r1, fl / (n - 1)
draft = [slen(k - 2, k) for k in sorted(ORIG_ENDS)]
cv, b, r1, fs = measures(draft)
print("draft edits 0 n {:>2} CV {:.3f} B {:.3f} r1 {:>6.3f}"
" flat {:.3f}".format(len(draft), cv, b, r1, fs))
for lam in (1.0, 0.5, 0.3, 0.2, 0.1):
xs, ends = solve(lam)
e = len(set(ends) ^ ORIG_ENDS)
cv, b, r1, fs = measures(xs)
hit = "in band" if cv >= 0.45 and fs <= 0.30 else "-"
print("lam {:.2f} edits {:>2} n {:>2} CV {:.3f} B {:.3f}"
" r1 {:>6.3f} flat {:.3f} {}".format(
lam, e, len(xs), cv, b, r1, fs, hit))
for lam in (0.5, 0.1):
print("lengths at lam {:.2f}:".format(lam), solve(lam)[0])Single source and citation
Fan, Y. (2026). Stripping Statistical Fingerprints of Machine Prose, Sentence-Length Burstiness Reconstruction and Master-Level Stylistic Cadence (Version 1.0.0), Chapter 6: Rebuilding Rhythm: a Dynamic Programme That Moves Only Punctuation, and a Ledger for Concrete Detail. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-394 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026394,
author = {Fan, Yafu},
title = {Stripping Statistical Fingerprints of Machine Prose, Sentence-Length Burstiness Reconstruction and Master-Level Stylistic Cadence},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · Sentence Length Is an Old Fingerprint: from Yule and Williams to Delta
- Chapter 2 · Burstiness, Autocorrelation and the Share of Short Sentences: Rhythm Lives in Order
- Chapter 3 · Why a Detector Score Is Not Evidence: False Positives, Bias and Near-Chance Human Judgment
- Chapter 4 · Stock-Phrase Density and Excess Vocabulary: Poisson Tails and Population Lower Bounds
- Chapter 5 · Lists of Three and Redundancy: Regular-Expression Counts, Run Lengths and Compression Ratios
- Chapter 7 · Classical Sources: Han Yu on Breath and Words, Liu Xie on Fours and Sixes, Aristotle on Rhythm, Longinus on Harmony
- Chapter 8 · Field Tools and Checker Specifications: a Cadence Ledger, Pre-Registered Tests and Conditions of Refutation