Whole file

allo-media/text2num

The author described this change as [de] fix: False positive ordinal detection. It counts as a record because the check below fails on the code as it stood at 55fe23ac2 and passes on 5c3589997, with nothing else changed between the two runs.

Fix saved2023-05-28
Sharing licenceMIT · LICENSE
Change size+7 0

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

[de] fix: False positive ordinal detection

The change

258258 # finish LAST group but keep token_index
259259 token_to_add = str(combined_num_result)
260260 token_to_add_is_num = True
261+ elif tmp_token_ordinal_org is not None:
262+ # revert ordinal
263+ sentence[len(sentence) - 1] = str(tmp_token_ordinal_org)
264+ token_index += 1
265+ token_to_add = " ".join(sentence)
266+ token_to_add_is_num = False
267+ current_token_ordinal_org = None
261268 else:
262269 # previous text was not a valid number
263270 # prep. for next group

The check that tells the two apart

failpass·tests/test_text_to_num_de.py::TestTextToNumDE::test_ordinals_false_positives

Check file tests/test_text_to_num_de.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 it55fe23ac282b9fa145e1f844e7a36de3abe65177
Broken version dated2023-05-26
Moduletext_to_num.transforms
Units changed_alpha2digit_agg
Fingerprint2e5848bd9518742a
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 allo-media/text2num