• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H03-May-2022-

tests/H16-Dec-2020-

.travis.ymlH A D16-Dec-2020107

LICENSEH A D16-Dec-20201.1 KiB

README.mdH A D16-Dec-20201.2 KiB

doc.goH A D16-Dec-2020687

hamming.goH A D16-Dec-2020544

jaro-winkler.goH A D16-Dec-2020999

jaro.goH A D16-Dec-20202 KiB

soundex.goH A D16-Dec-2020839

ukkonen.goH A D16-Dec-20202.3 KiB

wagner-fischer.goH A D16-Dec-20201.1 KiB

README.md

1[![Build Status](https://travis-ci.org/xrash/smetrics.svg?branch=master)](http://travis-ci.org/xrash/smetrics)
2
3# smetrics
4
5`smetrics` is "string metrics".
6
7Package smetrics provides a bunch of algorithms for calculating the distance between strings.
8
9There 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.
10
11# How to import
12
13```go
14import "github.com/xrash/smetrics"
15```
16
17# Documentation
18
19Go to [https://pkg.go.dev/github.com/xrash/smetrics](https://pkg.go.dev/github.com/xrash/smetrics) for complete documentation.
20
21# Example
22
23```go
24package main
25
26import (
27	"github.com/xrash/smetrics"
28)
29
30func main() {
31	smetrics.WagnerFischer("POTATO", "POTATTO", 1, 1, 2)
32	smetrics.WagnerFischer("MOUSE", "HOUSE", 2, 2, 4)
33
34	smetrics.Ukkonen("POTATO", "POTATTO", 1, 1, 2)
35	smetrics.Ukkonen("MOUSE", "HOUSE", 2, 2, 4)
36
37	smetrics.Jaro("AL", "AL")
38	smetrics.Jaro("MARTHA", "MARHTA")
39
40	smetrics.JaroWinkler("AL", "AL", 0.7, 4)
41	smetrics.JaroWinkler("MARTHA", "MARHTA", 0.7, 4)
42
43	smetrics.Soundex("Euler")
44	smetrics.Soundex("Ellery")
45
46	smetrics.Hamming("aaa", "aaa")
47	smetrics.Hamming("aaa", "aab")
48}
49```
50