W3cubDocs

/Crystal

class Levenshtein::Finder

Overview

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"

Defined in:

levenshtein.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

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

Class Method Detail

def self.find(name, tolerance = nil, &)Source

def self.find(name, all_names, tolerance = nil)Source

Instance Method Detail

def best_matchSource

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

© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/Levenshtein/Finder.html