FA-80211 / Typography line breaking / Open access
Ragged-right hyphenation zone: zone boundary · case 01
Words are not hyphenated when the slack exactly equals the zone.
ROOT CAUSE
The zone test uses > instead of >=.
VERIFIED REPAIR
Hyphenate when the slack is at least the zone.
Unsuccessful approach: Lowering the zone by one hyphenates inside the zone.
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 token[0].isupper())
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 = [[('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('regression: zone boundary', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['on', 'ly']], 11, 2, 6, 1, 2, False], ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only']), ('partial-repair probe', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy']], 9, 5, 5, 1, 2, False], ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['of'], ['the'], ['Mc', 'Don', 'ald'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['on', 'ly']], 8, 4, 4, 1, 2, False], ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['rag', 'ged'], ['of'], ['the'], ['Ber', 'lin'], ['of'], ['Ber', 'lin'], ['set'], ['a'], ['rag', 'ged'], ['of']], 15, 1, 7, 3, 2, False], ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of']), ('control layout', [[['Ber', 'lin'], ['Ber', 'lin'], ['a'], ['in', 'ter', 'na', 'tion', 'al']], 11, 3, 5, 1, 2, False], ['Berlin', 'Berlin a', 'interna-', 'tional']), ('control layout', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed']], 13, 3, 7, 3, 3, False], ['Berlin eBook-', 'ing ragged', 'hyphenated'])], [('regression: zone boundary', [[['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['of'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['the'], ['on', 'ly']], 16, 4, 5, 2, 3, False], ['typography hy-', 'phenated of rag-', 'ged hyphenated', 'eBooking eBook-', 'ing important', 'the only']), ('regression: zone boundary', [[['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['of'], ['im', 'por', 'tant'], ['set'], ['in', 'ter', 'na', 'tion', 'al']], 14, 5, 7, 1, 3, False], ['eBooking in-', 'ternational', 'eBooking', 'McDonald', 'ragged of', 'important set', 'international']), ('partial-repair probe', [[['on', 'ly'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['rag', 'ged'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['a']], 10, 4, 4, 1, 2, False], ['only', 'McDonald', 'ragged', 'typography', 'typography', 'ragged', 'Berlin', 'important', 'a']), ('partial-repair probe', [[['rag', 'ged'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 7, 1, 2, False], ['ragged', 'McDonald', 'only', 'typogra-', 'phy']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['of'], ['Ber', 'lin'], ['the']], 15, 3, 6, 1, 2, True], ['of Berlin e-', 'Booking impor-', 'tant of Berlin', 'the']), ('control layout', [[['ty', 'po', 'gra', 'phy'], ['set'], ['Mc', 'Don', 'ald'], ['the']], 15, 5, 4, 2, 3, True], ['typography set', 'McDonald the'])], [('regression: zone boundary', [[['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['of'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged']], 12, 3, 5, 1, 2, True], ['important', 'McDonald hy-', 'phenated of', 'hyphenated', 'ragged']), ('regression: zone boundary', [[['Mc', 'Don', 'ald'], ['rag', 'ged'], ['e', 'Book', 'ing'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['a'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy']], 11, 3, 6, 1, 2, False], ['McDonald', 'ragged e-', 'Booking ty-', 'pography', 'Berlin ty-', 'pography a', 'ragged ty-', 'pography']), ('partial-repair probe', [[['the'], ['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy']], 14, 4, 4, 2, 2, False], ['the interna-', 'tional only', 'hyphenated', 'international', 'international', 'typography', 'typography']), ('partial-repair probe', [[['rag', 'ged'], ['Ber', 'lin'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['set'], ['Ber', 'lin']], 12, 4, 4, 2, 3, True], ['ragged Ber-', 'lin only', 'hyphenated', 'set Berlin']), ('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', [[['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['Mc', 'Don', 'ald'], ['of'], ['on', 'ly'], ['e', 'Book', 'ing'], ['rag', 'ged']], 9, 5, 7, 2, 3, False], ['important', 'eBooking', 'interna-', 'tional', 'McDonald', 'of only', 'eBooking', 'ragged']), ('control layout', [[['e', 'Book', 'ing'], ['on', 'ly'], ['Ber', 'lin'], ['in', 'ter', 'na', 'tion', 'al'], ['Ber', 'lin'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing']], 14, 3, 6, 1, 2, True], ['eBooking only', 'Berlin inter-', 'national Ber-', 'lin hyphenated', 'eBooking'])], [('regression: zone boundary', [[['e', 'Book', 'ing'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['Mc', 'Don', 'ald'], ['of'], ['a'], ['on', 'ly']], 15, 4, 4, 1, 3, True], ['eBooking ragged', 'typography Mc-', 'Donald McDonald', 'of a only']), ('regression: zone boundary', [[['rag', 'ged'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['e', 'Book', 'ing'], ['on', 'ly']], 10, 3, 5, 2, 2, True], ['ragged', 'ragged in-', 'ternation-', 'al a im-', 'portant', 'hyphenated', 'ragged', 'eBooking', 'only']), ('regression: zone boundary', [[['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['the'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al'], ['a']], 14, 5, 5, 1, 2, True], ['typography', 'McDonald hy-', 'phenated the', 'important', 'eBooking Mc-', 'Donald the', 'international', 'a']), ('partial-repair probe', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy']], 9, 5, 5, 1, 2, False], ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing']], 10, 2, 7, 3, 3, False], ['of Berlin', 'eBooking', 'Berlin', 'McDonald', 'McDonald', 'Berlin', 'eBooking', 'McDonald', 'eBooking']), ('control layout', [[['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['the'], ['on', 'ly']], 14, 5, 6, 2, 2, True], ['hyphenated', 'important the', 'only'])], [('regression: zone boundary', [[['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['the'], ['hy', 'phen', 'at', 'ed'], ['the'], ['of'], ['on', 'ly'], ['set']], 9, 5, 5, 1, 2, False], ['McDonald', 'interna-', 'tional', 'ragged', 'the hy-', 'phenated', 'the of', 'only set']), ('regression: zone boundary', [[['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['im', 'por', 'tant'], ['the'], ['on', 'ly'], ['im', 'por', 'tant'], ['a'], ['Mc', 'Don', 'ald']], 15, 3, 5, 1, 3, False], ['hyphenated in-', 'ternational im-', 'portant the', 'only important', 'a McDonald']), ('partial-repair probe', [[['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['set'], ['set'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed']], 14, 5, 7, 2, 3, False], ['hyphenated', 'international', 'only set set', 'important', 'hyphenated']), ('partial-repair probe', [[['of'], ['rag', 'ged'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al']], 13, 4, 6, 1, 3, True], ['of ragged', 'McDonald the', 'international']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['set'], ['Ber', 'lin'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['the']], 14, 4, 7, 1, 3, True], ['set Berlin', 'Berlin eBook-', 'ing the']), ('control layout', [[['of'], ['rag', 'ged'], ['im', 'por', 'tant'], ['set'], ['ty', 'po', 'gra', 'phy']], 16, 1, 7, 1, 3, True], ['of ragged impor-', 'tant set typo-', 'graphy'])]]
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 |
|---|---|---|---|
| zone exactly met | ['the', 'typography'] | ['the typo-', 'graphy'] | Failed |
| regression: zone boundary | ['hyphenated', 'eBooking', 'only hy-', 'phenated', 'eBooking', 'only'] | ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only'] | Failed |
| partial-repair probe | ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy'] | ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy'] | Passed |
| partial-repair probe | ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only'] | ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only'] | Passed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| control layout | ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of'] | ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of'] | Passed |
| control layout | ['Berlin', 'Berlin a', 'interna-', 'tional'] | ['Berlin', 'Berlin a', 'interna-', 'tional'] | Passed |
| control layout | ['Berlin eBook-', 'ing ragged', 'hyphenated'] | ['Berlin eBook-', 'ing ragged', 'hyphenated'] | Passed |
SHA-256 / dbb66c162d84c09b91b1482fac97bc8dbb584e1ab0a35a98de29f1a572f25d7e
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 - 1 and len(token) >= min_word and (caps or not token[0].isupper())
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 = [[('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('regression: zone boundary', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['on', 'ly']], 11, 2, 6, 1, 2, False], ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only']), ('partial-repair probe', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy']], 9, 5, 5, 1, 2, False], ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['of'], ['the'], ['Mc', 'Don', 'ald'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['on', 'ly']], 8, 4, 4, 1, 2, False], ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['rag', 'ged'], ['of'], ['the'], ['Ber', 'lin'], ['of'], ['Ber', 'lin'], ['set'], ['a'], ['rag', 'ged'], ['of']], 15, 1, 7, 3, 2, False], ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of']), ('control layout', [[['Ber', 'lin'], ['Ber', 'lin'], ['a'], ['in', 'ter', 'na', 'tion', 'al']], 11, 3, 5, 1, 2, False], ['Berlin', 'Berlin a', 'interna-', 'tional']), ('control layout', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed']], 13, 3, 7, 3, 3, False], ['Berlin eBook-', 'ing ragged', 'hyphenated'])], [('regression: zone boundary', [[['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['of'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['the'], ['on', 'ly']], 16, 4, 5, 2, 3, False], ['typography hy-', 'phenated of rag-', 'ged hyphenated', 'eBooking eBook-', 'ing important', 'the only']), ('regression: zone boundary', [[['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['of'], ['im', 'por', 'tant'], ['set'], ['in', 'ter', 'na', 'tion', 'al']], 14, 5, 7, 1, 3, False], ['eBooking in-', 'ternational', 'eBooking', 'McDonald', 'ragged of', 'important set', 'international']), ('partial-repair probe', [[['on', 'ly'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['rag', 'ged'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['a']], 10, 4, 4, 1, 2, False], ['only', 'McDonald', 'ragged', 'typography', 'typography', 'ragged', 'Berlin', 'important', 'a']), ('partial-repair probe', [[['rag', 'ged'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 7, 1, 2, False], ['ragged', 'McDonald', 'only', 'typogra-', 'phy']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['of'], ['Ber', 'lin'], ['the']], 15, 3, 6, 1, 2, True], ['of Berlin e-', 'Booking impor-', 'tant of Berlin', 'the']), ('control layout', [[['ty', 'po', 'gra', 'phy'], ['set'], ['Mc', 'Don', 'ald'], ['the']], 15, 5, 4, 2, 3, True], ['typography set', 'McDonald the'])], [('regression: zone boundary', [[['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['of'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged']], 12, 3, 5, 1, 2, True], ['important', 'McDonald hy-', 'phenated of', 'hyphenated', 'ragged']), ('regression: zone boundary', [[['Mc', 'Don', 'ald'], ['rag', 'ged'], ['e', 'Book', 'ing'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['a'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy']], 11, 3, 6, 1, 2, False], ['McDonald', 'ragged e-', 'Booking ty-', 'pography', 'Berlin ty-', 'pography a', 'ragged ty-', 'pography']), ('partial-repair probe', [[['the'], ['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy']], 14, 4, 4, 2, 2, False], ['the interna-', 'tional only', 'hyphenated', 'international', 'international', 'typography', 'typography']), ('partial-repair probe', [[['rag', 'ged'], ['Ber', 'lin'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['set'], ['Ber', 'lin']], 12, 4, 4, 2, 3, True], ['ragged Ber-', 'lin only', 'hyphenated', 'set Berlin']), ('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', [[['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['Mc', 'Don', 'ald'], ['of'], ['on', 'ly'], ['e', 'Book', 'ing'], ['rag', 'ged']], 9, 5, 7, 2, 3, False], ['important', 'eBooking', 'interna-', 'tional', 'McDonald', 'of only', 'eBooking', 'ragged']), ('control layout', [[['e', 'Book', 'ing'], ['on', 'ly'], ['Ber', 'lin'], ['in', 'ter', 'na', 'tion', 'al'], ['Ber', 'lin'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing']], 14, 3, 6, 1, 2, True], ['eBooking only', 'Berlin inter-', 'national Ber-', 'lin hyphenated', 'eBooking'])], [('regression: zone boundary', [[['e', 'Book', 'ing'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['Mc', 'Don', 'ald'], ['of'], ['a'], ['on', 'ly']], 15, 4, 4, 1, 3, True], ['eBooking ragged', 'typography Mc-', 'Donald McDonald', 'of a only']), ('regression: zone boundary', [[['rag', 'ged'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['e', 'Book', 'ing'], ['on', 'ly']], 10, 3, 5, 2, 2, True], ['ragged', 'ragged in-', 'ternation-', 'al a im-', 'portant', 'hyphenated', 'ragged', 'eBooking', 'only']), ('regression: zone boundary', [[['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['the'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al'], ['a']], 14, 5, 5, 1, 2, True], ['typography', 'McDonald hy-', 'phenated the', 'important', 'eBooking Mc-', 'Donald the', 'international', 'a']), ('partial-repair probe', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy']], 9, 5, 5, 1, 2, False], ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing']], 10, 2, 7, 3, 3, False], ['of Berlin', 'eBooking', 'Berlin', 'McDonald', 'McDonald', 'Berlin', 'eBooking', 'McDonald', 'eBooking']), ('control layout', [[['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['the'], ['on', 'ly']], 14, 5, 6, 2, 2, True], ['hyphenated', 'important the', 'only'])], [('regression: zone boundary', [[['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['the'], ['hy', 'phen', 'at', 'ed'], ['the'], ['of'], ['on', 'ly'], ['set']], 9, 5, 5, 1, 2, False], ['McDonald', 'interna-', 'tional', 'ragged', 'the hy-', 'phenated', 'the of', 'only set']), ('regression: zone boundary', [[['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['im', 'por', 'tant'], ['the'], ['on', 'ly'], ['im', 'por', 'tant'], ['a'], ['Mc', 'Don', 'ald']], 15, 3, 5, 1, 3, False], ['hyphenated in-', 'ternational im-', 'portant the', 'only important', 'a McDonald']), ('partial-repair probe', [[['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['set'], ['set'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed']], 14, 5, 7, 2, 3, False], ['hyphenated', 'international', 'only set set', 'important', 'hyphenated']), ('partial-repair probe', [[['of'], ['rag', 'ged'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al']], 13, 4, 6, 1, 3, True], ['of ragged', 'McDonald the', 'international']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['set'], ['Ber', 'lin'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['the']], 14, 4, 7, 1, 3, True], ['set Berlin', 'Berlin eBook-', 'ing the']), ('control layout', [[['of'], ['rag', 'ged'], ['im', 'por', 'tant'], ['set'], ['ty', 'po', 'gra', 'phy']], 16, 1, 7, 1, 3, True], ['of ragged impor-', 'tant set typo-', 'graphy'])]]
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 |
|---|---|---|---|
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| regression: zone boundary | ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only'] | ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only'] | Passed |
| partial-repair probe | ['interna-', 'tional a', 'only in-', 'terna-', 'tional', 'typogra-', 'phy'] | ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy'] | Failed |
| partial-repair probe | ['McDonald', 'of the', 'McDonald', 'impor-', 'tant e-', 'Booking', 'hyphen-', 'ated on-', 'ly'] | ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only'] | Failed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| control layout | ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of'] | ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of'] | Passed |
| control layout | ['Berlin', 'Berlin a', 'interna-', 'tional'] | ['Berlin', 'Berlin a', 'interna-', 'tional'] | Passed |
| control layout | ['Berlin eBook-', 'ing ragged', 'hyphenated'] | ['Berlin eBook-', 'ing ragged', 'hyphenated'] | Passed |
SHA-256 / fa7a558869467fea0e78fd7c6a1ab32f62d14e784e0c873c6520b40b8dd4d783
3 / The verified repair
Exit 0"""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[0].isupper())
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 = [[('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('regression: zone boundary', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['on', 'ly']], 11, 2, 6, 1, 2, False], ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only']), ('partial-repair probe', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy']], 9, 5, 5, 1, 2, False], ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy']), ('partial-repair probe', [[['Mc', 'Don', 'ald'], ['of'], ['the'], ['Mc', 'Don', 'ald'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['on', 'ly']], 8, 4, 4, 1, 2, False], ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['rag', 'ged'], ['of'], ['the'], ['Ber', 'lin'], ['of'], ['Ber', 'lin'], ['set'], ['a'], ['rag', 'ged'], ['of']], 15, 1, 7, 3, 2, False], ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of']), ('control layout', [[['Ber', 'lin'], ['Ber', 'lin'], ['a'], ['in', 'ter', 'na', 'tion', 'al']], 11, 3, 5, 1, 2, False], ['Berlin', 'Berlin a', 'interna-', 'tional']), ('control layout', [[['Ber', 'lin'], ['e', 'Book', 'ing'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed']], 13, 3, 7, 3, 3, False], ['Berlin eBook-', 'ing ragged', 'hyphenated'])], [('regression: zone boundary', [[['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['of'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['the'], ['on', 'ly']], 16, 4, 5, 2, 3, False], ['typography hy-', 'phenated of rag-', 'ged hyphenated', 'eBooking eBook-', 'ing important', 'the only']), ('regression: zone boundary', [[['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['of'], ['im', 'por', 'tant'], ['set'], ['in', 'ter', 'na', 'tion', 'al']], 14, 5, 7, 1, 3, False], ['eBooking in-', 'ternational', 'eBooking', 'McDonald', 'ragged of', 'important set', 'international']), ('partial-repair probe', [[['on', 'ly'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['rag', 'ged'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['a']], 10, 4, 4, 1, 2, False], ['only', 'McDonald', 'ragged', 'typography', 'typography', 'ragged', 'Berlin', 'important', 'a']), ('partial-repair probe', [[['rag', 'ged'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 9, 5, 7, 1, 2, False], ['ragged', 'McDonald', 'only', 'typogra-', 'phy']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['of'], ['Ber', 'lin'], ['the']], 15, 3, 6, 1, 2, True], ['of Berlin e-', 'Booking impor-', 'tant of Berlin', 'the']), ('control layout', [[['ty', 'po', 'gra', 'phy'], ['set'], ['Mc', 'Don', 'ald'], ['the']], 15, 5, 4, 2, 3, True], ['typography set', 'McDonald the'])], [('regression: zone boundary', [[['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['of'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged']], 12, 3, 5, 1, 2, True], ['important', 'McDonald hy-', 'phenated of', 'hyphenated', 'ragged']), ('regression: zone boundary', [[['Mc', 'Don', 'ald'], ['rag', 'ged'], ['e', 'Book', 'ing'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['a'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy']], 11, 3, 6, 1, 2, False], ['McDonald', 'ragged e-', 'Booking ty-', 'pography', 'Berlin ty-', 'pography a', 'ragged ty-', 'pography']), ('partial-repair probe', [[['the'], ['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy']], 14, 4, 4, 2, 2, False], ['the interna-', 'tional only', 'hyphenated', 'international', 'international', 'typography', 'typography']), ('partial-repair probe', [[['rag', 'ged'], ['Ber', 'lin'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['set'], ['Ber', 'lin']], 12, 4, 4, 2, 3, True], ['ragged Ber-', 'lin only', 'hyphenated', 'set Berlin']), ('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', [[['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['Mc', 'Don', 'ald'], ['of'], ['on', 'ly'], ['e', 'Book', 'ing'], ['rag', 'ged']], 9, 5, 7, 2, 3, False], ['important', 'eBooking', 'interna-', 'tional', 'McDonald', 'of only', 'eBooking', 'ragged']), ('control layout', [[['e', 'Book', 'ing'], ['on', 'ly'], ['Ber', 'lin'], ['in', 'ter', 'na', 'tion', 'al'], ['Ber', 'lin'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing']], 14, 3, 6, 1, 2, True], ['eBooking only', 'Berlin inter-', 'national Ber-', 'lin hyphenated', 'eBooking'])], [('regression: zone boundary', [[['e', 'Book', 'ing'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['Mc', 'Don', 'ald'], ['of'], ['a'], ['on', 'ly']], 15, 4, 4, 1, 3, True], ['eBooking ragged', 'typography Mc-', 'Donald McDonald', 'of a only']), ('regression: zone boundary', [[['rag', 'ged'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged'], ['e', 'Book', 'ing'], ['on', 'ly']], 10, 3, 5, 2, 2, True], ['ragged', 'ragged in-', 'ternation-', 'al a im-', 'portant', 'hyphenated', 'ragged', 'eBooking', 'only']), ('regression: zone boundary', [[['ty', 'po', 'gra', 'phy'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['the'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al'], ['a']], 14, 5, 5, 1, 2, True], ['typography', 'McDonald hy-', 'phenated the', 'important', 'eBooking Mc-', 'Donald the', 'international', 'a']), ('partial-repair probe', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['ty', 'po', 'gra', 'phy']], 9, 5, 5, 1, 2, False], ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['of'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing']], 10, 2, 7, 3, 3, False], ['of Berlin', 'eBooking', 'Berlin', 'McDonald', 'McDonald', 'Berlin', 'eBooking', 'McDonald', 'eBooking']), ('control layout', [[['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['the'], ['on', 'ly']], 14, 5, 6, 2, 2, True], ['hyphenated', 'important the', 'only'])], [('regression: zone boundary', [[['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged'], ['the'], ['hy', 'phen', 'at', 'ed'], ['the'], ['of'], ['on', 'ly'], ['set']], 9, 5, 5, 1, 2, False], ['McDonald', 'interna-', 'tional', 'ragged', 'the hy-', 'phenated', 'the of', 'only set']), ('regression: zone boundary', [[['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['im', 'por', 'tant'], ['the'], ['on', 'ly'], ['im', 'por', 'tant'], ['a'], ['Mc', 'Don', 'ald']], 15, 3, 5, 1, 3, False], ['hyphenated in-', 'ternational im-', 'portant the', 'only important', 'a McDonald']), ('partial-repair probe', [[['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['set'], ['set'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed']], 14, 5, 7, 2, 3, False], ['hyphenated', 'international', 'only set set', 'important', 'hyphenated']), ('partial-repair probe', [[['of'], ['rag', 'ged'], ['Mc', 'Don', 'ald'], ['the'], ['in', 'ter', 'na', 'tion', 'al']], 13, 4, 6, 1, 3, True], ['of ragged', 'McDonald the', 'international']), ('zone exactly met', [[['the'], ['ty', 'po', 'gra', 'phy']], 10, 6, 4, 2, 2, False], ['the typo-', 'graphy']), ('capitalised word protected', [[['the'], ['Mc', 'Don', 'ald']], 10, 2, 4, 2, 2, False], ['the', 'McDonald']), ('control layout', [[['set'], ['Ber', 'lin'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['the']], 14, 4, 7, 1, 3, True], ['set Berlin', 'Berlin eBook-', 'ing the']), ('control layout', [[['of'], ['rag', 'ged'], ['im', 'por', 'tant'], ['set'], ['ty', 'po', 'gra', 'phy']], 16, 1, 7, 1, 3, True], ['of ragged impor-', 'tant set typo-', 'graphy'])]]
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 |
|---|---|---|---|
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| regression: zone boundary | ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only'] | ['hyphenated', 'eBooking', 'only hy-', 'phenated e-', 'Booking', 'only'] | Passed |
| partial-repair probe | ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy'] | ['interna-', 'tional a', 'only', 'interna-', 'tional', 'typogra-', 'phy'] | Passed |
| partial-repair probe | ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only'] | ['McDonald', 'of the', 'McDonald', 'impor-', 'tant', 'eBooking', 'hyphen-', 'ated', 'only'] | Passed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| control layout | ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of'] | ['ragged of the', 'Berlin of', 'Berlin set a', 'ragged of'] | Passed |
| control layout | ['Berlin', 'Berlin a', 'interna-', 'tional'] | ['Berlin', 'Berlin a', 'interna-', 'tional'] | Passed |
| control layout | ['Berlin eBook-', 'ing ragged', 'hyphenated'] | ['Berlin eBook-', 'ing ragged', 'hyphenated'] | Passed |
SHA-256 / 7b80356efb5b202d817c4424749ad9d0810f8278df9b064f40019824a4ce1f1e
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.644111+00:00.
Case digest / 8938d94377c177f289283e07b2157741ea18fa943fcf978f833a26e9461bbb29