A fast, intelligent spell checker and text correction CLI tool written in Go. Spellio provides advanced spell checking with frequency-weighted suggestions, keyboard-aware corrections, and support for contractions and possessives.
- Smart Spell Checking - Uses frequency-weighted suggestions for more natural corrections
- Pattern-Based Corrections - High-confidence fixes for common misspellings (i before e, double letters, etc.)
- Keyboard-Aware Corrections - Understands common typing mistakes based on keyboard layout
- Contraction Handling - Automatically corrects contractions like
cantβcan't - Possessive Support - Handles possessive forms like
word's - Multiple Modes - Single word checking, sentence correction, and interactive mode
- Autocompletion - Intelligent word completion based on prefixes
- Case Preservation - Maintains original capitalization in corrections
Download the latest release from the releases page and place it in your PATH.
# Clone the repository
git clone https://github.com/sugar/spellio.git
cd spellio
# Build the binary
go build -o spellio
# Optionally, install to your PATH
sudo mv spellio /usr/local/bin/- Go 1.24.4 or later (for building from source)
- Word dictionary files are included in the
resources/directory
NAME:
spellio - A spell checker and text correction tool
USAGE:
spellio [global options] command [command options]
VERSION:
1.0.0
COMMANDS:
check Check if a word is spelled correctly
complete Suggest completions for a prefix
correct Suggest corrections for a misspelled word
sentence, s Check and correct all words in a sentence
interactive, i Start interactive spell checking session
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
Check if a word is spelled correctly:
$ spellio check hello
'hello' is spelled correctly.
$ spellio check mispelled
'mispelled' is incorrect.
Did you mean: misspelled?Get correction suggestions for misspelled words:
$ spellio correct recieve
Suggestions:
- receive
- relieve
- believe
- recieved
- recipe
$ spellio correct definately
Suggestions:
- definitely
- definatly
- delicately
- definitly
- definitlyGet word completions for a prefix:
$ spellio complete prog
Suggestions:
- program
- programs
- programme
- programming
- progressCheck and correct entire sentences:
$ spellio sentence "I recieve your mesage and will respnd soon"
Found 3 words in need of correction in your sentence:
I (receive) your (message) and will (respond) soon
$ spellio sentence "This sentence is correct"
Your sentence is correct!Start an interactive spell-checking session:
$ spellio interactive
Welcome to spellio-interactive!
Type ':help' for a list of commands.
Spellio > hello
'hello' is spelled correctly!
Spellio > :complete prog
Suggestions: program, programs, programme, programming, progress
Spellio > :help
Available commands:
:check <word> Check if a word is spelled correctly (alias: :ch)
:complete <prefix> Get autocomplete suggestions for a prefix (alias: :c, :comp)
:correct <word> Get correct spelling suggestions for a word (alias: :cor)
:sentence <text> Check and correct all words in a sentence (alias: :sent)
:clear Clear the screen (alias: :cls)
:help Show this help message (alias: :h)
:quit/:exit Exit the program (alias: :q)
Default modes:
- Enter a single word to check spelling and get corrections
- Enter multiple words to check and correct the entire sentence
Spellio > :quit
Goodbye!Spellio follows idiomatic Go package structure with clear separation of concerns:
-
Spell Checking Engine (
internal/spellcheck/)- Word Trie data structure for efficient word storage and lookup
- O(m) time complexity for word checking (where m = word length)
- Frequency-weighted correction algorithms
- Pattern-based corrections for common misspellings
- Support for contractions and possessive forms
-
CLI Interface (
internal/command/)- Command handlers for all CLI operations
- Interactive mode with command processing
- Sentence parsing and correction feedback
-
Edit Distance Algorithms (
levenshtein/)- Public package implementing Wagner-Fischer algorithm
- Standard Levenshtein distance with optimizations
- Keyboard-aware distance for adjacent key typos
- Early termination and reduced memory usage
- Dictionary:
resources/english_words_freqs.txtcontains frequency-weighted word data - Pattern Matching: Built-in dictionaries for contractions and common misspellings
Spellio uses a sophisticated multi-factor scoring system:
- Edit Distance - Standard Levenshtein distance for character-level changes
- Word Frequency - More common words receive higher priority
- Keyboard Proximity - Adjacent key mistakes are weighted as less severe
- Pattern Recognition - High-confidence corrections for known misspelling patterns
Scoring Formula: score = distance - log10(frequency) * 0.6
Lower scores indicate better corrections, with pattern-based corrections receiving confidence boosts.
$ spellio correct teh
Suggestions:
- the
- to
- tech
- tel
- be
$ spellio correct seperate
Suggestions:
- separate
- operate
- generate
- separated
- desperate$ spellio correct cant
Suggestions:
- can't
$ spellio correct youre
Suggestions:
- you're$ spellio correct heloo # 'o' and 'l' are adjacent on keyboard
Suggestions:
- hello
- help
- below
- held
- helpsspellio/
βββ main.go # Application entry point
βββ go.mod # Go module definition
βββ internal/ # Private packages
β βββ command/
β β βββ commands.go # CLI command handlers and interactive mode
β βββ spellcheck/ # Core spell checking engine
β βββ trie.go # Trie data structure and basic operations
β βββ correction.go # Spell correction algorithms
β βββ suggestions.go # Autocompletion functionality
β βββ dictionaries.go # Contractions and misspelling patterns
β βββ loader.go # Word data loading
βββ levenshtein/ # Public edit distance package
β βββ wagner_fischer.go # Wagner-Fischer algorithm implementation
βββ resources/ # Word data files
βββ words.txt # Dictionary of valid English words
βββ english_words_freqs.txt # Frequency-weighted word data
main.go: Minimal entry point that initializes the spell checker and CLI frameworkinternal/: Private packages following Go conventions for internal-only codecommand/: All CLI command logic, including interactive mode processingspellcheck/: Core spell checking engine with modular file organization
levenshtein/: Public package that could be reused by other projectsresources/: Static data files for word dictionaries and frequency data
Feedback is welcomed! Please feel free to submit a pull request or open an issue.
# Clone the repository
git clone https://github.com/sugar/spellio.git
cd spellio
# Install dependencies
go mod tidy
# Build and test
go build -o spellio
./spellio check testThis project is licensed under the MIT License - see the LICENSE file for details.
- Built with the excellent urfave/cli library
- Uses frequency data derived from common English text corpora
- Implements the Wagner-Fischer algorithm for efficient edit distance calculation
Need help? Found a bug? Please open an issue!