FA-80221 / Typography line breaking / Open access
Ragged-right hyphenation zone: capitalisation test · case 01
Words with internal capitals are protected, or proper names are hyphenated.
ROOT CAUSE
Capitalisation is detected by any uppercase letter instead of the first letter.
THE FAILURE
Capitalisation is detected by any uppercase letter instead of the first letter.
Unsuccessful approach: Using istitle misclassifies names like McDonald.
Case contract
Input [words as syllables, width, zone, min word length, min chars before, min chars after, hyphenate capitals]. Greedy fill. A word that does not fit may be hyphenated only if the slack left on the line (width minus current text minus the separating space) is at least the zone, the word has at least min-word characters, and (capitals allowed or its first letter is not uppercase). Pick the latest syllable boundary with head >= min before and tail >= min after chars whose head plus "-" fits. Return lines.
Why this case matters
Line breaking decides where paragraphs wrap on screen and in print; a wrong decision point shifts every following line.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, zone, min_word, min_before, min_after, caps = x
lines = []
cur = ''
k = 0
queue = [list(w) for w in words]
while k < len(queue):
syl = queue[k]
token = ''.join(syl)
cand = token if not cur else cur + ' ' + token
if len(cand) <= width:
cur = cand
k += 1
continue
slack = width - len(cur) - (1 if cur else 0)
eligible = slack >= zone and len(token) >= min_word and (caps or not any(ch.isupper() for ch in token))
cut = None
if eligible:
for c in range(len(syl) - 1, 0, -1):
head = ''.join(syl[:c])
tail = ''.join(syl[c:])
if len(head) < min_before or len(tail) < min_after:
continue
fit = len(head) + 1 if not cur else len(cur) + len(head) + 2
if fit <= width:
cut = c
break
if cut is not None:
head = ''.join(syl[:cut]) + '-'
lines.append(head if not cur else cur + ' ' + head)
queue[k] = syl[cut:]
cur = ''
elif cur:
lines.append(cur)
cur = ''
else:
cur = token
k += 1
if cur:
lines.append(cur)
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: capitalisation test', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['of'], ['Ber', 'lin'], ['a']], 15, 3, 5, 1, 3, False], ['hyphenated e-', 'Booking inter-', 'national the of', 'Berlin a']), ('regression: capitalisation test', [[['im', 'por', 'tant'], ['of'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing']], 12, 3, 5, 1, 2, False], ['important of', 'only typo-', 'graphy e-', 'Booking']), ('partial-repair probe', [[['on', 'ly'], ['a'], ['set'], ['on', 'ly'], ['on', 'ly'], ['a'], ['rag', 'ged'], ['Mc', 'Don', 'ald'], ['the'], ['Ber', 'lin']], 13, 1, 7, 2, 3, False], ['only a set', 'only only a', 'ragged', 'McDonald the', 'Berlin']), ('partial-repair probe', [[['set'], ['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['set'], ['of'], ['set'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al']], 8, 1, 7, 2, 2, False], ['set', 'McDonald', 'interna-', 'tional', 'set of', 'set', 'McDonald', 'only', 'ragged', 'interna-', 'tional']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['Ber', 'lin'], ['a'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['of'], ['a'], ['a']], 16, 5, 7, 1, 2, False], ['Berlin a hyphen-', 'ated ragged', 'international', 'ragged of a a']), ('control layout', [[['e', 'Book', 'ing'], ['of'], ['a'], ['e', 'Book', 'ing'], ['a'], ['of'], ['the'], ['set']], 11, 3, 7, 2, 2, False], ['eBooking of', 'a eBooking', 'a of the', 'set'])], [('regression: capitalisation test', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed']], 13, 3, 7, 3, 3, False], ['Berlin eBook-', 'ing ragged', 'hyphenated']), ('regression: capitalisation test', [[['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['e', 'Book', 'ing']], 13, 4, 5, 3, 3, False], ['McDonald', 'eBooking', 'Berlin eBook-', 'ing']), ('partial-repair probe', [[['the'], ['Mc', 'Don', 'ald'], ['of'], ['of'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy'], ['set'], ['Mc', 'Don', 'ald']], 8, 2, 6, 2, 2, False], ['the', 'McDonald', 'of of', 'hyphen-', 'ated ty-', 'pography', 'set', 'McDonald']), ('partial-repair probe', [[['of'], ['set'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 4, 3, 3, False], ['of set a', 'of', 'McDonald', 'only', 'typogra-', 'phy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald']], 13, 5, 7, 1, 2, True], ['only hyphen-', 'ated eBooking', 'McDonald']), ('control layout', [[['set'], ['Ber', 'lin'], ['on', 'ly'], ['e', 'Book', 'ing'], ['the'], ['the'], ['a'], ['Mc', 'Don', 'ald'], ['of']], 16, 4, 7, 2, 2, True], ['set Berlin only', 'eBooking the the', 'a McDonald of'])], [('regression: capitalisation test', [[['on', 'ly'], ['a'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['Ber', 'lin'], ['Mc', 'Don', 'ald']], 14, 1, 7, 3, 3, False], ['only a eBook-', 'ing hyphenated', 'ragged Berlin', 'McDonald']), ('regression: capitalisation test', [[['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al']], 12, 2, 4, 1, 3, False], ['typography', 'eBooking e-', 'Booking im-', 'portant im-', 'portant in-', 'ternational']), ('partial-repair probe', [[['the'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['a'], ['Ber', 'lin'], ['a'], ['a'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy']], 11, 5, 5, 2, 2, False], ['the', 'McDonald', 'Berlin a', 'Berlin a a', 'interna-', 'tional', 'hyphenated', 'typography']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['of'], ['Mc', 'Don', 'ald'], ['ty', 'po', 'gra', 'phy'], ['set']], 10, 1, 6, 1, 2, False], ['McDonald', 'of', 'McDonald', 'typography', 'set']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['rag', 'ged'], ['e', 'Book', 'ing']], 14, 5, 6, 2, 3, True], ['ragged typo-', 'graphy Berlin', 'eBooking rag-', 'ged ragged', 'eBooking']), ('control layout', [[['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['set'], ['e', 'Book', 'ing']], 12, 5, 4, 2, 2, True], ['important', 'typography', 'hyphenated', 'important', 'Berlin im-', 'portant set', 'eBooking'])], [('regression: capitalisation test', [[['set'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['set']], 14, 1, 5, 2, 3, False], ['set typography', 'hyphenated im-', 'portant of', 'Berlin eBook-', 'ing set']), ('regression: capitalisation test', [[['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['in', 'ter', 'na', 'tion', 'al'], ['set'], ['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al']], 12, 1, 4, 1, 2, False], ['eBooking hy-', 'phenated e-', 'Booking', 'McDonald', 'Berlin in-', 'ternational', 'set McDonald', 'internation-', 'al']), ('partial-repair probe', [[['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['a'], ['of'], ['on', 'ly']], 12, 2, 7, 2, 3, False], ['Berlin typo-', 'graphy typo-', 'graphy', 'McDonald a', 'of only']), ('partial-repair probe', [[['of'], ['set'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 4, 3, 3, False], ['of set a', 'of', 'McDonald', 'only', 'typogra-', 'phy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['set'], ['of'], ['on', 'ly'], ['e', 'Book', 'ing']], 11, 5, 5, 3, 3, False], ['interna-', 'tional set', 'of only', 'eBooking']), ('control layout', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['set'], ['a'], ['of'], ['rag', 'ged']], 10, 2, 7, 1, 2, True], ['Berlin e-', 'Booking', 'Berlin im-', 'portant', 'typography', 'set a of', 'ragged'])], [('regression: capitalisation test', [[['on', 'ly'], ['e', 'Book', 'ing'], ['a'], ['im', 'por', 'tant'], ['a'], ['the'], ['Ber', 'lin']], 12, 3, 7, 2, 3, False], ['only eBook-', 'ing a impor-', 'tant a the', 'Berlin']), ('regression: capitalisation test', [[['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['set'], ['hy', 'phen', 'at', 'ed'], ['of'], ['Ber', 'lin'], ['e', 'Book', 'ing']], 14, 4, 6, 3, 3, False], ['ragged inter-', 'national set', 'hyphenated of', 'Berlin eBook-', 'ing']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['set'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['hy', 'phen', 'at', 'ed'], ['a'], ['a'], ['the'], ['Mc', 'Don', 'ald']], 11, 3, 4, 2, 3, False], ['McDonald', 'set only', 'hyphenated', 'hyphenated', 'a a the', 'McDonald']), ('partial-repair probe', [[['a'], ['im', 'por', 'tant'], ['the'], ['of'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al']], 11, 3, 4, 1, 3, False], ['a important', 'the of', 'McDonald', 'the inter-', 'national']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['set'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al'], ['Mc', 'Don', 'ald'], ['set']], 16, 5, 4, 2, 2, True], ['set important', 'important inter-', 'national McDon-', 'ald set']), ('control layout', [[['set'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['on', 'ly']], 12, 3, 6, 2, 3, True], ['set interna-', 'tional rag-', 'ged only'])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: capitalisation test | ['hyphenated', 'eBooking inter-', 'national the of', 'Berlin a'] | ['hyphenated e-', 'Booking inter-', 'national the of', 'Berlin a'] | Failed |
| regression: capitalisation test | ['important of', 'only typo-', 'graphy', 'eBooking'] | ['important of', 'only typo-', 'graphy e-', 'Booking'] | Failed |
| partial-repair probe | ['only a set', 'only only a', 'ragged', 'McDonald the', 'Berlin'] | ['only a set', 'only only a', 'ragged', 'McDonald the', 'Berlin'] | Passed |
| partial-repair probe | ['set', 'McDonald', 'interna-', 'tional', 'set of', 'set', 'McDonald', 'only', 'ragged', 'interna-', 'tional'] | ['set', 'McDonald', 'interna-', 'tional', 'set of', 'set', 'McDonald', 'only', 'ragged', 'interna-', 'tional'] | Passed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| control layout | ['Berlin a hyphen-', 'ated ragged', 'international', 'ragged of a a'] | ['Berlin a hyphen-', 'ated ragged', 'international', 'ragged of a a'] | Passed |
| control layout | ['eBooking of', 'a eBooking', 'a of the', 'set'] | ['eBooking of', 'a eBooking', 'a of the', 'set'] | Passed |
SHA-256 / 137ad759a975f6db95048ad28ac884d28e955992d3b3aae6a57ca966c1a04c36
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
words, width, zone, min_word, min_before, min_after, caps = x
lines = []
cur = ''
k = 0
queue = [list(w) for w in words]
while k < len(queue):
syl = queue[k]
token = ''.join(syl)
cand = token if not cur else cur + ' ' + token
if len(cand) <= width:
cur = cand
k += 1
continue
slack = width - len(cur) - (1 if cur else 0)
eligible = slack >= zone and len(token) >= min_word and (caps or not token.istitle())
cut = None
if eligible:
for c in range(len(syl) - 1, 0, -1):
head = ''.join(syl[:c])
tail = ''.join(syl[c:])
if len(head) < min_before or len(tail) < min_after:
continue
fit = len(head) + 1 if not cur else len(cur) + len(head) + 2
if fit <= width:
cut = c
break
if cut is not None:
head = ''.join(syl[:cut]) + '-'
lines.append(head if not cur else cur + ' ' + head)
queue[k] = syl[cut:]
cur = ''
elif cur:
lines.append(cur)
cur = ''
else:
cur = token
k += 1
if cur:
lines.append(cur)
return lines
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: capitalisation test', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['of'], ['Ber', 'lin'], ['a']], 15, 3, 5, 1, 3, False], ['hyphenated e-', 'Booking inter-', 'national the of', 'Berlin a']), ('regression: capitalisation test', [[['im', 'por', 'tant'], ['of'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing']], 12, 3, 5, 1, 2, False], ['important of', 'only typo-', 'graphy e-', 'Booking']), ('partial-repair probe', [[['on', 'ly'], ['a'], ['set'], ['on', 'ly'], ['on', 'ly'], ['a'], ['rag', 'ged'], ['Mc', 'Don', 'ald'], ['the'], ['Ber', 'lin']], 13, 1, 7, 2, 3, False], ['only a set', 'only only a', 'ragged', 'McDonald the', 'Berlin']), ('partial-repair probe', [[['set'], ['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['set'], ['of'], ['set'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al']], 8, 1, 7, 2, 2, False], ['set', 'McDonald', 'interna-', 'tional', 'set of', 'set', 'McDonald', 'only', 'ragged', 'interna-', 'tional']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['Ber', 'lin'], ['a'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['of'], ['a'], ['a']], 16, 5, 7, 1, 2, False], ['Berlin a hyphen-', 'ated ragged', 'international', 'ragged of a a']), ('control layout', [[['e', 'Book', 'ing'], ['of'], ['a'], ['e', 'Book', 'ing'], ['a'], ['of'], ['the'], ['set']], 11, 3, 7, 2, 2, False], ['eBooking of', 'a eBooking', 'a of the', 'set'])], [('regression: capitalisation test', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed']], 13, 3, 7, 3, 3, False], ['Berlin eBook-', 'ing ragged', 'hyphenated']), ('regression: capitalisation test', [[['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['e', 'Book', 'ing']], 13, 4, 5, 3, 3, False], ['McDonald', 'eBooking', 'Berlin eBook-', 'ing']), ('partial-repair probe', [[['the'], ['Mc', 'Don', 'ald'], ['of'], ['of'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy'], ['set'], ['Mc', 'Don', 'ald']], 8, 2, 6, 2, 2, False], ['the', 'McDonald', 'of of', 'hyphen-', 'ated ty-', 'pography', 'set', 'McDonald']), ('partial-repair probe', [[['of'], ['set'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 4, 3, 3, False], ['of set a', 'of', 'McDonald', 'only', 'typogra-', 'phy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald']], 13, 5, 7, 1, 2, True], ['only hyphen-', 'ated eBooking', 'McDonald']), ('control layout', [[['set'], ['Ber', 'lin'], ['on', 'ly'], ['e', 'Book', 'ing'], ['the'], ['the'], ['a'], ['Mc', 'Don', 'ald'], ['of']], 16, 4, 7, 2, 2, True], ['set Berlin only', 'eBooking the the', 'a McDonald of'])], [('regression: capitalisation test', [[['on', 'ly'], ['a'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['Ber', 'lin'], ['Mc', 'Don', 'ald']], 14, 1, 7, 3, 3, False], ['only a eBook-', 'ing hyphenated', 'ragged Berlin', 'McDonald']), ('regression: capitalisation test', [[['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al']], 12, 2, 4, 1, 3, False], ['typography', 'eBooking e-', 'Booking im-', 'portant im-', 'portant in-', 'ternational']), ('partial-repair probe', [[['the'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['a'], ['Ber', 'lin'], ['a'], ['a'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy']], 11, 5, 5, 2, 2, False], ['the', 'McDonald', 'Berlin a', 'Berlin a a', 'interna-', 'tional', 'hyphenated', 'typography']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['of'], ['Mc', 'Don', 'ald'], ['ty', 'po', 'gra', 'phy'], ['set']], 10, 1, 6, 1, 2, False], ['McDonald', 'of', 'McDonald', 'typography', 'set']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['rag', 'ged'], ['e', 'Book', 'ing']], 14, 5, 6, 2, 3, True], ['ragged typo-', 'graphy Berlin', 'eBooking rag-', 'ged ragged', 'eBooking']), ('control layout', [[['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['set'], ['e', 'Book', 'ing']], 12, 5, 4, 2, 2, True], ['important', 'typography', 'hyphenated', 'important', 'Berlin im-', 'portant set', 'eBooking'])], [('regression: capitalisation test', [[['set'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['set']], 14, 1, 5, 2, 3, False], ['set typography', 'hyphenated im-', 'portant of', 'Berlin eBook-', 'ing set']), ('regression: capitalisation test', [[['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['in', 'ter', 'na', 'tion', 'al'], ['set'], ['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al']], 12, 1, 4, 1, 2, False], ['eBooking hy-', 'phenated e-', 'Booking', 'McDonald', 'Berlin in-', 'ternational', 'set McDonald', 'internation-', 'al']), ('partial-repair probe', [[['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['a'], ['of'], ['on', 'ly']], 12, 2, 7, 2, 3, False], ['Berlin typo-', 'graphy typo-', 'graphy', 'McDonald a', 'of only']), ('partial-repair probe', [[['of'], ['set'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 4, 3, 3, False], ['of set a', 'of', 'McDonald', 'only', 'typogra-', 'phy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['set'], ['of'], ['on', 'ly'], ['e', 'Book', 'ing']], 11, 5, 5, 3, 3, False], ['interna-', 'tional set', 'of only', 'eBooking']), ('control layout', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['set'], ['a'], ['of'], ['rag', 'ged']], 10, 2, 7, 1, 2, True], ['Berlin e-', 'Booking', 'Berlin im-', 'portant', 'typography', 'set a of', 'ragged'])], [('regression: capitalisation test', [[['on', 'ly'], ['e', 'Book', 'ing'], ['a'], ['im', 'por', 'tant'], ['a'], ['the'], ['Ber', 'lin']], 12, 3, 7, 2, 3, False], ['only eBook-', 'ing a impor-', 'tant a the', 'Berlin']), ('regression: capitalisation test', [[['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['set'], ['hy', 'phen', 'at', 'ed'], ['of'], ['Ber', 'lin'], ['e', 'Book', 'ing']], 14, 4, 6, 3, 3, False], ['ragged inter-', 'national set', 'hyphenated of', 'Berlin eBook-', 'ing']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['set'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['hy', 'phen', 'at', 'ed'], ['a'], ['a'], ['the'], ['Mc', 'Don', 'ald']], 11, 3, 4, 2, 3, False], ['McDonald', 'set only', 'hyphenated', 'hyphenated', 'a a the', 'McDonald']), ('partial-repair probe', [[['a'], ['im', 'por', 'tant'], ['the'], ['of'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al']], 11, 3, 4, 1, 3, False], ['a important', 'the of', 'McDonald', 'the inter-', 'national']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('control layout', [[['set'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al'], ['Mc', 'Don', 'ald'], ['set']], 16, 5, 4, 2, 2, True], ['set important', 'important inter-', 'national McDon-', 'ald set']), ('control layout', [[['set'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['on', 'ly']], 12, 3, 6, 2, 3, True], ['set interna-', 'tional rag-', 'ged only'])]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: capitalisation test | ['hyphenated e-', 'Booking inter-', 'national the of', 'Berlin a'] | ['hyphenated e-', 'Booking inter-', 'national the of', 'Berlin a'] | Passed |
| regression: capitalisation test | ['important of', 'only typo-', 'graphy e-', 'Booking'] | ['important of', 'only typo-', 'graphy e-', 'Booking'] | Passed |
| partial-repair probe | ['only a set', 'only only a', 'ragged McDon-', 'ald the', 'Berlin'] | ['only a set', 'only only a', 'ragged', 'McDonald the', 'Berlin'] | Failed |
| partial-repair probe | ['set Mc-', 'Donald', 'interna-', 'tional', 'set of', 'set Mc-', 'Donald', 'only', 'ragged', 'interna-', 'tional'] | ['set', 'McDonald', 'interna-', 'tional', 'set of', 'set', 'McDonald', 'only', 'ragged', 'interna-', 'tional'] | Failed |
| capitalised word protected | ['the McDon-', 'ald'] | ['the', 'McDonald'] | Failed |
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| control layout | ['Berlin a hyphen-', 'ated ragged', 'international', 'ragged of a a'] | ['Berlin a hyphen-', 'ated ragged', 'international', 'ragged of a a'] | Passed |
| control layout | ['eBooking of', 'a eBooking', 'a of the', 'set'] | ['eBooking of', 'a eBooking', 'a of the', 'set'] | Passed |
SHA-256 / af66fe6249dd91e9045574d6b529e6815cad6fbbc086bcc37a4b83d9a208936f
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic toy typesetting model with integer widths and a stipulated rule set; it does not claim conformance to any engine. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:49:51.815408+00:00.
Case digest / e4e471a733916f6ec7b8ff6f619f8f61103953d6fdf7d1eb430de4e630817852