mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Update go dependencies (#3480)
* Bump golang.org/x/text from 0.3.7 to 0.3.8 Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.7 to 0.3.8. - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.3.7...v0.3.8) --- updated-dependencies: - dependency-name: golang.org/x/text dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Update go dependencies * Update x/net --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
28
vendor/github.com/xrash/smetrics/jaro-winkler.go
generated
vendored
Normal file
28
vendor/github.com/xrash/smetrics/jaro-winkler.go
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
package smetrics
|
||||
|
||||
import (
|
||||
"math"
|
||||
)
|
||||
|
||||
// The Jaro-Winkler distance. The result is 1 for equal strings, and 0 for completely different strings. It is commonly used on Record Linkage stuff, thus it tries to be accurate for common typos when writing real names such as person names and street names.
|
||||
// Jaro-Winkler is a modification of the Jaro algorithm. It works by first running Jaro, then boosting the score of exact matches at the beginning of the strings. Because of that, it introduces two more parameters: the boostThreshold and the prefixSize. These are commonly set to 0.7 and 4, respectively.
|
||||
func JaroWinkler(a, b string, boostThreshold float64, prefixSize int) float64 {
|
||||
j := Jaro(a, b)
|
||||
|
||||
if j <= boostThreshold {
|
||||
return j
|
||||
}
|
||||
|
||||
prefixSize = int(math.Min(float64(len(a)), math.Min(float64(prefixSize), float64(len(b)))))
|
||||
|
||||
var prefixMatch float64
|
||||
for i := 0; i < prefixSize; i++ {
|
||||
if a[i] == b[i] {
|
||||
prefixMatch++
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return j + 0.1*prefixMatch*(1.0-j)
|
||||
}
|
||||
Reference in New Issue
Block a user