fuzzymatch

package
v0.0.0-...-1b56052 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2017 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LevenshteinDistance

func LevenshteinDistance(s1, s2 string) int

LevenshteinDistance calculate the levenshtein distance between two strings. I use an algorithm from Sten Hjelmqvist. http://www.codeproject.com/Articles/13525/Fast-memory-efficient-Levenshtein-algorithm You can also see the algorithm on wikipedia : https://en.wikipedia.org/wiki/Levenshtein_distance It's the last code.

func PartialRatio

func PartialRatio(s1, s2 string) int

PartialRatio allow you to calculate the "best partial" ratio. It takes the smaller string and we compare the smaller with a partial string from the bigger one. Could be useful if you have to compare two strings with very different length

func Ratio

func Ratio(s1, s2 string) int

Ratio allow you to calculate the percentage of variance between two strings if the two strings are equals the function returns 1.

func TokenSetRatio

func TokenSetRatio(s1, s2 string) int

TokenSetRatio splits the strings in two groups : intersection and remainder and then we compare the group with each other.

func TokenSortRatio

func TokenSortRatio(s1, s2 string) int

TokenSortRatio allow you to compare two strings "ordered" alphabetically so if you have two strings not ordered. This function could be useful.

Types

This section is empty.

Jump to

Keyboard shortcuts

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