levenshtein

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package levenshtein calculates the Levenshtein edit distance between strings.

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 (ctx *Context) Distance(str1, str2 string) int

Distance calculates the Levenshtein distance between two strings. It uses a bit-parallel algorithm (Myers) for strings up to 64 runes, providing significant performance speedup (SIMD-within-a-register). For longer strings, it falls back to the standard optimized DP algorithm.

Jump to

Keyboard shortcuts

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