Skip to content

class Levenshtein::Finder
inherits Reference

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"

Class methods

.find(name, tolerance = nil

View source

.find(name, all_names, tolerance = nil)

View source

.new(target : String, tolerance : Int? = nil)

View source

Methods

#best_match

View source

#test(name : String, value : String = name)

View source