What does Compliant Rewriting of Absolute Terms conclude, in numbers, about “Choosing Rewrites under Constraints: Evidence, Re-scanning and Title Length”?
Answer: Rewriting is not deleting. It is choosing candidates under three constraints: facts must have a source, a whole-line re-scan must find no new hit, and the title must fit. In program p41 a title loses "first-class grade under the national standard", which has no basis on file, and "best in the trade", which fails the re-scan, and ends with a rewrite that has no hits, growing from 16 characters to 21. Program p42 writes the length constraint as a multiple-choice knapsack, and the optimum jumps with the limit: at 14 it keeps the material and drops the price, at 12 the reverse; tied solutions should go to a person. Throughout, the fidelity score has been taken as a given input. The next chapter asks where the score comes from, and whether the usual measures of text similarity can serve as the score directly.
Scope of the numbers: Its lexicons, copy, facts and parameters are illustrative; all calculations are generated by its programs; it is not individual legal advice and supplies no way of slipping past platform review. Marked boxes separate published evidence, runnable Python calculations (18 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: 12, 14, 16, 21
| greedy per-hit choice: length 21, fidelity 2.40 | |||
| L | length | fidelity | picks (material | price | gift) |
| 21 | 21 | 2.40 | tou | dao | pei |
| 18 | 16 | 2.10 | tou | dao | - |
| 16 | 16 | 2.10 | tou | dao | - |
| 14 | 14 | 1.60 | tou | - | shi |
| 12 | 12 | 1.60 | - | dao | - |
| 10 | 10 | 1.10 | - | - | shi |
| 7 | 7 | 0.90 | - | - | - |
| 6 | no admissible title fits |
Show the full program
# Chapter 4. p42: choosing rewrites jointly under a title-length budget.
# Model: a multiple-choice knapsack. Each hit must take exactly one of
# its admissible candidates (from p41, deletion included); maximise
# total fidelity subject to total length <= L syllables (one syllable =
# one Chinese character). Solved twice, by enumeration and by dynamic
# programming over (hit, length), and the two answers must agree.
# The 7 syllables outside the hits stay as they are.
import itertools
import math
FIXED = 7
OPTS = [[("tou ceng niu pi", 0.80), ("", 0.30)],
[("dao shou jia 1299 yuan", 0.90),
("ben dian jin qi you hui", 0.55), ("", 0.20)],
[("pei li pin he de", 0.70), ("shi he zuo", 0.60), ("", 0.40)]]
def size(text):
return len(text.split())
def enum_best(cap):
best = None
for combo in itertools.product(*OPTS):
ln = FIXED + math.fsum(size(t) for t, _ in combo)
fid = math.fsum(f for _, f in combo)
if ln <= cap and (best is None or fid > best[0] + 1e-12):
best = (fid, int(ln), combo)
return best
def dp_best(cap):
room = cap - FIXED
table = {0: (0.0, ())} # length used -> (fidelity, picks)
for opts in OPTS:
nxt = {}
for used, (fid, picks) in sorted(table.items()):
for k, (t, f) in enumerate(opts):
u = used + size(t)
if u > room:
continue
cand = (fid + f, picks + (k,)) # step: one item per hit
if u not in nxt or cand[0] > nxt[u][0] + 1e-12:
nxt[u] = cand
table = nxt
if not table:
return None
u, (fid, picks) = max(table.items(), key=lambda kv: (kv[1][0], -kv[0]))
return fid, u + FIXED, picks
greedy = [opts[0] for opts in OPTS]
print("greedy per-hit choice: length %d, fidelity %.2f"
% (FIXED + int(math.fsum(size(t) for t, _ in greedy)),
math.fsum(f for _, f in greedy)))
print(" L length fidelity picks (material | price | gift)")
for cap in [21, 18, 16, 14, 12, 10, 7, 6]:
e = enum_best(cap)
d = dp_best(cap)
if e is None:
assert d is None
print("%3d no admissible title fits" % cap)
continue
assert abs(e[0] - d[0]) < 1e-9
names = [t.split()[0] if t else "-" for t, _ in e[2]]
print("%3d %5d %7.2f %s" % (cap, e[1], e[0], " | ".join(names)))Single source and citation
Fan, Y. (2026). Compliant Rewriting for Platform-Sensitive Terms: Absolute-Term Automata under the Advertising Law, Meaning-Preserving Rewrites and Conversion Elasticity (Version 1.0.0), Chapter 4: Choosing Rewrites under Constraints: Evidence, Re-scanning and Title Length. 5D Library. DOI pending
DOI pending · monograph page goes live after publication · 5DL-B-274 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026274,
author = {Fan, Yafu},
title = {Compliant Rewriting for Platform-Sensitive Terms: Absolute-Term Automata under the Advertising Law, Meaning-Preserving Rewrites and Conversion Elasticity},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}Other chapter answers in this book
- Chapter 1 · The Risk Ledger of an Absolute Term: How Much Conversion Must One "Best" Buy?
- Chapter 2 · One Pass for Every Term: the Aho-Corasick Multi-Pattern Automaton
- Chapter 3 · False Kills and Misses: Exempt Contexts, Audit Additions and Audit Sample Sizes
- Chapter 5 · Keeping the Meaning: Why Surface Similarity Rewards the Violation
- Chapter 6 · Conversion Elasticity: How Much Does a Rewrite Move Conversion, and Can a Test Tell?
- Chapter 7 · Eastern and Western Sources: "If Names Are Not Correct" and Orwell's Rules for Writing
- Chapter 8 · Closing the Loop: a Compliant-Rewrite Library for the Persuasive-Copy Checker, and a Non-Inferiority Test