One function

generate_candidates in wan9yu/argus-redact

The author described this change as fix: zh person regex no longer over-matches common 3-char co-occurrences (closes #12). It counts as a record because the check below fails on the code as it stood at aad566e81 and passes on 2c00e1f0a, with nothing else changed between the two runs.

Fix saved2026-04-27
Sharing licenceApache-2.0 · LICENSE
Change size+4 1

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

Find all surname + 1-2 CJK sequences, filtered by negative dict. For 3-char single-surname matches, emits both 3-char and 2-char variants so that the scoring/resolution phase can pick the best one.

The change

1717 return
1818
1919 variants: list[NameCandidate] = []
20- if word not in neg:
20+ # If the 2-char prefix is a known non-name (e.g. "任何"), the 3-char
21+ # extension ("任何评") is almost never a real name either — issue #12.
22+ prefix_blocked = len(word) == 3 and not is_compound and word[:2] in neg
23+ if word not in neg and not prefix_blocked:
2124 variants.append(NameCandidate(text=word, start=start, end=end))
2225 # For 3-char single-surname matches, also offer the 2-char variant
2326 if len(word) == 3 and not is_compound:

The check that tells the two apart

failpass·tests/detection/lang/test_zh_fast_no_overmatch.py::TestIssue12VerbatimRepro::test_issue_12_repro_no_self_reference_or_overmatch

Check file tests/detection/lang/test_zh_fast_no_overmatch.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 itaad566e81ea310354f02184237b8a7fcebaa379b
Broken version dated2026-04-27
Moduleargus_redact.lang.zh.person
Units changedgenerate_candidates
Fingerprint99848a07ced6fb0f
Checked2026-08-18 by goldset/0.1

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