status-go/vendor/github.com/xrash/smetrics
richΛrd 9e0fb30f8d
chore_: bump go-waku (#5150)
2024-05-15 19:15:00 -04:00
..
.travis.yml upgrade ethereum 2022-10-26 09:39:30 +02:00
LICENSE upgrade ethereum 2022-10-26 09:39:30 +02:00
README.md upgrade ethereum 2022-10-26 09:39:30 +02:00
doc.go upgrade ethereum 2022-10-26 09:39:30 +02:00
hamming.go upgrade ethereum 2022-10-26 09:39:30 +02:00
jaro-winkler.go upgrade ethereum 2022-10-26 09:39:30 +02:00
jaro.go upgrade ethereum 2022-10-26 09:39:30 +02:00
soundex.go chore_: bump go-waku (#5150) 2024-05-15 19:15:00 -04:00
ukkonen.go upgrade ethereum 2022-10-26 09:39:30 +02:00
wagner-fischer.go upgrade ethereum 2022-10-26 09:39:30 +02:00

README.md

Build Status

smetrics

smetrics is "string metrics".

Package smetrics provides a bunch of algorithms for calculating the distance between strings.

There are implementations for calculating the popular Levenshtein distance (aka Edit Distance or Wagner-Fischer), as well as the Jaro distance, the Jaro-Winkler distance, and more.

How to import

import "github.com/xrash/smetrics"

Documentation

Go to https://pkg.go.dev/github.com/xrash/smetrics for complete documentation.

Example

package main

import (
	"github.com/xrash/smetrics"
)

func main() {
	smetrics.WagnerFischer("POTATO", "POTATTO", 1, 1, 2)
	smetrics.WagnerFischer("MOUSE", "HOUSE", 2, 2, 4)

	smetrics.Ukkonen("POTATO", "POTATTO", 1, 1, 2)
	smetrics.Ukkonen("MOUSE", "HOUSE", 2, 2, 4)

	smetrics.Jaro("AL", "AL")
	smetrics.Jaro("MARTHA", "MARHTA")

	smetrics.JaroWinkler("AL", "AL", 0.7, 4)
	smetrics.JaroWinkler("MARTHA", "MARHTA", 0.7, 4)

	smetrics.Soundex("Euler")
	smetrics.Soundex("Ellery")

	smetrics.Hamming("aaa", "aaa")
	smetrics.Hamming("aaa", "aab")
}