levenshtein

package
v9.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2019 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is the object which allows to calculate the Levenshtein distance with Distance() method. It is needed to ensure 0 memory allocations.

func (*Context) Distance

func (c *Context) Distance(str1, str2 string) int

Distance calculates the Levenshtein distance between two strings which is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character http://en.wikipedia.org/wiki/Levenshtein_distance

This implementation is optimized to use O(min(m,n)) space. It is based on the optimized C version found here: http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#C

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL