-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from tmbdev/levenshtein
[econf] Handle possibility that filtered GT is empty
- Loading branch information
Showing
3 changed files
with
32 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env python | ||
|
||
from ocrolib import edist | ||
def testLevenshtein(a, b, should): | ||
if edist.levenshtein(a, b) == should: | ||
print 'ok - levenshtein(%s, %s) == %s' % (a,b,should) | ||
else: | ||
print 'not ok - levenshtein(%s, %s) == %s' % (a,b,should) | ||
testLevenshtein('a', 'a', 0) | ||
testLevenshtein('', '', 0) | ||
testLevenshtein('a', '', 1) | ||
testLevenshtein('', 'a', 1) | ||
testLevenshtein('aa', 'aaaaaa', 4) |