-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix incorrect result normalization in setratio and seqratio
- Loading branch information
1 parent
4d12d5c
commit d78528d
Showing
8 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Levenshtein | ||
|
||
|
||
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0): | ||
return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) | ||
|
||
|
||
def test_documented(): | ||
""" | ||
run tests from documentation | ||
""" | ||
ratio = Levenshtein.seqratio( | ||
["newspaper", "litter bin", "tinny", "antelope"], | ||
["caribou", "sausage", "gorn", "woody"], | ||
) | ||
assert isclose(ratio, 0.21517857142857144) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Levenshtein | ||
|
||
|
||
def isclose(a, b, rel_tol=1e-09, abs_tol=0.0): | ||
return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) | ||
|
||
|
||
def test_documented(): | ||
""" | ||
run tests from documentation | ||
""" | ||
ratio = Levenshtein.setratio( | ||
["newspaper", "litter bin", "tinny", "antelope"], | ||
["caribou", "sausage", "gorn", "woody"], | ||
) | ||
assert isclose(ratio, 0.2818452380952381) |