#levenshtein #spell-checker #word #verbose #distance #target #arguments

bin+lib sporky-checker

Simple levenshtein spell checker app

2 stable releases

new 1.0.1 Dec 18, 2024
1.0.0 Dec 17, 2024

#3 in #verbose

Download history 194/week @ 2024-12-13

194 downloads per month

Apache-2.0

1.5MB
129 lines

Spork Checker

Rust

A very simple Levenshtein-based spell checker that finds approximate matches for a given word by comparing to a word list. Implemented in rust.

Features

  • Levenshtein Distance: Uses Levenshtein Algorithm to calculate possible matches
  • Customizable output: Verbose and matches options

Crates

  • Clap: Makes CLI argument parsing easier
  • Rust-Embed: Allows building of data folders directly into binary

Installation

Prerequisites

  • Rust installed on your system. You can install it using rustup.

Build and Run

From crates.io:

  • cargo install sporky-checker

From source:

  1. Clone this repository:
git clone https://github.com/SporkyDevelops/Sporky-levenshtein.git
cd Sporky-levenshtein
  1. Build the project:
cargo build --release
  1. Run the application:
cd /target/release/
./spork-checker

Usage

spork-checker [OPTIONS] [TARGET]

Arguments

[TARGET]: The target word to check against the word list.

Options

  • -v, --verbose: Show detailed output, including the Levenshtein distance for each match.
  • -n, --number [NUMBER]: Specify the number of matches to display (default: 5).

Example

Input:

spork-checker ruzt -n 1

Output:

Possible Matches: 
- 'rust'

Word List

The application reads a word list from en.txt. This files is built into the binary, if not specify the path in the read_word_list function.

Equation

(i-1, j) deletion
(i, j-1) insertion
(i-1, j-1) substitution

Matrix Example

Source: Datumorphism Photo source: Datumorphism

Author

Sporky Develops

Dependencies

~2.6–9.5MB
~78K SLoC