mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 11:50:00 +02:00
⚡️ dinglehopper: Improve performance by caching the Levensthein matrix
Motivated by [a pull request](https://github.com/qurator-spk/dinglehopper/pull/7) by @JKamlah, implement a cache of the Levensthein matrix calculation. We calculated the Levenshtein matrixes for characters and words twice: Once for the error rates, once for the alignment.
This commit is contained in:
parent
11a6341641
commit
58ff140bc0
2 changed files with 18 additions and 3 deletions
|
@ -96,6 +96,9 @@ def test_lines_similar():
|
|||
def __repr__(self):
|
||||
return 'SimilarString(\'%s\')' % self._string
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self._string)
|
||||
|
||||
result = list(seq_align(
|
||||
[SimilarString('This is a line.'), SimilarString('This is another'), SimilarString('And the last line')],
|
||||
[SimilarString('This is a ljne.'), SimilarString('This is another'), SimilarString('J u n k'), SimilarString('And the last line')]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue