One function

find_similar_word in careless25/text2digits

The author described this change as Fix off-by-one error in find_similar_word. It counts as a record because the check below fails on the code as it stood at 55b5ca05f and passes on 15e16fbec, with nothing else changed between the two runs.

Fix saved2026-04-28
Sharing licenceMIT · LICENSE
Change size+3 3

What the code was meant to do, written into the code itself as a docstring

Returns the most syntactically similar word in the collection to the specified word.

The change

99 for item in collection:
1010 similarity = bigram_similarity(word, item)
1111
12- # The similarity must be above the threshold and if this is true for
13- # multiple words, we take the most similar one
14- if similarity > max(max_similarity, threshold):
12+ # The similarity must meet or exceed the threshold and if this is true
13+ # for multiple words, we take the most similar one
14+ if similarity >= threshold and similarity > max_similarity:
1515 match = item
1616 max_similarity = similarity
1717

The check that tells the two apart

failpass·tests/test_text_processing_helpers.py::TestFindSimilarWord::test_exact_threshold_is_accepted

Check file tests/test_text_processing_helpers.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 it55b5ca05f1b718ef29b22d7cecee274ef58f2feb
Broken version dated2026-04-28
Moduletext2digits.text_processing_helpers
Units changedfind_similar_word
Fingerprintf662e71fbb4aa59c
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in careless25/text2digits