Skip to content

v7.1.0

Choose a tag to compare

@svyatov svyatov released this 15 Jul 08:16
· 38 commits to main since this release
16ff867

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) and SecID.suggest(str, types:) enumerate the plausible single-character human errors (visual/OCR homoglyph substitutions such as O↔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-ranked SecID::Suggestion value 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 shared Suggestable concern. Candidates rank :high (homoglyph) then :medium (transposition) then a :checksum recompute fallback last; there is no :low tier (coincidental substitutions are never generated), keeping results small and high-precision. suggest never 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.suggest silently 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 an O-for-0/I-for-1 typo), 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