Repository navigation
v7.1.0
Added
suggest, a checksum-anchored diagnostic-repair verb that turns the checksum from a gatekeeper into a repair engine. For a structurally-valid but checksum-failing identifier,SecID::<Type>.suggest(str)andSecID.suggest(str, types:)enumerate the plausible single-character human errors (visual/OCR homoglyph substitutions such asO↔0,I↔1,5↔S,8↔B, plus adjacent transpositions), keep only those that re-validate (valid?is the oracle, so no checksum-invalid candidate ever escapes, though a valid candidate is not necessarily the intended correction), and return them as confidence-rankedSecID::Suggestionvalue objects reporting what changed (edit kind, position, from/to characters, confidence tier). Available for all 9 checksum types (ISIN, CUSIP, SEDOL, FIGI, LEI, IBAN, CEI, DTI, UPI) through one sharedSuggestableconcern. Candidates rank:high(homoglyph) then:medium(transposition) then a:checksumrecompute fallback last; there is no:lowtier (coincidental substitutions are never generated), keeping results small and high-precision.suggestnever mutates its input and never presents a candidate as an authoritative correction. Non-checksum types (CIK, OCC, WKN, Valoren, CFI, FISN, BIC) have no checksum oracle and are unsupported;SecID.suggestsilently skips them. Known limitations: the mistyped character must be in the type's charset to be reachable (the vowel-free SEDOL/FIGI/DTI/UPI can't repair anO-for-0/I-for-1typo), only a single body error is in scope, and wrong-length input returns[]. In a seeded simulation (benchmark/suggest_precision.rb), every reachable single-error homoglyph or transposition that yields a checksum-failing identifier is recovered (the correct identifier is always among the returned candidates), the top-ranked body candidate ~89% of the time for homoglyph errors
Install
gem 'sec_id', '~> 7.1'Full changelog: https://github.com/svyatov/sec_id/blob/main/CHANGELOG.md#710---2026-07-15