FAILURE MAP
← Case archive

FA-79936 / Typography line breaking / Open access

Pattern-based hyphenation: exception lookup case · case 01

Capitalised words ignore their hyphenation exceptions.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Exceptions are compared with the original-case word instead of its lowercase form.

THE FAILURE

Exceptions are compared with the original-case word instead of its lowercase form.

Unsuccessful approach: Comparing the hyphenated exception text directly never matches.

Case contract

Input [word, patterns, exceptions, lefthyphenmin, righthyphenmin]. An exception (hyphenated, lowercase) matching the lowercased word dictates the hyphens and keeps the word's own letters. Otherwise the lowercased word is padded with dots, every substring pattern contributes its digits and the maximum digit per gap wins; odd values allow a hyphen. A hyphen before letter i needs i>=lefthyphenmin and len-i>=righthyphenmin. Return the word with "-" inserted.

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):
    word, patterns, exceptions, lmin, rmin = x
    low = word.lower()
    for e in exceptions:
        if e.replace('-', '') == word:
            out, count = '', 0
            for c in e:
                if c == '-':
                    out += '-'
                else:
                    out += word[count]
                    count += 1
            return out
    table = {}
    for p in patterns:
        letters = ''
        vals = [0]
        for c in p:
            if c.isdigit():
                vals[-1] = int(c)
            else:
                letters += c
                vals.append(0)
        table[letters] = vals
    dotted = '.' + low + '.'
    score = [0] * (len(dotted) + 1)
    for s in range(len(dotted)):
        for e in range(s + 1, len(dotted) + 1):
            vals = table.get(dotted[s:e])
            if vals:
                for k, v in enumerate(vals):
                    score[s + k] = max(score[s + k], v)
    points = [i for i in range(1, len(word)) if score[i + 1] % 2 == 1 and i >= lmin and len(word) - i >= rmin]
    out = ''
    for i, c in enumerate(word):
        if i in points:
            out += '-'
        out += c
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('partial-repair probe', ['grammar', ['io3n.', 'n1g', '3ty.', 'm1m', 'gr2', 'a1b', 'e2x', 'pu2', 'n2at', 'r1r', '1ca', 'ca1t', '1tio', 't1t', 'o2n', '1m', '.un1', 'con1', 'om1', '5nd.', 'p2h', 'ment1', 'hena4', 'hy3ph', '.ta4', 'e1c', '.re1', 'li1', 'a2n', 'b2l', '1ble'], ['pro-ject', 'gram-mar', 'ta-ble'], 1, 3], 'gram-mar'), ('regression: exception lookup case', ['Mississippi', ['5nd.', '4ing.', 'om1', '2mp', 'r1r', 'n2at', '2io', '1ca'], ['mis-sis-sip-pi'], 3, 2], 'Mis-sis-sip-pi'), ('word-final pattern ing.', ['running', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 2], 'running'), ('left minimum boundary', ['excellent', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 3], 'ex-cel-lent'), ('control layout', ['Commitment', ['.un1', '4ing.', 's1s', 'io3n.', 'pu2', 'c2ce', '1ca', '1tio', '1ble', 'he2n', 't1t', '1m', '5nd.', '2mp', 'b2l', 'an1d', 'a2n', 'li1', 'at1', 'ca1t', '.ta4', '1q', '2io', 'om1', 'ment1', 'a1b', 'hy3ph', '1na', 'r1r', '3ty.', '1p', 'm1m', 'e1c', 'hena4', 'p2h', 'n2at', 'o2n', 'con1', '.re1'], ['ex-cep-tion', 'ta-ble'], 2, 1], 'Co-m-mit-ment'), ('control layout', ['Paragraph', ['e1c', 'at1', 'ment1', 'gr2', 'a1b', 's1s', 't1t', 'hen5at', '1q', 'om1', 'hena4', '1ble', '5nd.', '1p', 'm1m', '1ca', '3ty.', 'e2x', 'a2n', 'ex1', '.re1', 'n1g', 'ter1', 'he2n', '4ing.', 'r1r', 'con1', '.ta4', 'ca1t', '2io', 'x1c', '.un1', 'li1', '1na', 'l1l', 'an1d', 'pu2', '1m', 'hy3ph', 'b2l', 'io3n.', '2mp', 'n2at', '1tio'], ['ta-ble', 'pro-ject'], 2, 2], 'Paragra-ph'), ('control layout', ['table', ['1ble', 'ment1', 'e2x', 'l1l', 'li1', 'n1g', 'he2n', 't1t', 'o2n', 'at1', '5nd.', 'c2ce', 'hy3ph', '.ta4', 'con1', 'ex1', '2io', 'p2h', '1p', '1na', 'ca1t', 'r1r', 'a2n', 's1s', 'pu2', 'ter1', 'b2l', 'x1c', 'n2at', 'hena4', 'e1c', '.re1', '3ty.', '1m', '1ca', 'gr2', '2mp', '.un1', 'io3n.', 'hen5at', 'm1m'], [], 2, 1], 'table')], [('regression: exception lookup case', ['Table', ['om1', 'ca1t', 'o2n', 'e1c', '2io', '2mp', 'a2n', 'l1l', 'io3n.', 'e2x', 'a1b', 'ter1', '.ta4', 'an1d', 'r1r', 't1t', '1ca', 'pu2', 'n1g', '1tio', '3ty.', '1p', 'at1'], ['ta-ble'], 2, 2], 'Ta-ble'), ('regression: exception lookup case', ['Exception', ['.ta4', '2mp', 'ca1t', 'pu2', 'gr2', 'm1m', 'li1', 't1t', 'p2h', 'b2l', 'hen5at', 'hena4', 'o2n', 'n1g', 'con1', '5nd.', '.re1', '3ty.', 'ment1', 'x1c', '1na', 's1s', 'an1d', 'l1l', 'io3n.', 'c2ce', 'a1b', 'he2n', 'ter1', '1tio', 'n2at', 'a2n', '1ca', 'ex1', '2io', '1ble', 'e2x', '4ing.', 'e1c', '.un1', 'hy3ph', '1p', '1q', 'r1r', 'at1', '1m', 'om1'], ['ex-cep-tion', 'ta-ble', 'gram-mar'], 2, 3], 'Ex-cep-tion'), ('partial-repair probe', ['project', ['2io', 's1s', 'ca1t', '1na', '1ble', 'con1', 'hena4', 'li1', 'm1m', '1q', 'n1g', '1ca', 'he2n', 'hen5at', '1p', '.ta4', 'ter1'], ['gram-mar', 'pro-ject'], 1, 2], 'pro-ject'), ('regression: exception lookup case', ['Exception', ['ex1', '2io', 'io3n.', 'x1c', 'pu2', 'at1', '1m', 'hy3ph', 'om1', 'n2at', '1na', '2mp', '1p', 'n1g', '1tio', '.un1', 'e1c', '.re1', 'c2ce', 'o2n', 'b2l', '1ca', 'l1l'], ['gram-mar', 'pro-ject', 'ex-cep-tion'], 3, 1], 'Ex-cep-tion'), ('lowercase exception', ['project', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['pro-ject'], 2, 3], 'pro-ject'), ('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('control layout', ['hyphenation', ['hy3ph', 'pu2', '1p', '3ty.', 'p2h', '2io', 'm1m', 'ex1', 'n2at', 'con1', 'a2n', '1na', 'e2x', '.ta4', 'at1', 'hen5at', 'c2ce', 'li1', 'n1g', 'an1d', 'a1b', '1m', '1tio', 'x1c', '5nd.', '4ing.', '.re1', 'hena4', 's1s', '1q'], ['ta-ble'], 3, 3], 'hyphe-n-ation'), ('control layout', ['Pentagon', ['hy3ph', '.re1', 'n1g', 'ex1', 's1s', '5nd.', '.un1', 'ca1t', 'o2n', '1m', 'io3n.', 'an1d', '1ca', 'pu2', '2mp', 'b2l', 'p2h', 'x1c', 'l1l', '2io', 'a2n'], ['ex-cep-tion', 'mis-sis-sip-pi', 'gram-mar'], 1, 3], 'Pentagon')], [('regression: exception lookup case', ['Table', ['om1', 'ca1t', 'o2n', 'e1c', '2io', '2mp', 'a2n', 'l1l', 'io3n.', 'e2x', 'a1b', 'ter1', '.ta4', 'an1d', 'r1r', 't1t', '1ca', 'pu2', 'n1g', '1tio', '3ty.', '1p', 'at1'], ['ta-ble'], 2, 2], 'Ta-ble'), ('regression: exception lookup case', ['Exception', ['ex1', '2io', 'io3n.', 'x1c', 'pu2', 'at1', '1m', 'hy3ph', 'om1', 'n2at', '1na', '2mp', '1p', 'n1g', '1tio', '.un1', 'e1c', '.re1', 'c2ce', 'o2n', 'b2l', '1ca', 'l1l'], ['gram-mar', 'pro-ject', 'ex-cep-tion'], 3, 1], 'Ex-cep-tion'), ('partial-repair probe', ['project', ['l1l', '1q', 'm1m', '2io', 'x1c', 'ment1', '1ble', 'a2n', 'gr2', 'e1c', 'li1', 'e2x', 's1s', '.un1', '1ca'], ['pro-ject'], 1, 1], 'pro-ject'), ('partial-repair probe', ['project', ['e1c', 'li1', 'b2l', 'r1r', 'at1', '3ty.', 's1s', 'p2h', 'a1b', 'ter1', 't1t', 'hy3ph', 'om1', 'gr2', 'io3n.', 'hena4', 'a2n', '2mp', 'x1c', 'ex1', 'e2x', 'hen5at', '1tio', '.un1', '4ing.', 'n1g', 'pu2', 'ment1', '1q', 'he2n', '.ta4', '1ca'], ['gram-mar', 'ex-cep-tion', 'pro-ject'], 3, 2], 'pro-ject'), ('right minimum boundary', ['category', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 1, 3], 'ca-t-egory'), ('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('control layout', ['computer', ['hy3ph', 'n1g', 'om1', 'ter1', 'pu2', 'l1l', 'e2x', '1na', 'e1c', 'io3n.', 'hen5at', 'ca1t', '1q', '4ing.', 'hena4', 'ex1', '1p', 't1t', 'p2h', '.ta4', '1tio', 'ment1', 'li1', '2mp', 'n2at', 'x1c', 'o2n', 's1s', 'he2n', '1m', 'a2n', 'c2ce', '.un1', 'm1m', 'an1d', 'con1', '1ca', 'gr2', 'a1b', 'b2l', '2io', '.re1', '3ty.', 'r1r', '1ble', '5nd.', 'at1'], ['pro-ject'], 1, 1], 'com-puter'), ('control layout', ['connection', ['1ble', 'p2h', 'ex1', 'hena4', 'an1d', '.ta4', '1na', 'b2l', 'li1', 'gr2', 'e2x', 'at1', 'pu2', 'l1l', 't1t', '3ty.', 'hen5at', 'ment1', '1ca', '.re1', '1p', 'ter1', 'con1', 'he2n', 'c2ce', 'e1c', 'n2at', 'om1', 'ca1t', '4ing.', 'a1b', 'n1g', 'm1m', 'r1r', 'hy3ph'], [], 1, 2], 'con-ne-ction')], [('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('regression: exception lookup case', ['Exception', ['hena4', '1q', 'hy3ph', 'ter1', 'at1', 'e1c', '1na', '5nd.', 'b2l', 'ment1', '1p', '.ta4', 'ca1t', 'ex1', 't1t', 'a2n', '1tio', '4ing.', '2io', 'p2h', 'o2n', 'e2x', 'm1m', 'pu2', 'he2n', 'li1', 'a1b'], ['ex-cep-tion', 'gram-mar'], 1, 2], 'Ex-cep-tion'), ('regression: exception lookup case', ['Table', ['li1', '2io', 'hy3ph', '4ing.', 'at1', 'm1m', 'om1', 'ex1', 'p2h', 'e2x', 'a2n', '1q', '1na', 'n2at', 'r1r', 'hena4', '1p', 'an1d', 'gr2', '3ty.', 'ca1t', 'n1g', 'x1c', 'c2ce', '.re1', 'io3n.', '1m', 'hen5at', 'e1c', 'ter1', 'l1l', 'b2l', 'pu2'], ['ta-ble'], 2, 3], 'Ta-ble'), ('partial-repair probe', ['grammar', ['ex1', 'ter1', 'hy3ph', 'gr2', 's1s', 'e2x', 'c2ce', 'li1', 'a2n', 'ment1', '1ble', '.un1', 'an1d', 'p2h', '1p', 'x1c', 'con1', '5nd.', '2io', 'hena4', 'b2l', '1na', 'om1', 'ca1t', '2mp', '1tio', '1q', 'io3n.', '3ty.'], ['pro-ject', 'ta-ble', 'gram-mar'], 1, 1], 'gram-mar'), ('right minimum boundary', ['category', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 1, 3], 'ca-t-egory'), ('word-final pattern ing.', ['running', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 2], 'running'), ('control layout', ['hyphenation', ['io3n.', 'ment1', '1p', 'n1g', 'b2l', 'e1c', 'p2h', 'n2at', '2mp', '1na', 'a2n', 'ex1', 'o2n', 'an1d', '3ty.', 'a1b', 'hena4', 'hen5at', 'r1r', 'gr2', 's1s', '1ble', 'he2n', 'e2x', '1ca', '2io', 'x1c', '4ing.', 'm1m', 'con1'], ['ta-ble'], 3, 2], 'hyphen-ation'), ('control layout', ['Unexpected', ['m1m', 'io3n.', '.ta4', 'li1', 'he2n', 'x1c', 'e2x', 'con1', '5nd.', 'a1b', '1ca', '2mp', 'c2ce', 'p2h', 'e1c', '1tio', '2io', '1na', 's1s', '1p', 'hy3ph', 'at1', 'pu2', 'b2l', '.un1', 'om1', 'r1r', 'ex1', 'hen5at', 'ter1', '1q', 'n1g', 'l1l', '.re1', '3ty.', 'an1d', '4ing.', 'n2at', 't1t', 'o2n', 'hena4', '1ble', 'a2n', '1m', 'ca1t', 'gr2'], [], 2, 3], 'Un-ex-pe-cted')], [('regression: exception lookup case', ['Mississippi', ['5nd.', '4ing.', 'om1', '2mp', 'r1r', 'n2at', '2io', '1ca'], ['mis-sis-sip-pi'], 3, 2], 'Mis-sis-sip-pi'), ('regression: exception lookup case', ['Exception', ['s1s', 'con1', 'c2ce', 'pu2', 'x1c', '1m', '2mp', 'a1b', 'n2at', '.re1', '.ta4', '3ty.', 'n1g', 'ment1', 'p2h', 'hy3ph', 'ter1', 'hena4', 'b2l'], ['ex-cep-tion'], 2, 2], 'Ex-cep-tion'), ('partial-repair probe', ['table', ['x1c', '1tio', 'io3n.', 'gr2', '2io', 'o2n', 'ment1', '.re1', 'l1l', 'con1', 'n2at', 'hen5at', 'hena4', 'ter1', '.ta4', 'r1r', '1p', '.un1', 'ca1t', 'e1c', 'c2ce', '5nd.', 'b2l', '1na', 'e2x', 'm1m', 'a1b', '2mp', '3ty.', 'p2h', '1m', 't1t', 'an1d', 'n1g', 'pu2', 'ex1'], ['ta-ble', 'ex-cep-tion'], 3, 1], 'ta-ble'), ('partial-repair probe', ['grammar', ['1ble', 'e2x', '2io', 'li1', '.un1', '.re1', '5nd.', '1m', '1p', '1ca', '1na', '1q', '1tio', 'n2at', 'e1c', 'om1', 'at1', 'io3n.', 'ter1', '2mp', '4ing.', 'con1', 'ment1', 'r1r', 'pu2', 'p2h', 'hy3ph', 't1t', 'm1m', 'ex1', 'l1l', 'b2l', 's1s', 'c2ce', 'n1g', 'he2n', 'hena4', 'gr2', '.ta4', 'an1d', 'ca1t', 'o2n', 'x1c', '3ty.', 'a2n'], ['gram-mar', 'ex-cep-tion', 'mis-sis-sip-pi'], 3, 3], 'gram-mar'), ('left minimum boundary', ['excellent', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 3], 'ex-cel-lent'), ('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('control layout', ['table', ['ca1t', '1ble', 'n2at', 'con1', '.re1', 's1s', 'b2l', 'a2n', 'x1c', 't1t', 'r1r', '5nd.', 'o2n'], ['ex-cep-tion'], 2, 2], 'ta-ble'), ('control layout', ['battle', ['1ca', 'x1c', 'an1d', '1m', 's1s', 'he2n', '5nd.', 'b2l', 'ex1', 'c2ce', 'li1', 't1t', '1na', 'hen5at', 'gr2', 'hy3ph', '1p', 'p2h', '2io', 'r1r', '.re1', 'e2x', 'om1', 'ter1', 'a1b', 'at1', 'io3n.', 'pu2', 'n2at', 'm1m', 'con1', '4ing.', '1ble', '.un1', 'ca1t', 'l1l', '2mp', '3ty.', 'n1g', 'ment1', '1q'], ['ta-ble'], 1, 1], 'bat-tle')]]
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 fixtureActualExpectedOutcome
capitalised exceptionTableTa-bleFailed
partial-repair probegram-margram-marPassed
regression: exception lookup caseMississippiMis-sis-sip-piFailed
word-final pattern ing.runningrunningPassed
left minimum boundaryex-cel-lentex-cel-lentPassed
control layoutCo-m-mit-mentCo-m-mit-mentPassed
control layoutParagra-phParagra-phPassed
control layouttabletablePassed

SHA-256 / 7c3a6aa31d087489459b2ce0f99657cfac5ffaff9d9e217920238da370c3298b

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    word, patterns, exceptions, lmin, rmin = x
    low = word.lower()
    for e in exceptions:
        if e == low:
            out, count = '', 0
            for c in e:
                if c == '-':
                    out += '-'
                else:
                    out += word[count]
                    count += 1
            return out
    table = {}
    for p in patterns:
        letters = ''
        vals = [0]
        for c in p:
            if c.isdigit():
                vals[-1] = int(c)
            else:
                letters += c
                vals.append(0)
        table[letters] = vals
    dotted = '.' + low + '.'
    score = [0] * (len(dotted) + 1)
    for s in range(len(dotted)):
        for e in range(s + 1, len(dotted) + 1):
            vals = table.get(dotted[s:e])
            if vals:
                for k, v in enumerate(vals):
                    score[s + k] = max(score[s + k], v)
    points = [i for i in range(1, len(word)) if score[i + 1] % 2 == 1 and i >= lmin and len(word) - i >= rmin]
    out = ''
    for i, c in enumerate(word):
        if i in points:
            out += '-'
        out += c
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('partial-repair probe', ['grammar', ['io3n.', 'n1g', '3ty.', 'm1m', 'gr2', 'a1b', 'e2x', 'pu2', 'n2at', 'r1r', '1ca', 'ca1t', '1tio', 't1t', 'o2n', '1m', '.un1', 'con1', 'om1', '5nd.', 'p2h', 'ment1', 'hena4', 'hy3ph', '.ta4', 'e1c', '.re1', 'li1', 'a2n', 'b2l', '1ble'], ['pro-ject', 'gram-mar', 'ta-ble'], 1, 3], 'gram-mar'), ('regression: exception lookup case', ['Mississippi', ['5nd.', '4ing.', 'om1', '2mp', 'r1r', 'n2at', '2io', '1ca'], ['mis-sis-sip-pi'], 3, 2], 'Mis-sis-sip-pi'), ('word-final pattern ing.', ['running', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 2], 'running'), ('left minimum boundary', ['excellent', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 3], 'ex-cel-lent'), ('control layout', ['Commitment', ['.un1', '4ing.', 's1s', 'io3n.', 'pu2', 'c2ce', '1ca', '1tio', '1ble', 'he2n', 't1t', '1m', '5nd.', '2mp', 'b2l', 'an1d', 'a2n', 'li1', 'at1', 'ca1t', '.ta4', '1q', '2io', 'om1', 'ment1', 'a1b', 'hy3ph', '1na', 'r1r', '3ty.', '1p', 'm1m', 'e1c', 'hena4', 'p2h', 'n2at', 'o2n', 'con1', '.re1'], ['ex-cep-tion', 'ta-ble'], 2, 1], 'Co-m-mit-ment'), ('control layout', ['Paragraph', ['e1c', 'at1', 'ment1', 'gr2', 'a1b', 's1s', 't1t', 'hen5at', '1q', 'om1', 'hena4', '1ble', '5nd.', '1p', 'm1m', '1ca', '3ty.', 'e2x', 'a2n', 'ex1', '.re1', 'n1g', 'ter1', 'he2n', '4ing.', 'r1r', 'con1', '.ta4', 'ca1t', '2io', 'x1c', '.un1', 'li1', '1na', 'l1l', 'an1d', 'pu2', '1m', 'hy3ph', 'b2l', 'io3n.', '2mp', 'n2at', '1tio'], ['ta-ble', 'pro-ject'], 2, 2], 'Paragra-ph'), ('control layout', ['table', ['1ble', 'ment1', 'e2x', 'l1l', 'li1', 'n1g', 'he2n', 't1t', 'o2n', 'at1', '5nd.', 'c2ce', 'hy3ph', '.ta4', 'con1', 'ex1', '2io', 'p2h', '1p', '1na', 'ca1t', 'r1r', 'a2n', 's1s', 'pu2', 'ter1', 'b2l', 'x1c', 'n2at', 'hena4', 'e1c', '.re1', '3ty.', '1m', '1ca', 'gr2', '2mp', '.un1', 'io3n.', 'hen5at', 'm1m'], [], 2, 1], 'table')], [('regression: exception lookup case', ['Table', ['om1', 'ca1t', 'o2n', 'e1c', '2io', '2mp', 'a2n', 'l1l', 'io3n.', 'e2x', 'a1b', 'ter1', '.ta4', 'an1d', 'r1r', 't1t', '1ca', 'pu2', 'n1g', '1tio', '3ty.', '1p', 'at1'], ['ta-ble'], 2, 2], 'Ta-ble'), ('regression: exception lookup case', ['Exception', ['.ta4', '2mp', 'ca1t', 'pu2', 'gr2', 'm1m', 'li1', 't1t', 'p2h', 'b2l', 'hen5at', 'hena4', 'o2n', 'n1g', 'con1', '5nd.', '.re1', '3ty.', 'ment1', 'x1c', '1na', 's1s', 'an1d', 'l1l', 'io3n.', 'c2ce', 'a1b', 'he2n', 'ter1', '1tio', 'n2at', 'a2n', '1ca', 'ex1', '2io', '1ble', 'e2x', '4ing.', 'e1c', '.un1', 'hy3ph', '1p', '1q', 'r1r', 'at1', '1m', 'om1'], ['ex-cep-tion', 'ta-ble', 'gram-mar'], 2, 3], 'Ex-cep-tion'), ('partial-repair probe', ['project', ['2io', 's1s', 'ca1t', '1na', '1ble', 'con1', 'hena4', 'li1', 'm1m', '1q', 'n1g', '1ca', 'he2n', 'hen5at', '1p', '.ta4', 'ter1'], ['gram-mar', 'pro-ject'], 1, 2], 'pro-ject'), ('regression: exception lookup case', ['Exception', ['ex1', '2io', 'io3n.', 'x1c', 'pu2', 'at1', '1m', 'hy3ph', 'om1', 'n2at', '1na', '2mp', '1p', 'n1g', '1tio', '.un1', 'e1c', '.re1', 'c2ce', 'o2n', 'b2l', '1ca', 'l1l'], ['gram-mar', 'pro-ject', 'ex-cep-tion'], 3, 1], 'Ex-cep-tion'), ('lowercase exception', ['project', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['pro-ject'], 2, 3], 'pro-ject'), ('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('control layout', ['hyphenation', ['hy3ph', 'pu2', '1p', '3ty.', 'p2h', '2io', 'm1m', 'ex1', 'n2at', 'con1', 'a2n', '1na', 'e2x', '.ta4', 'at1', 'hen5at', 'c2ce', 'li1', 'n1g', 'an1d', 'a1b', '1m', '1tio', 'x1c', '5nd.', '4ing.', '.re1', 'hena4', 's1s', '1q'], ['ta-ble'], 3, 3], 'hyphe-n-ation'), ('control layout', ['Pentagon', ['hy3ph', '.re1', 'n1g', 'ex1', 's1s', '5nd.', '.un1', 'ca1t', 'o2n', '1m', 'io3n.', 'an1d', '1ca', 'pu2', '2mp', 'b2l', 'p2h', 'x1c', 'l1l', '2io', 'a2n'], ['ex-cep-tion', 'mis-sis-sip-pi', 'gram-mar'], 1, 3], 'Pentagon')], [('regression: exception lookup case', ['Table', ['om1', 'ca1t', 'o2n', 'e1c', '2io', '2mp', 'a2n', 'l1l', 'io3n.', 'e2x', 'a1b', 'ter1', '.ta4', 'an1d', 'r1r', 't1t', '1ca', 'pu2', 'n1g', '1tio', '3ty.', '1p', 'at1'], ['ta-ble'], 2, 2], 'Ta-ble'), ('regression: exception lookup case', ['Exception', ['ex1', '2io', 'io3n.', 'x1c', 'pu2', 'at1', '1m', 'hy3ph', 'om1', 'n2at', '1na', '2mp', '1p', 'n1g', '1tio', '.un1', 'e1c', '.re1', 'c2ce', 'o2n', 'b2l', '1ca', 'l1l'], ['gram-mar', 'pro-ject', 'ex-cep-tion'], 3, 1], 'Ex-cep-tion'), ('partial-repair probe', ['project', ['l1l', '1q', 'm1m', '2io', 'x1c', 'ment1', '1ble', 'a2n', 'gr2', 'e1c', 'li1', 'e2x', 's1s', '.un1', '1ca'], ['pro-ject'], 1, 1], 'pro-ject'), ('partial-repair probe', ['project', ['e1c', 'li1', 'b2l', 'r1r', 'at1', '3ty.', 's1s', 'p2h', 'a1b', 'ter1', 't1t', 'hy3ph', 'om1', 'gr2', 'io3n.', 'hena4', 'a2n', '2mp', 'x1c', 'ex1', 'e2x', 'hen5at', '1tio', '.un1', '4ing.', 'n1g', 'pu2', 'ment1', '1q', 'he2n', '.ta4', '1ca'], ['gram-mar', 'ex-cep-tion', 'pro-ject'], 3, 2], 'pro-ject'), ('right minimum boundary', ['category', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 1, 3], 'ca-t-egory'), ('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('control layout', ['computer', ['hy3ph', 'n1g', 'om1', 'ter1', 'pu2', 'l1l', 'e2x', '1na', 'e1c', 'io3n.', 'hen5at', 'ca1t', '1q', '4ing.', 'hena4', 'ex1', '1p', 't1t', 'p2h', '.ta4', '1tio', 'ment1', 'li1', '2mp', 'n2at', 'x1c', 'o2n', 's1s', 'he2n', '1m', 'a2n', 'c2ce', '.un1', 'm1m', 'an1d', 'con1', '1ca', 'gr2', 'a1b', 'b2l', '2io', '.re1', '3ty.', 'r1r', '1ble', '5nd.', 'at1'], ['pro-ject'], 1, 1], 'com-puter'), ('control layout', ['connection', ['1ble', 'p2h', 'ex1', 'hena4', 'an1d', '.ta4', '1na', 'b2l', 'li1', 'gr2', 'e2x', 'at1', 'pu2', 'l1l', 't1t', '3ty.', 'hen5at', 'ment1', '1ca', '.re1', '1p', 'ter1', 'con1', 'he2n', 'c2ce', 'e1c', 'n2at', 'om1', 'ca1t', '4ing.', 'a1b', 'n1g', 'm1m', 'r1r', 'hy3ph'], [], 1, 2], 'con-ne-ction')], [('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('regression: exception lookup case', ['Exception', ['hena4', '1q', 'hy3ph', 'ter1', 'at1', 'e1c', '1na', '5nd.', 'b2l', 'ment1', '1p', '.ta4', 'ca1t', 'ex1', 't1t', 'a2n', '1tio', '4ing.', '2io', 'p2h', 'o2n', 'e2x', 'm1m', 'pu2', 'he2n', 'li1', 'a1b'], ['ex-cep-tion', 'gram-mar'], 1, 2], 'Ex-cep-tion'), ('regression: exception lookup case', ['Table', ['li1', '2io', 'hy3ph', '4ing.', 'at1', 'm1m', 'om1', 'ex1', 'p2h', 'e2x', 'a2n', '1q', '1na', 'n2at', 'r1r', 'hena4', '1p', 'an1d', 'gr2', '3ty.', 'ca1t', 'n1g', 'x1c', 'c2ce', '.re1', 'io3n.', '1m', 'hen5at', 'e1c', 'ter1', 'l1l', 'b2l', 'pu2'], ['ta-ble'], 2, 3], 'Ta-ble'), ('partial-repair probe', ['grammar', ['ex1', 'ter1', 'hy3ph', 'gr2', 's1s', 'e2x', 'c2ce', 'li1', 'a2n', 'ment1', '1ble', '.un1', 'an1d', 'p2h', '1p', 'x1c', 'con1', '5nd.', '2io', 'hena4', 'b2l', '1na', 'om1', 'ca1t', '2mp', '1tio', '1q', 'io3n.', '3ty.'], ['pro-ject', 'ta-ble', 'gram-mar'], 1, 1], 'gram-mar'), ('right minimum boundary', ['category', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 1, 3], 'ca-t-egory'), ('word-final pattern ing.', ['running', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 2], 'running'), ('control layout', ['hyphenation', ['io3n.', 'ment1', '1p', 'n1g', 'b2l', 'e1c', 'p2h', 'n2at', '2mp', '1na', 'a2n', 'ex1', 'o2n', 'an1d', '3ty.', 'a1b', 'hena4', 'hen5at', 'r1r', 'gr2', 's1s', '1ble', 'he2n', 'e2x', '1ca', '2io', 'x1c', '4ing.', 'm1m', 'con1'], ['ta-ble'], 3, 2], 'hyphen-ation'), ('control layout', ['Unexpected', ['m1m', 'io3n.', '.ta4', 'li1', 'he2n', 'x1c', 'e2x', 'con1', '5nd.', 'a1b', '1ca', '2mp', 'c2ce', 'p2h', 'e1c', '1tio', '2io', '1na', 's1s', '1p', 'hy3ph', 'at1', 'pu2', 'b2l', '.un1', 'om1', 'r1r', 'ex1', 'hen5at', 'ter1', '1q', 'n1g', 'l1l', '.re1', '3ty.', 'an1d', '4ing.', 'n2at', 't1t', 'o2n', 'hena4', '1ble', 'a2n', '1m', 'ca1t', 'gr2'], [], 2, 3], 'Un-ex-pe-cted')], [('regression: exception lookup case', ['Mississippi', ['5nd.', '4ing.', 'om1', '2mp', 'r1r', 'n2at', '2io', '1ca'], ['mis-sis-sip-pi'], 3, 2], 'Mis-sis-sip-pi'), ('regression: exception lookup case', ['Exception', ['s1s', 'con1', 'c2ce', 'pu2', 'x1c', '1m', '2mp', 'a1b', 'n2at', '.re1', '.ta4', '3ty.', 'n1g', 'ment1', 'p2h', 'hy3ph', 'ter1', 'hena4', 'b2l'], ['ex-cep-tion'], 2, 2], 'Ex-cep-tion'), ('partial-repair probe', ['table', ['x1c', '1tio', 'io3n.', 'gr2', '2io', 'o2n', 'ment1', '.re1', 'l1l', 'con1', 'n2at', 'hen5at', 'hena4', 'ter1', '.ta4', 'r1r', '1p', '.un1', 'ca1t', 'e1c', 'c2ce', '5nd.', 'b2l', '1na', 'e2x', 'm1m', 'a1b', '2mp', '3ty.', 'p2h', '1m', 't1t', 'an1d', 'n1g', 'pu2', 'ex1'], ['ta-ble', 'ex-cep-tion'], 3, 1], 'ta-ble'), ('partial-repair probe', ['grammar', ['1ble', 'e2x', '2io', 'li1', '.un1', '.re1', '5nd.', '1m', '1p', '1ca', '1na', '1q', '1tio', 'n2at', 'e1c', 'om1', 'at1', 'io3n.', 'ter1', '2mp', '4ing.', 'con1', 'ment1', 'r1r', 'pu2', 'p2h', 'hy3ph', 't1t', 'm1m', 'ex1', 'l1l', 'b2l', 's1s', 'c2ce', 'n1g', 'he2n', 'hena4', 'gr2', '.ta4', 'an1d', 'ca1t', 'o2n', 'x1c', '3ty.', 'a2n'], ['gram-mar', 'ex-cep-tion', 'mis-sis-sip-pi'], 3, 3], 'gram-mar'), ('left minimum boundary', ['excellent', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], [], 2, 3], 'ex-cel-lent'), ('capitalised exception', ['Table', ['.ta4', 'a1b', 'b2l', '1ble', 'hy3ph', 'he2n', 'hena4', 'hen5at', '1na', 'n2at', '1tio', '2io', 'o2n', 'pu2', 'ter1', '1m', 'ex1', 'e1c', 'c2ce', 'con1', 'ment1', '4ing.', 'n1g', '.re1', 'gr2', '3ty.', 'li1', '1ca', 'ca1t', 'at1', 'io3n.', 'r1r', 'm1m', 'l1l', 't1t', 's1s', 'a2n', 'an1d', '5nd.', '1p', 'p2h', '1q', '.un1', 'e2x', 'x1c', '2mp', 'om1'], ['ta-ble'], 1, 1], 'Ta-ble'), ('control layout', ['table', ['ca1t', '1ble', 'n2at', 'con1', '.re1', 's1s', 'b2l', 'a2n', 'x1c', 't1t', 'r1r', '5nd.', 'o2n'], ['ex-cep-tion'], 2, 2], 'ta-ble'), ('control layout', ['battle', ['1ca', 'x1c', 'an1d', '1m', 's1s', 'he2n', '5nd.', 'b2l', 'ex1', 'c2ce', 'li1', 't1t', '1na', 'hen5at', 'gr2', 'hy3ph', '1p', 'p2h', '2io', 'r1r', '.re1', 'e2x', 'om1', 'ter1', 'a1b', 'at1', 'io3n.', 'pu2', 'n2at', 'm1m', 'con1', '4ing.', '1ble', '.un1', 'ca1t', 'l1l', '2mp', '3ty.', 'n1g', 'ment1', '1q'], ['ta-ble'], 1, 1], 'bat-tle')]]
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 fixtureActualExpectedOutcome
capitalised exceptionTableTa-bleFailed
partial-repair probegra-m-margram-marFailed
regression: exception lookup caseMississippiMis-sis-sip-piFailed
word-final pattern ing.runningrunningPassed
left minimum boundaryex-cel-lentex-cel-lentPassed
control layoutCo-m-mit-mentCo-m-mit-mentPassed
control layoutParagra-phParagra-phPassed
control layouttabletablePassed

SHA-256 / 7fba3dc4a6a9374c728e1a23a118ab062ce6e7b311a7bb63b0eccf01dae8e3cd

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:48.988704+00:00.

Case digest / 2fe1f99face517ff20a3dea1e9495aad9400bd00f05f221cd7e07558ab0b1bd3