Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-alrux committed Mar 12, 2020
2 parents 9f4eb92 + 52c14c4 commit 93d7b2b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Expand Up @@ -3,8 +3,11 @@ sudo: false
matrix:
fast_finish: true
include:
- go: 1.11.x
- go: 1.14.x
env: TEST_METHOD=goveralls
- go: 1.13.x
- go: 1.12.x
- go: 1.11.x
- go: 1.10.x
- go: tip
- go: 1.9.x
Expand All @@ -14,6 +17,8 @@ matrix:
- go: 1.5.x
allow_failures:
- go: tip
- go: 1.11.x
- go: 1.10.x
- go: 1.9.x
- go: 1.8.x
- go: 1.7.x
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -11,7 +11,7 @@ This package implements distance and similarity metrics for strings, based on th

## Project Status

v1.2.2 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis.
v1.2.3 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis.

This package is being actively maintained. If you encounter any problems or have any suggestions for improvement, please [open an issue](https://github.com/agext/levenshtein/issues). Pull requests are welcome.

Expand Down
2 changes: 1 addition & 1 deletion levenshtein.go
Expand Up @@ -108,7 +108,7 @@ func Calculate(str1, str2 []rune, maxCost, insCost, subCost, delCost int) (dist,

for x := 0; x < l2; x++ {
dy, d[doff] = d[doff], d[doff]+insCost
for d[doff] > maxCost && dlen > 0 {
for doff < l1 && d[doff] > maxCost && dlen > 0 {
if str1[doff] != str2[x] {
dy += subCost
}
Expand Down
2 changes: 2 additions & 0 deletions levenshtein_test.go
Expand Up @@ -141,6 +141,8 @@ func Test_Metrics(t *testing.T) {
{"password", "pass1", "(minScore=0.6)", NewParams().MinScore(.6), e{4, 4, 0, 0, 0}},
{"password", "pass1wor", "(minScore=0.9)", NewParams().MinScore(.9), e{2, 4, 0, 0, 0}},
{"password", "password", "(minScore=1.1)", NewParams().MinScore(1.1), e{0, 8, 0, 0, 0}},
{"NetworkManager-glib-0.8.1-5.el6_0.1.i686.rpm", "NetworkManager-glib-0.9.3-15.el6_0.1.i686.rpm", "(minScore=0.92)", NewParams().MinScore(0.92), e{3, 22, 18, 42. / 45, 43.2 / 45}},
{"NetworkManager-glib-0.8.1-5.el6_0.1.i686.rpm", "gdm-plugin-fingerprint-2.30.4-39.el6.i686.rpm", "(minScore=0.92)", NewParams().MinScore(0.92), e{28, 0, 9, 0, 0}},

// The rest of these are miscellaneous examples. They will
// be illustrated using the following key:
Expand Down

0 comments on commit 93d7b2b

Please sign in to comment.