Project

symspell

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby port of the symetric spell checking algorithm
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Synopsis

The Symmetric Delete spelling correction algorithm reduces the complexity of edit candidate generation and dictionary lookup for a given Damerau-Levenshtein distance.

Same license as original (LGPL-3.0).

About this port

This is a straight port of SymSpell from C# to Ruby. I've started moving things around a bit and also turned it into a gem.

Original source with inline comments and README is here: https://github.com/wolfgarbe/symspell.

I've changed very little from the original source (apart from removing the commandline interface) but please note it has only some very basic end to end tests at this time.

Usage

gem install symspell

require 'symspell'

speller = SymSpell.new <EDIT_DISTANCE_MAX> <VERBOSE>
speller.create_dictionary %w(joe jo mark john peter mary andrew imogen)
speller.lookup 'jo'

EDIT_DISTANCE_MAX

EDIT_DISTANCE_MAX is the number of operations needed to tranform one string into another.

For example the edit distance between CA and ABC is 2 because CA => AC => ABC. Edit distances of 2-5 are normal. Note, however, increasing EDIT_DISTANCE_MAX exponentially increases the combinations and therefore the time it takes to create the dictionary.

VERBOSE

  • 0 - Return the top suggestion
  • 1 - Return the suggestions with the lowest edit distance
  • 2 - Return all suggestions