1
0
Fork 0
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:
Gerber, Mike 2019-11-18 15:33:17 +01:00
parent 11a6341641
commit 58ff140bc0
2 changed files with 18 additions and 3 deletions

View file

@ -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')]