"""Revision 2 follow-up: the step-pattern comment of Algorithm 2 within 72 characters a line, and the abstract back under 250 words (same claims). python -u apply_revision2_fit.py """ PATH = "article/sim_numerics.md" R = [ (""" # step pattern: q_j <- |d_j|/|d_(j-1)| over successive nonzero # moves d (k of them); rho(u,v) <- min(u,v)/max(u,v); repeats iff # max over p = 2..floor(k/2) of mean_j rho(q_j, q_(j-p)) > 1/2""", """ # step pattern: q_j <- |d_j|/|d_(j-1)| over the # successive nonzero moves d (k ratios); # rho(u,v) <- min(u,v)/max(u,v); repeats iff # max_{p=2..floor(k/2)} mean_j rho(q_j, q_(j-p)) > 1/2"""), ("The derivation fixes a base rule before any benchmark is consulted:", "It fixes, before any benchmark, a base rule:"), ("This decision layer, about ten discrete rules selected on two development sets, gives the method A′.", "This decision layer — about ten discrete rules selected on two development sets — gives A′."), ("what A′ adds is an estimate of the order made without knowing it, within a guarantee of twice bisection.", "A′ adds an estimate of the order, within a guarantee of twice bisection."), ] src = open(PATH, encoding="utf8").read() for o, n in R: assert src.count(o) == 1, o[:60] src = src.replace(o, n) open(PATH, "w", encoding="utf8").write(src) ab = src.split("## Abstract\n\n")[1].split("\n\n---\n")[0] code = src.split("**Algorithm 2 (A′).**")[1].split("```")[1] print(f"abstract {len(ab.split())} words; longest Algorithm 2 line {max(len(l) for l in code.split(chr(10)))}")