containerd/vendor/github.com/xrash/smetrics
Derek Nola 132485adb0
Convert CLI to urfave v2
Followed the Migration Guide at https://cli.urfave.org/migrate-v1-to-v2/
The major changes not pointed out in the migration guide are:
- context.Args() no longer produces a []slice, so context.Args().Slice()
  in substitued
- All cli.Global***** are deprecated (the migration guide is somewhat
  unclear on this)

Signed-off-by: Derek Nola <derek.nola@suse.com>

Vendor in urfave cli/v2

Signed-off-by: Derek Nola <derek.nola@suse.com>

Fix NewStringSlice calls

Signed-off-by: Derek Nola <derek.nola@suse.com>
2024-02-15 09:48:04 -08:00
..
.travis.yml Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
doc.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
hamming.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
jaro-winkler.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
jaro.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
LICENSE Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
README.md Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
soundex.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
ukkonen.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00
wagner-fischer.go Convert CLI to urfave v2 2024-02-15 09:48:04 -08:00

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")
}