fuzzy

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditDistance added in v0.3.5

func EditDistance(s1, s2 string) 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 os spaces between words was already normalized to 1 space, and that s1 and s2 always have the same number of words.

func GetTrie

func GetTrie(triePath string, db *sql.DB) *levenshtein.MinTree

GetTrie generates an in-memory trie for levenshtein automata. Such tree can either be constructed from database or from a dump file. The tree consists stemmed canonical forms of _gnames_ database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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