fuzzy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditDistance

func EditDistance(str, ref string, noCheck bool) int

EditDistance calculates edit distance (**ed**) according to Levenshtein algorithm. It also runs additional checks and if they fail, returns -1.

Checks: - result should not exceed maxEditDistance - number of characters divided by ed should be bigger than charsPerED

It assumes that checks have to be applied only to the second string:

EditDistance("Pomatomus", "Pom atomus")

returns -1

EditDistance("Pom atomus", "Pomatomus")

returns 1

It also assumes that number of spaces between words was already normalized to 1 space, and that s1 and s2 always have the same number of words.

Types

type Fuzzy

type Fuzzy interface {
	Init([]record.Record) error
	FindExact(string) []string
	FindFuzzy(string) []string
}

func New

func New() Fuzzy

Jump to

Keyboard shortcuts

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