class

Levenshtein::Finder

Inherits Reference / Object

Finds the closest string to a given string amongst many strings.

require "levenshtein"

finder = Levenshtein::Finder.new "hallo"
finder.test "hay"
finder.test "hall"
finder.test "hallo world"

finder.best_match # => "hall"

Constructors

new(target : String, tolerance : Int | Nil = nil)
Source

Class methods

find(name, tolerance = nil, &)
Source
find(name, all_names, tolerance = nil) : String | Nil
Source

Instance methods

best_match
Source
test(name : String, value : String = name)
Source