Ruby's did_you_mean matcher in pure Go — Jaro–Winkler & Levenshtein spelling suggestions, MRI byte-exact, no cgo.
🌐 Website · 📚 Documentation
go-ruby-did-you-mean is a pure-Go (no cgo) reimplementation of the matcher at the heart of Ruby's did_you_mean standard library — MRI's DidYouMean::SpellChecker#correct and the two string-distance metrics it ranks with, Jaro–Winkler and Levenshtein. Given a mistyped word and a dictionary it returns Ruby's exact ranked list of spelling suggestions — a faithful, byte-for-byte port of upstream spell_checker.rb, jaro_winkler.rb and levenshtein.rb, without any Ruby runtime. It is a standalone, reusable module — a sibling of go-ruby-yaml, go-ruby-regexp and go-ruby-erb — and the did_you_mean matcher for go-embedded-ruby.
| Repo | What it is |
|---|---|
| did-you-mean | the library: Ruby's did_you_mean in pure Go |
| docs | MkDocs Material documentation, versioned with mike, served at /docs/ |
| go-ruby-did-you-mean.github.io | the Hugo landing page |
| brand | logos and brand assets |
- Pure Go, zero cgo. Cross-compiles and embeds anywhere; a static binary by default.
- Extracted from rbgo, reusable by anyone. A standalone library that
rbgobinds as a native module, the same pattern as go-ruby-regexp and go-ruby-erb. - MRI byte-exact. Output matches reference Ruby exactly, validated by a
differential oracle against the
rubybinary. - Standalone & reusable. No dependency on the Ruby runtime; the dependency runs the other way.
- 100% test coverage is the target, enforced as a CI gate.
Complete — MRI byte-exact. Faithful, line-for-line port of Ruby's DidYouMean::SpellChecker#correct: normalization, the Jaro–Winkler filter and ranking, the Levenshtein mistype filter, and the misspell fallback, with both metrics comparing Unicode code points. Validated by a differential oracle against the system ruby — every ranked array reproduced byte-for-byte.
Differential-tested against MRI at 100% coverage, gofmt + go vet clean, CI
green across the six 64-bit Go targets (amd64, arm64, riscv64, loong64, ppc64le,
s390x) and three operating systems. It is bound into the
go-embedded-ruby (rbgo) ecosystem
as a native module.
BSD-3-Clause.
