W3cubDocs

/Crystal 0.31

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, &block)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–2019 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.31.1/Levenshtein/Finder.html