FA-80236 / Typography line breaking / Open access
Ragged-right hyphenation zone: hyphenated head fit · case 01
Hyphenated lines overrun the measure.
ROOT CAUSE
The head fit test omits the hyphen glyph.
VERIFIED REPAIR
Count the hyphen when fitting the head.
Unsuccessful approach: Counting the hyphen only on empty lines still overruns lines with text.
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) if not cur else len(cur) + len(head) + 1
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: hyphenated head fit', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['set']], 11, 3, 7, 3, 2, True], ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set']), ('regression: hyphenated head fit', [[['e', 'Book', 'ing'], ['a'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['on', 'ly'], ['on', 'ly'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy']], 9, 3, 6, 2, 3, False], ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography']), ('regression: hyphenated head fit', [[['im', 'por', 'tant'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['im', 'por', 'tant']], 15, 2, 6, 1, 3, True], ['important im-', 'portant impor-', 'tant important']), ('regression: hyphenated head fit', [[['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['of'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged']], 14, 2, 7, 3, 3, False], ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged']), ('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', [[['the'], ['rag', 'ged'], ['set'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['rag', 'ged']], 10, 3, 5, 3, 2, True], ['the ragged', 'set Berlin', 'McDonald', 'ragged']), ('control layout', [[['Ber', 'lin'], ['Ber', 'lin'], ['the'], ['Mc', 'Don', 'ald']], 14, 5, 4, 3, 3, True], ['Berlin Berlin', 'the McDonald'])], [('regression: hyphenated head fit', [[['e', 'Book', 'ing'], ['on', 'ly'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al']], 15, 2, 6, 1, 2, True], ['eBooking only', 'important im-', 'portant hyphen-', 'ated important', 'eBooking impor-', 'tant interna-', 'tional']), ('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['a']], 15, 4, 7, 1, 2, True], ['McDonald inter-', 'national the', 'important im-', 'portant a']), ('regression: hyphenated head fit', [[['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['a']], 15, 1, 4, 1, 3, True], ['important e-', 'Booking McDon-', 'ald a']), ('regression: hyphenated head fit', [[['set'], ['Mc', 'Don', 'ald'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['a'], ['e', 'Book', 'ing'], ['im', 'por', 'tant']], 9, 1, 7, 1, 2, True], ['set Mc-', 'Donald', 'typogra-', 'phy typo-', 'graphy', 'Berlin a', 'eBooking', 'important']), ('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', [[['hy', 'phen', 'at', 'ed'], ['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['im', 'por', 'tant'], ['the'], ['Ber', 'lin'], ['set'], ['a']], 13, 2, 6, 3, 2, False], ['hyphenated', 'hyphenated', 'international', 'a important', 'the Berlin', 'set a']), ('control layout', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['set'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['set'], ['Ber', 'lin']], 12, 4, 4, 3, 3, False], ['hyphenated', 'eBooking', 'important', 'McDonald', 'hyphenated', 'set only', 'typography', 'set Berlin'])], [('regression: hyphenated head fit', [[['Ber', 'lin'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['on', 'ly'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed'], ['set'], ['Ber', 'lin'], ['the']], 11, 3, 5, 2, 2, True], ['Berlin rag-', 'ged typo-', 'graphy only', 'ragged hy-', 'phenated', 'set Berlin', 'the']), ('regression: hyphenated head fit', [[['set'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['the'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['a'], ['in', 'ter', 'na', 'tion', 'al']], 15, 1, 6, 2, 2, False], ['set eBooking', 'Berlin the ty-', 'pography hy-', 'phenated a in-', 'ternational']), ('regression: hyphenated head fit', [[['a'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['a'], ['im', 'por', 'tant']], 14, 5, 7, 2, 2, False], ['a Berlin im-', 'portant typo-', 'graphy eBook-', 'ing Berlin a', 'important']), ('regression: hyphenated head fit', [[['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['the'], ['e', 'Book', 'ing'], ['a'], ['e', 'Book', 'ing'], ['ty', 'po', 'gra', 'phy'], ['of'], ['the']], 9, 4, 7, 3, 3, True], ['Berlin', 'McDonald', 'the', 'eBooking', 'a eBook-', 'ing typo-', 'graphy of', 'the']), ('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', [[['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['the'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 11, 3, 4, 2, 3, True], ['eBooking', 'McDonald', 'eBooking', 'the only', 'typography']), ('control layout', [[['Mc', 'Don', 'ald'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['Ber', 'lin'], ['the'], ['of']], 16, 3, 4, 2, 2, False], ['McDonald only', 'hyphenated', 'Berlin the of'])], [('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy']], 9, 4, 6, 2, 3, False], ['McDonald', 'Berlin', 'McDonald', 'eBooking', 'only ty-', 'pography', 'typogra-', 'phy rag-', 'ged typo-', 'graphy']), ('regression: hyphenated head fit', [[['of'], ['im', 'por', 'tant'], ['of'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['the'], ['hy', 'phen', 'at', 'ed'], ['a']], 12, 4, 7, 3, 2, True], ['of important', 'of only', 'hyphenated', 'the hyphen-', 'ated a']), ('regression: hyphenated head fit', [[['Ber', 'lin'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin']], 11, 4, 5, 1, 3, True], ['Berlin only', 'interna-', 'tional a', 'only typo-', 'graphy ty-', 'pography', 'Berlin']), ('regression: hyphenated head fit', [[['a'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['a']], 8, 2, 7, 2, 3, False], ['a hy-', 'phenated', 'eBooking', 'interna-', 'tional', 'the', 'Berlin', 'eBooking', 'hyphen-', 'ated a']), ('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', [[['Mc', 'Don', 'ald'], ['a'], ['Mc', 'Don', 'ald'], ['of']], 9, 3, 6, 3, 2, True], ['McDonald', 'a McDon-', 'ald of']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['a'], ['Mc', 'Don', 'ald']], 10, 1, 6, 2, 3, False], ['interna-', 'tional', 'only a', 'McDonald'])], [('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['set']], 12, 2, 4, 2, 2, False], ['McDonald a', 'of McDonald', 'ragged in-', 'ternational', 'important', 'hyphenated', 'set']), ('regression: hyphenated head fit', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged']], 10, 3, 5, 3, 3, True], ['hyphenated', 'eBooking', 'interna-', 'tional', 'ragged']), ('regression: hyphenated head fit', [[['on', 'ly'], ['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['the'], ['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['in', 'ter', 'na', 'tion', 'al']], 15, 4, 5, 1, 2, True], ['only important', 'McDonald the', 'Berlin typogra-', 'phy interna-', 'tional']), ('regression: hyphenated head fit', [[['hy', 'phen', 'at', 'ed'], ['the'], ['Ber', 'lin'], ['of'], ['im', 'por', 'tant'], ['of'], ['a'], ['set']], 8, 1, 5, 1, 2, True], ['hyphen-', 'ated the', 'Berlin', 'of im-', 'portant', 'of a 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', [[['set'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['e', 'Book', 'ing']], 13, 5, 7, 1, 2, True], ['set typogra-', 'phy Berlin', 'McDonald only', 'international', 'eBooking']), ('control layout', [[['set'], ['Ber', 'lin'], ['set'], ['a']], 14, 5, 5, 2, 2, True], ['set Berlin set', 'a'])]]
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: hyphenated head fit | ['internation-', 'al a Berlin', 'McDonald', 'eBooking', 'set'] | ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set'] | Failed |
| regression: hyphenated head fit | ['eBooking', 'a hyphen-', 'ated typo-', 'graphy', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated typo-', 'graphy'] | ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography'] | Failed |
| regression: hyphenated head fit | ['important impor-', 'tant important', 'important'] | ['important im-', 'portant impor-', 'tant important'] | Failed |
| regression: hyphenated head fit | ['only interna-', 'tional interna-', 'tional of', 'international', 'hyphenated', 'ragged'] | ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged'] | Failed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| control layout | ['the ragged', 'set Berlin', 'McDonald', 'ragged'] | ['the ragged', 'set Berlin', 'McDonald', 'ragged'] | Passed |
| control layout | ['Berlin Berlin', 'the McDonald'] | ['Berlin Berlin', 'the McDonald'] | Passed |
SHA-256 / cab02890fe92e563462eda6b0345ee3bbeb31e5bec0ebbfab28a7f005abc1cb0
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[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) + 1
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: hyphenated head fit', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['set']], 11, 3, 7, 3, 2, True], ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set']), ('regression: hyphenated head fit', [[['e', 'Book', 'ing'], ['a'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['on', 'ly'], ['on', 'ly'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy']], 9, 3, 6, 2, 3, False], ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography']), ('regression: hyphenated head fit', [[['im', 'por', 'tant'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['im', 'por', 'tant']], 15, 2, 6, 1, 3, True], ['important im-', 'portant impor-', 'tant important']), ('regression: hyphenated head fit', [[['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['of'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged']], 14, 2, 7, 3, 3, False], ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged']), ('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', [[['the'], ['rag', 'ged'], ['set'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['rag', 'ged']], 10, 3, 5, 3, 2, True], ['the ragged', 'set Berlin', 'McDonald', 'ragged']), ('control layout', [[['Ber', 'lin'], ['Ber', 'lin'], ['the'], ['Mc', 'Don', 'ald']], 14, 5, 4, 3, 3, True], ['Berlin Berlin', 'the McDonald'])], [('regression: hyphenated head fit', [[['e', 'Book', 'ing'], ['on', 'ly'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al']], 15, 2, 6, 1, 2, True], ['eBooking only', 'important im-', 'portant hyphen-', 'ated important', 'eBooking impor-', 'tant interna-', 'tional']), ('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['a']], 15, 4, 7, 1, 2, True], ['McDonald inter-', 'national the', 'important im-', 'portant a']), ('regression: hyphenated head fit', [[['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['a']], 15, 1, 4, 1, 3, True], ['important e-', 'Booking McDon-', 'ald a']), ('regression: hyphenated head fit', [[['set'], ['Mc', 'Don', 'ald'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['a'], ['e', 'Book', 'ing'], ['im', 'por', 'tant']], 9, 1, 7, 1, 2, True], ['set Mc-', 'Donald', 'typogra-', 'phy typo-', 'graphy', 'Berlin a', 'eBooking', 'important']), ('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', [[['hy', 'phen', 'at', 'ed'], ['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['im', 'por', 'tant'], ['the'], ['Ber', 'lin'], ['set'], ['a']], 13, 2, 6, 3, 2, False], ['hyphenated', 'hyphenated', 'international', 'a important', 'the Berlin', 'set a']), ('control layout', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['set'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['set'], ['Ber', 'lin']], 12, 4, 4, 3, 3, False], ['hyphenated', 'eBooking', 'important', 'McDonald', 'hyphenated', 'set only', 'typography', 'set Berlin'])], [('regression: hyphenated head fit', [[['Ber', 'lin'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['on', 'ly'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed'], ['set'], ['Ber', 'lin'], ['the']], 11, 3, 5, 2, 2, True], ['Berlin rag-', 'ged typo-', 'graphy only', 'ragged hy-', 'phenated', 'set Berlin', 'the']), ('regression: hyphenated head fit', [[['set'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['the'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['a'], ['in', 'ter', 'na', 'tion', 'al']], 15, 1, 6, 2, 2, False], ['set eBooking', 'Berlin the ty-', 'pography hy-', 'phenated a in-', 'ternational']), ('regression: hyphenated head fit', [[['a'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['a'], ['im', 'por', 'tant']], 14, 5, 7, 2, 2, False], ['a Berlin im-', 'portant typo-', 'graphy eBook-', 'ing Berlin a', 'important']), ('regression: hyphenated head fit', [[['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['the'], ['e', 'Book', 'ing'], ['a'], ['e', 'Book', 'ing'], ['ty', 'po', 'gra', 'phy'], ['of'], ['the']], 9, 4, 7, 3, 3, True], ['Berlin', 'McDonald', 'the', 'eBooking', 'a eBook-', 'ing typo-', 'graphy of', 'the']), ('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', [[['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['the'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 11, 3, 4, 2, 3, True], ['eBooking', 'McDonald', 'eBooking', 'the only', 'typography']), ('control layout', [[['Mc', 'Don', 'ald'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['Ber', 'lin'], ['the'], ['of']], 16, 3, 4, 2, 2, False], ['McDonald only', 'hyphenated', 'Berlin the of'])], [('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy']], 9, 4, 6, 2, 3, False], ['McDonald', 'Berlin', 'McDonald', 'eBooking', 'only ty-', 'pography', 'typogra-', 'phy rag-', 'ged typo-', 'graphy']), ('regression: hyphenated head fit', [[['of'], ['im', 'por', 'tant'], ['of'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['the'], ['hy', 'phen', 'at', 'ed'], ['a']], 12, 4, 7, 3, 2, True], ['of important', 'of only', 'hyphenated', 'the hyphen-', 'ated a']), ('regression: hyphenated head fit', [[['Ber', 'lin'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin']], 11, 4, 5, 1, 3, True], ['Berlin only', 'interna-', 'tional a', 'only typo-', 'graphy ty-', 'pography', 'Berlin']), ('regression: hyphenated head fit', [[['a'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['a']], 8, 2, 7, 2, 3, False], ['a hy-', 'phenated', 'eBooking', 'interna-', 'tional', 'the', 'Berlin', 'eBooking', 'hyphen-', 'ated a']), ('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', [[['Mc', 'Don', 'ald'], ['a'], ['Mc', 'Don', 'ald'], ['of']], 9, 3, 6, 3, 2, True], ['McDonald', 'a McDon-', 'ald of']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['a'], ['Mc', 'Don', 'ald']], 10, 1, 6, 2, 3, False], ['interna-', 'tional', 'only a', 'McDonald'])], [('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['set']], 12, 2, 4, 2, 2, False], ['McDonald a', 'of McDonald', 'ragged in-', 'ternational', 'important', 'hyphenated', 'set']), ('regression: hyphenated head fit', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged']], 10, 3, 5, 3, 3, True], ['hyphenated', 'eBooking', 'interna-', 'tional', 'ragged']), ('regression: hyphenated head fit', [[['on', 'ly'], ['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['the'], ['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['in', 'ter', 'na', 'tion', 'al']], 15, 4, 5, 1, 2, True], ['only important', 'McDonald the', 'Berlin typogra-', 'phy interna-', 'tional']), ('regression: hyphenated head fit', [[['hy', 'phen', 'at', 'ed'], ['the'], ['Ber', 'lin'], ['of'], ['im', 'por', 'tant'], ['of'], ['a'], ['set']], 8, 1, 5, 1, 2, True], ['hyphen-', 'ated the', 'Berlin', 'of im-', 'portant', 'of a 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', [[['set'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['e', 'Book', 'ing']], 13, 5, 7, 1, 2, True], ['set typogra-', 'phy Berlin', 'McDonald only', 'international', 'eBooking']), ('control layout', [[['set'], ['Ber', 'lin'], ['set'], ['a']], 14, 5, 5, 2, 2, True], ['set Berlin set', 'a'])]]
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: hyphenated head fit | ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set'] | ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set'] | Passed |
| regression: hyphenated head fit | ['eBooking', 'a hyphen-', 'ated typo-', 'graphy', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated typo-', 'graphy'] | ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography'] | Failed |
| regression: hyphenated head fit | ['important impor-', 'tant important', 'important'] | ['important im-', 'portant impor-', 'tant important'] | Failed |
| regression: hyphenated head fit | ['only interna-', 'tional interna-', 'tional of', 'international', 'hyphenated', 'ragged'] | ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged'] | Failed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| control layout | ['the ragged', 'set Berlin', 'McDonald', 'ragged'] | ['the ragged', 'set Berlin', 'McDonald', 'ragged'] | Passed |
| control layout | ['Berlin Berlin', 'the McDonald'] | ['Berlin Berlin', 'the McDonald'] | Passed |
SHA-256 / 8800778e6340f875e26b0bb89d63465529dcb7e56872fe4378b852d9b801b33e
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 = [[('regression: hyphenated head fit', [[['in', 'ter', 'na', 'tion', 'al'], ['a'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['set']], 11, 3, 7, 3, 2, True], ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set']), ('regression: hyphenated head fit', [[['e', 'Book', 'ing'], ['a'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['on', 'ly'], ['on', 'ly'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['ty', 'po', 'gra', 'phy']], 9, 3, 6, 2, 3, False], ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography']), ('regression: hyphenated head fit', [[['im', 'por', 'tant'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['im', 'por', 'tant']], 15, 2, 6, 1, 3, True], ['important im-', 'portant impor-', 'tant important']), ('regression: hyphenated head fit', [[['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['in', 'ter', 'na', 'tion', 'al'], ['of'], ['in', 'ter', 'na', 'tion', 'al'], ['hy', 'phen', 'at', 'ed'], ['rag', 'ged']], 14, 2, 7, 3, 3, False], ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged']), ('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', [[['the'], ['rag', 'ged'], ['set'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['rag', 'ged']], 10, 3, 5, 3, 2, True], ['the ragged', 'set Berlin', 'McDonald', 'ragged']), ('control layout', [[['Ber', 'lin'], ['Ber', 'lin'], ['the'], ['Mc', 'Don', 'ald']], 14, 5, 4, 3, 3, True], ['Berlin Berlin', 'the McDonald'])], [('regression: hyphenated head fit', [[['e', 'Book', 'ing'], ['on', 'ly'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['in', 'ter', 'na', 'tion', 'al']], 15, 2, 6, 1, 2, True], ['eBooking only', 'important im-', 'portant hyphen-', 'ated important', 'eBooking impor-', 'tant interna-', 'tional']), ('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['im', 'por', 'tant'], ['im', 'por', 'tant'], ['a']], 15, 4, 7, 1, 2, True], ['McDonald inter-', 'national the', 'important im-', 'portant a']), ('regression: hyphenated head fit', [[['im', 'por', 'tant'], ['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['a']], 15, 1, 4, 1, 3, True], ['important e-', 'Booking McDon-', 'ald a']), ('regression: hyphenated head fit', [[['set'], ['Mc', 'Don', 'ald'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['a'], ['e', 'Book', 'ing'], ['im', 'por', 'tant']], 9, 1, 7, 1, 2, True], ['set Mc-', 'Donald', 'typogra-', 'phy typo-', 'graphy', 'Berlin a', 'eBooking', 'important']), ('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', [[['hy', 'phen', 'at', 'ed'], ['hy', 'phen', 'at', 'ed'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['im', 'por', 'tant'], ['the'], ['Ber', 'lin'], ['set'], ['a']], 13, 2, 6, 3, 2, False], ['hyphenated', 'hyphenated', 'international', 'a important', 'the Berlin', 'set a']), ('control layout', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['hy', 'phen', 'at', 'ed'], ['set'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['set'], ['Ber', 'lin']], 12, 4, 4, 3, 3, False], ['hyphenated', 'eBooking', 'important', 'McDonald', 'hyphenated', 'set only', 'typography', 'set Berlin'])], [('regression: hyphenated head fit', [[['Ber', 'lin'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy'], ['on', 'ly'], ['rag', 'ged'], ['hy', 'phen', 'at', 'ed'], ['set'], ['Ber', 'lin'], ['the']], 11, 3, 5, 2, 2, True], ['Berlin rag-', 'ged typo-', 'graphy only', 'ragged hy-', 'phenated', 'set Berlin', 'the']), ('regression: hyphenated head fit', [[['set'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['the'], ['ty', 'po', 'gra', 'phy'], ['hy', 'phen', 'at', 'ed'], ['a'], ['in', 'ter', 'na', 'tion', 'al']], 15, 1, 6, 2, 2, False], ['set eBooking', 'Berlin the ty-', 'pography hy-', 'phenated a in-', 'ternational']), ('regression: hyphenated head fit', [[['a'], ['Ber', 'lin'], ['im', 'por', 'tant'], ['ty', 'po', 'gra', 'phy'], ['e', 'Book', 'ing'], ['Ber', 'lin'], ['a'], ['im', 'por', 'tant']], 14, 5, 7, 2, 2, False], ['a Berlin im-', 'portant typo-', 'graphy eBook-', 'ing Berlin a', 'important']), ('regression: hyphenated head fit', [[['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['the'], ['e', 'Book', 'ing'], ['a'], ['e', 'Book', 'ing'], ['ty', 'po', 'gra', 'phy'], ['of'], ['the']], 9, 4, 7, 3, 3, True], ['Berlin', 'McDonald', 'the', 'eBooking', 'a eBook-', 'ing typo-', 'graphy of', 'the']), ('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', [[['e', 'Book', 'ing'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['the'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy']], 11, 3, 4, 2, 3, True], ['eBooking', 'McDonald', 'eBooking', 'the only', 'typography']), ('control layout', [[['Mc', 'Don', 'ald'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['Ber', 'lin'], ['the'], ['of']], 16, 3, 4, 2, 2, False], ['McDonald only', 'hyphenated', 'Berlin the of'])], [('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['e', 'Book', 'ing'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['rag', 'ged'], ['ty', 'po', 'gra', 'phy']], 9, 4, 6, 2, 3, False], ['McDonald', 'Berlin', 'McDonald', 'eBooking', 'only ty-', 'pography', 'typogra-', 'phy rag-', 'ged typo-', 'graphy']), ('regression: hyphenated head fit', [[['of'], ['im', 'por', 'tant'], ['of'], ['on', 'ly'], ['hy', 'phen', 'at', 'ed'], ['the'], ['hy', 'phen', 'at', 'ed'], ['a']], 12, 4, 7, 3, 2, True], ['of important', 'of only', 'hyphenated', 'the hyphen-', 'ated a']), ('regression: hyphenated head fit', [[['Ber', 'lin'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['a'], ['on', 'ly'], ['ty', 'po', 'gra', 'phy'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin']], 11, 4, 5, 1, 3, True], ['Berlin only', 'interna-', 'tional a', 'only typo-', 'graphy ty-', 'pography', 'Berlin']), ('regression: hyphenated head fit', [[['a'], ['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['the'], ['Ber', 'lin'], ['e', 'Book', 'ing'], ['hy', 'phen', 'at', 'ed'], ['a']], 8, 2, 7, 2, 3, False], ['a hy-', 'phenated', 'eBooking', 'interna-', 'tional', 'the', 'Berlin', 'eBooking', 'hyphen-', 'ated a']), ('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', [[['Mc', 'Don', 'ald'], ['a'], ['Mc', 'Don', 'ald'], ['of']], 9, 3, 6, 3, 2, True], ['McDonald', 'a McDon-', 'ald of']), ('control layout', [[['in', 'ter', 'na', 'tion', 'al'], ['on', 'ly'], ['a'], ['Mc', 'Don', 'ald']], 10, 1, 6, 2, 3, False], ['interna-', 'tional', 'only a', 'McDonald'])], [('regression: hyphenated head fit', [[['Mc', 'Don', 'ald'], ['a'], ['of'], ['Mc', 'Don', 'ald'], ['rag', 'ged'], ['in', 'ter', 'na', 'tion', 'al'], ['im', 'por', 'tant'], ['hy', 'phen', 'at', 'ed'], ['set']], 12, 2, 4, 2, 2, False], ['McDonald a', 'of McDonald', 'ragged in-', 'ternational', 'important', 'hyphenated', 'set']), ('regression: hyphenated head fit', [[['hy', 'phen', 'at', 'ed'], ['e', 'Book', 'ing'], ['in', 'ter', 'na', 'tion', 'al'], ['rag', 'ged']], 10, 3, 5, 3, 3, True], ['hyphenated', 'eBooking', 'interna-', 'tional', 'ragged']), ('regression: hyphenated head fit', [[['on', 'ly'], ['im', 'por', 'tant'], ['Mc', 'Don', 'ald'], ['the'], ['Ber', 'lin'], ['ty', 'po', 'gra', 'phy'], ['in', 'ter', 'na', 'tion', 'al']], 15, 4, 5, 1, 2, True], ['only important', 'McDonald the', 'Berlin typogra-', 'phy interna-', 'tional']), ('regression: hyphenated head fit', [[['hy', 'phen', 'at', 'ed'], ['the'], ['Ber', 'lin'], ['of'], ['im', 'por', 'tant'], ['of'], ['a'], ['set']], 8, 1, 5, 1, 2, True], ['hyphen-', 'ated the', 'Berlin', 'of im-', 'portant', 'of a 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', [[['set'], ['ty', 'po', 'gra', 'phy'], ['Ber', 'lin'], ['Mc', 'Don', 'ald'], ['on', 'ly'], ['in', 'ter', 'na', 'tion', 'al'], ['e', 'Book', 'ing']], 13, 5, 7, 1, 2, True], ['set typogra-', 'phy Berlin', 'McDonald only', 'international', 'eBooking']), ('control layout', [[['set'], ['Ber', 'lin'], ['set'], ['a']], 14, 5, 5, 2, 2, True], ['set Berlin set', 'a'])]]
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: hyphenated head fit | ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set'] | ['interna-', 'tional a', 'Berlin', 'McDonald', 'eBooking', 'set'] | Passed |
| regression: hyphenated head fit | ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography'] | ['eBooking', 'a hyphen-', 'ated ty-', 'pography', 'hyphen-', 'ated only', 'only', 'eBooking', 'hyphen-', 'ated ty-', 'pography'] | Passed |
| regression: hyphenated head fit | ['important im-', 'portant impor-', 'tant important'] | ['important im-', 'portant impor-', 'tant important'] | Passed |
| regression: hyphenated head fit | ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged'] | ['only interna-', 'tional inter-', 'national of', 'international', 'hyphenated', 'ragged'] | Passed |
| capitalised word protected | ['the', 'McDonald'] | ['the', 'McDonald'] | Passed |
| zone exactly met | ['the typo-', 'graphy'] | ['the typo-', 'graphy'] | Passed |
| control layout | ['the ragged', 'set Berlin', 'McDonald', 'ragged'] | ['the ragged', 'set Berlin', 'McDonald', 'ragged'] | Passed |
| control layout | ['Berlin Berlin', 'the McDonald'] | ['Berlin Berlin', 'the McDonald'] | Passed |
SHA-256 / 57510905eacb6c302c86934a1343eace21325c447c8ecbb96e8396ba97ca413a
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:52.159098+00:00.
Case digest / 0461c0f5d44af35149a4a8cfed298f27901e7e85fd7ba4c4d34396eb2599d4bd