项目作者: xrash

项目描述 :
String metrics library written in Go.
高级语言: Go
项目地址: git://github.com/xrash/smetrics.git
创建时间: 2013-11-04T21:06:56Z
项目社区:https://github.com/xrash/smetrics

开源协议:MIT License

下载


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

  1. import "github.com/xrash/smetrics"

Documentation

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

Example

  1. package main
  2. import (
  3. "github.com/xrash/smetrics"
  4. )
  5. func main() {
  6. smetrics.WagnerFischer("POTATO", "POTATTO", 1, 1, 2)
  7. smetrics.WagnerFischer("MOUSE", "HOUSE", 2, 2, 4)
  8. smetrics.Ukkonen("POTATO", "POTATTO", 1, 1, 2)
  9. smetrics.Ukkonen("MOUSE", "HOUSE", 2, 2, 4)
  10. smetrics.Jaro("AL", "AL")
  11. smetrics.Jaro("MARTHA", "MARHTA")
  12. smetrics.JaroWinkler("AL", "AL", 0.7, 4)
  13. smetrics.JaroWinkler("MARTHA", "MARHTA", 0.7, 4)
  14. smetrics.Soundex("Euler")
  15. smetrics.Soundex("Ellery")
  16. smetrics.Hamming("aaa", "aaa")
  17. smetrics.Hamming("aaa", "aab")
  18. }