Whole file
miso-belica/sumy
The author described this change as “Fixed wrong ordering of significant words in Luhn”. It counts as a record because the check below fails on the code as it stood at f9107bd69 and passes on d0a55c45a, with nothing else changed between the two runs.
Projectmiso-belica/sumy
Fix saved2013-03-17
Sharing licenceApache-2.0 · LICENSE.md
Change size+1 −1
What the code was meant to do, written into the code itself as a save note
Fixed wrong ordering of significant words in Luhn
The change
| 30 | 30 | if w not in self._stop_words) | |
| 31 | 31 | ||
| 32 | 32 | # sort words by number of occurrences | |
| 33 | - | words = sorted((c, w) for w, c in Counter(words).items()) | |
| 33 | + | words = sorted(((c, w) for w, c in Counter(words).items()), reverse=True) | |
| 34 | 34 | ||
| 35 | 35 | # take only best `significant_percentage` % words | |
| 36 | 36 | best_words_count = int(len(words) * self.significant_percentage) |
The check that tells the two apart
fail→pass·tests/test_luhn.py::TestSentenceRating::test_significant_words
Check file tests/test_luhn.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itf9107bd69e6b05766dd76ee9f268c359cca9a280
Broken version dated2013-03-17
Modulesumy.algorithms.luhn
Units changedLuhnMethod
Fingerprint8ee40217e31a8f4f
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.