Documentation
¶
Overview ¶
Package fuzzy provides fuzzy matching of scientific names, shared by gnmatcher and gndb, so they make exactly the same decisions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EditDistance ¶
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.
Types ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie finds strings that are close to a given string. It is a wrapper of levenshtein automata, gnmatcher and gndb build it from stemmed canonical forms.
func NewTrieWrite ¶
NewTrieWrite creates a Trie and saves it to w, so LoadTrie can restore it later. The names must be unique and sorted by bytes.