fix: safely support CJK title and author identity matching - #20
Merged
Conversation
…fold; add full CJK name equality check for leading author matching
- normalize_title(): replace ASCII-only a-z0-9 filter with unicodedata.normalize("NFKC") + character.isalnum() to retain CJK/Unicode characters
- _full_leading_author_matches(): add NFKC+casefold full-name equality check before falling back to per-part comparison
- _leading_author_status(): add normalized full-name equality as a match condition alongside family-name key comparison
Fixes source_pdf_mismatch false negatives for Chinese-titled papers (e.g. same title/author previously scored title_similarity=0.0, leading_author=conflict).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
4bbb16f) from @xzjncuRoot cause
The original ASCII-only title normalizer drops CJK characters, so identical Chinese titles score
0.0and single-token CJK author names can be reported as conflicts. PR #16 correctly identified that false-negative path.Applying
isalnum()globally, however, changes every caller of the shared title normalizer and can remove meaningful Unicode combining marks. It also exposes CJK names to the existing Western last-token author fallback, creating false-positive identity matches.This integration keeps the established normalizer intact and adds exact Unicode equality only at the identity comparison boundaries.
Contributor credit
This PR supersedes #16 while retaining @xzjncu's original authored commit in the merge history. The maintainer follow-up narrows the implementation and adds regression tests; it does not squash or rewrite the contributor commit.
Validation
5 passedtests/test_common.py:87 passed825 passed, 1 skippedpython -m compileall: passedgit diff --check: passed