FA-95866 / Postal address normalization / Open access
Secondary unit extractor: a dangling hash becomes an empty unit · case 01
"21 OAK ST #" returns street "21 OAK ST" with unit "# " instead of leaving the line intact.
ROOT CAUSE
The attached-hash branch fires for a token that is only "#", producing an empty identifier.
THE FAILURE
The attached-hash branch fires for a token that is only "#", producing an empty identifier.
Unsuccessful approach: Requiring two characters after the hash rejects legitimate single-character units like "#7".
Case contract
Input one uppercase-able street line. Split on whitespace. A final token "#ID" (with at least one character after #) becomes unit "# ID". Otherwise, if at least three tokens exist and the second-to-last token is a designator (APARTMENT/APT->APT, SUITE/STE->STE, UNIT, FLOOR/FL->FL, #), the last token is its identifier. Return [street, unit] with unit "" when none is found.
Why this case matters
Separating the secondary unit from the street line decides whether two deliveries go to the same building and which unit receives them.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
DES = {'APARTMENT': 'APT', 'APT': 'APT', 'SUITE': 'STE', 'STE': 'STE', 'UNIT': 'UNIT', 'FLOOR': 'FL',
'FL': 'FL', '#': '#'}
t = x.upper().split()
if len(t) >= 2 and t[-1].startswith('#'):
return [' '.join(t[:-1]), '# ' + t[-1][1:]]
if len(t) >= 3 and t[-2] in DES:
return [' '.join(t[:-2]), DES[t[-2]] + ' ' + t[-1]]
return [' '.join(t), '']
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trailing apartment is split off', '21 OAK ST APARTMENT 1B', ['21 OAK ST', 'APT 1B']], ['suite designator abbreviated', '21 OAK ST SUITE 100', ['21 OAK ST', 'STE 100']], ['attached hash unit', '21 OAK ST #1B', ['21 OAK ST', '# 1B']], ['separate hash token', '21 OAK ST # 5', ['21 OAK ST', '# 5']], ['dangling hash stays in the street', '21 OAK ST #', ['21 OAK ST #', '']], ['single-character attached unit', '21 OAK ST #1', ['21 OAK ST', '# 1']], ['designator line without street', 'UNIT 9', ['UNIT 9', '']], ['building name with floor', 'FAKEWAY FLOOR 1', ['FAKEWAY', 'FL 1']], ['substring APT inside a word is not a designator', '21 CAPTAIN WAY', ['21 CAPTAIN WAY', '']]], [['trailing apartment is split off', '22 ELM ST APARTMENT 2B', ['22 ELM ST', 'APT 2B']], ['suite designator abbreviated', '22 ELM ST SUITE 200', ['22 ELM ST', 'STE 200']], ['attached hash unit', '22 ELM ST #2B', ['22 ELM ST', '# 2B']], ['separate hash token', '22 ELM ST # 6', ['22 ELM ST', '# 6']], ['dangling hash stays in the street', '22 ELM ST #', ['22 ELM ST #', '']], ['single-character attached unit', '22 ELM ST #2', ['22 ELM ST', '# 2']], ['designator line without street', 'UNIT 10', ['UNIT 10', '']], ['building name with floor', 'FAKEWAY FLOOR 2', ['FAKEWAY', 'FL 2']], ['substring APT inside a word is not a designator', '22 CAPTAIN WAY', ['22 CAPTAIN WAY', '']]], [['trailing apartment is split off', '23 MAPLE ST APARTMENT 3B', ['23 MAPLE ST', 'APT 3B']], ['suite designator abbreviated', '23 MAPLE ST SUITE 300', ['23 MAPLE ST', 'STE 300']], ['attached hash unit', '23 MAPLE ST #3B', ['23 MAPLE ST', '# 3B']], ['separate hash token', '23 MAPLE ST # 7', ['23 MAPLE ST', '# 7']], ['dangling hash stays in the street', '23 MAPLE ST #', ['23 MAPLE ST #', '']], ['single-character attached unit', '23 MAPLE ST #3', ['23 MAPLE ST', '# 3']], ['designator line without street', 'UNIT 11', ['UNIT 11', '']], ['building name with floor', 'FAKEWAY FLOOR 3', ['FAKEWAY', 'FL 3']], ['substring APT inside a word is not a designator', '23 CAPTAIN WAY', ['23 CAPTAIN WAY', '']]], [['trailing apartment is split off', '24 BIRCH ST APARTMENT 4B', ['24 BIRCH ST', 'APT 4B']], ['suite designator abbreviated', '24 BIRCH ST SUITE 400', ['24 BIRCH ST', 'STE 400']], ['attached hash unit', '24 BIRCH ST #4B', ['24 BIRCH ST', '# 4B']], ['separate hash token', '24 BIRCH ST # 8', ['24 BIRCH ST', '# 8']], ['dangling hash stays in the street', '24 BIRCH ST #', ['24 BIRCH ST #', '']], ['single-character attached unit', '24 BIRCH ST #4', ['24 BIRCH ST', '# 4']], ['designator line without street', 'UNIT 12', ['UNIT 12', '']], ['building name with floor', 'FAKEWAY FLOOR 4', ['FAKEWAY', 'FL 4']], ['substring APT inside a word is not a designator', '24 CAPTAIN WAY', ['24 CAPTAIN WAY', '']]], [['trailing apartment is split off', '25 CEDAR ST APARTMENT 5B', ['25 CEDAR ST', 'APT 5B']], ['suite designator abbreviated', '25 CEDAR ST SUITE 500', ['25 CEDAR ST', 'STE 500']], ['attached hash unit', '25 CEDAR ST #5B', ['25 CEDAR ST', '# 5B']], ['separate hash token', '25 CEDAR ST # 9', ['25 CEDAR ST', '# 9']], ['dangling hash stays in the street', '25 CEDAR ST #', ['25 CEDAR ST #', '']], ['single-character attached unit', '25 CEDAR ST #5', ['25 CEDAR ST', '# 5']], ['designator line without street', 'UNIT 13', ['UNIT 13', '']], ['building name with floor', 'FAKEWAY FLOOR 5', ['FAKEWAY', 'FL 5']], ['substring APT inside a word is not a designator', '25 CAPTAIN WAY', ['25 CAPTAIN WAY', '']]]]
for label, arg, expected in fixtures[N - 1]:
check(label, solve(arg), 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 |
|---|---|---|---|
| trailing apartment is split off | ['21 OAK ST', 'APT 1B'] | ['21 OAK ST', 'APT 1B'] | Passed |
| suite designator abbreviated | ['21 OAK ST', 'STE 100'] | ['21 OAK ST', 'STE 100'] | Passed |
| attached hash unit | ['21 OAK ST', '# 1B'] | ['21 OAK ST', '# 1B'] | Passed |
| separate hash token | ['21 OAK ST', '# 5'] | ['21 OAK ST', '# 5'] | Passed |
| dangling hash stays in the street | ['21 OAK ST', '# '] | ['21 OAK ST #', ''] | Failed |
| single-character attached unit | ['21 OAK ST', '# 1'] | ['21 OAK ST', '# 1'] | Passed |
| designator line without street | ['UNIT 9', ''] | ['UNIT 9', ''] | Passed |
| building name with floor | ['FAKEWAY', 'FL 1'] | ['FAKEWAY', 'FL 1'] | Passed |
| substring APT inside a word is not a designator | ['21 CAPTAIN WAY', ''] | ['21 CAPTAIN WAY', ''] | Passed |
SHA-256 / 9c1ce8d7fd8956966691b9848bbf5c628e465023cf5d93e1ffd961ca78be37b5
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
DES = {'APARTMENT': 'APT', 'APT': 'APT', 'SUITE': 'STE', 'STE': 'STE', 'UNIT': 'UNIT', 'FLOOR': 'FL',
'FL': 'FL', '#': '#'}
t = x.upper().split()
if len(t) >= 2 and t[-1].startswith('#') and len(t[-1]) > 2:
return [' '.join(t[:-1]), '# ' + t[-1][1:]]
if len(t) >= 3 and t[-2] in DES:
return [' '.join(t[:-2]), DES[t[-2]] + ' ' + t[-1]]
return [' '.join(t), '']
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['trailing apartment is split off', '21 OAK ST APARTMENT 1B', ['21 OAK ST', 'APT 1B']], ['suite designator abbreviated', '21 OAK ST SUITE 100', ['21 OAK ST', 'STE 100']], ['attached hash unit', '21 OAK ST #1B', ['21 OAK ST', '# 1B']], ['separate hash token', '21 OAK ST # 5', ['21 OAK ST', '# 5']], ['dangling hash stays in the street', '21 OAK ST #', ['21 OAK ST #', '']], ['single-character attached unit', '21 OAK ST #1', ['21 OAK ST', '# 1']], ['designator line without street', 'UNIT 9', ['UNIT 9', '']], ['building name with floor', 'FAKEWAY FLOOR 1', ['FAKEWAY', 'FL 1']], ['substring APT inside a word is not a designator', '21 CAPTAIN WAY', ['21 CAPTAIN WAY', '']]], [['trailing apartment is split off', '22 ELM ST APARTMENT 2B', ['22 ELM ST', 'APT 2B']], ['suite designator abbreviated', '22 ELM ST SUITE 200', ['22 ELM ST', 'STE 200']], ['attached hash unit', '22 ELM ST #2B', ['22 ELM ST', '# 2B']], ['separate hash token', '22 ELM ST # 6', ['22 ELM ST', '# 6']], ['dangling hash stays in the street', '22 ELM ST #', ['22 ELM ST #', '']], ['single-character attached unit', '22 ELM ST #2', ['22 ELM ST', '# 2']], ['designator line without street', 'UNIT 10', ['UNIT 10', '']], ['building name with floor', 'FAKEWAY FLOOR 2', ['FAKEWAY', 'FL 2']], ['substring APT inside a word is not a designator', '22 CAPTAIN WAY', ['22 CAPTAIN WAY', '']]], [['trailing apartment is split off', '23 MAPLE ST APARTMENT 3B', ['23 MAPLE ST', 'APT 3B']], ['suite designator abbreviated', '23 MAPLE ST SUITE 300', ['23 MAPLE ST', 'STE 300']], ['attached hash unit', '23 MAPLE ST #3B', ['23 MAPLE ST', '# 3B']], ['separate hash token', '23 MAPLE ST # 7', ['23 MAPLE ST', '# 7']], ['dangling hash stays in the street', '23 MAPLE ST #', ['23 MAPLE ST #', '']], ['single-character attached unit', '23 MAPLE ST #3', ['23 MAPLE ST', '# 3']], ['designator line without street', 'UNIT 11', ['UNIT 11', '']], ['building name with floor', 'FAKEWAY FLOOR 3', ['FAKEWAY', 'FL 3']], ['substring APT inside a word is not a designator', '23 CAPTAIN WAY', ['23 CAPTAIN WAY', '']]], [['trailing apartment is split off', '24 BIRCH ST APARTMENT 4B', ['24 BIRCH ST', 'APT 4B']], ['suite designator abbreviated', '24 BIRCH ST SUITE 400', ['24 BIRCH ST', 'STE 400']], ['attached hash unit', '24 BIRCH ST #4B', ['24 BIRCH ST', '# 4B']], ['separate hash token', '24 BIRCH ST # 8', ['24 BIRCH ST', '# 8']], ['dangling hash stays in the street', '24 BIRCH ST #', ['24 BIRCH ST #', '']], ['single-character attached unit', '24 BIRCH ST #4', ['24 BIRCH ST', '# 4']], ['designator line without street', 'UNIT 12', ['UNIT 12', '']], ['building name with floor', 'FAKEWAY FLOOR 4', ['FAKEWAY', 'FL 4']], ['substring APT inside a word is not a designator', '24 CAPTAIN WAY', ['24 CAPTAIN WAY', '']]], [['trailing apartment is split off', '25 CEDAR ST APARTMENT 5B', ['25 CEDAR ST', 'APT 5B']], ['suite designator abbreviated', '25 CEDAR ST SUITE 500', ['25 CEDAR ST', 'STE 500']], ['attached hash unit', '25 CEDAR ST #5B', ['25 CEDAR ST', '# 5B']], ['separate hash token', '25 CEDAR ST # 9', ['25 CEDAR ST', '# 9']], ['dangling hash stays in the street', '25 CEDAR ST #', ['25 CEDAR ST #', '']], ['single-character attached unit', '25 CEDAR ST #5', ['25 CEDAR ST', '# 5']], ['designator line without street', 'UNIT 13', ['UNIT 13', '']], ['building name with floor', 'FAKEWAY FLOOR 5', ['FAKEWAY', 'FL 5']], ['substring APT inside a word is not a designator', '25 CAPTAIN WAY', ['25 CAPTAIN WAY', '']]]]
for label, arg, expected in fixtures[N - 1]:
check(label, solve(arg), 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 |
|---|---|---|---|
| trailing apartment is split off | ['21 OAK ST', 'APT 1B'] | ['21 OAK ST', 'APT 1B'] | Passed |
| suite designator abbreviated | ['21 OAK ST', 'STE 100'] | ['21 OAK ST', 'STE 100'] | Passed |
| attached hash unit | ['21 OAK ST', '# 1B'] | ['21 OAK ST', '# 1B'] | Passed |
| separate hash token | ['21 OAK ST', '# 5'] | ['21 OAK ST', '# 5'] | Passed |
| dangling hash stays in the street | ['21 OAK ST #', ''] | ['21 OAK ST #', ''] | Passed |
| single-character attached unit | ['21 OAK ST #1', ''] | ['21 OAK ST', '# 1'] | Failed |
| designator line without street | ['UNIT 9', ''] | ['UNIT 9', ''] | Passed |
| building name with floor | ['FAKEWAY', 'FL 1'] | ['FAKEWAY', 'FL 1'] | Passed |
| substring APT inside a word is not a designator | ['21 CAPTAIN WAY', ''] | ['21 CAPTAIN WAY', ''] | Passed |
SHA-256 / 70ed427ff3ad7c9616720fad20b0f71c4c8db2b0eb365cde78fcb9d10f8772b7
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 9 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 contract over synthetic, obviously fictitious addresses. The rules are stipulated for this model only and make no claim of conformance with any postal authority standard. 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:52:17.778297+00:00.
Case digest / dac2d1c559e311da4ee74f0f11142125e95a96ee5a843b2f399f3ddee2c4c5b5