lev

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package levenshtein implements a levenshtein distance algorithm.

Index

Constants

View Source
const (
	DefaultInsertCost     = 0.3
	DefaultRemoveCost     = 3
	DefaultReplaceCost    = 2
	DefaultAppendCost     = 0.1
	DefaultCaseChangeCost = 0.01
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Algo

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

func New

func New(opts ...Option) *Algo

func (*Algo) Distance

func (a *Algo) Distance(ctx context.Context, from, to string) float64

type Option

type Option func(cost) cost

func WithAppendCost

func WithAppendCost(apnd float64) Option

func WithCaseChangeCost

func WithCaseChangeCost(chng float64) Option

func WithChangeCost

func WithChangeCost(chng float64) Option

func WithInsertCost

func WithInsertCost(inst float64) Option

func WithMax

func WithMax(max float64) Option

func WithRemoveCost

func WithRemoveCost(rmv float64) Option

Jump to

Keyboard shortcuts

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