Fix PDF compatibility ligature matching while preserving scientific distinctions - #81
Conversation
|
Claude finished @cmungall's task in 3m 33s —— View job Code review: PDF ligature matching
OverallGood, tightly-scoped fix. The key design decision — an explicit ligature table instead of blanket NFKC — is the right call and is well justified in both the docstring and the how-to doc. Folding at the single choke point ( Comments below, roughly by significance. Nothing here is a blocker. 1. The suggestion path still doesn't fold ligatures (medium)
This bites concretely in Two user-visible consequences:
Suggestion: extract the table into something like 2. The
|
|
Claude finished @cmungall's task in 2m 58s —— View job Review: PDF ligature matching (#81)
VerdictSolid, well-scoped change. The core decision — an explicit fold table instead of blanket NFKC — is the right one for this codebase, and the reasoning is documented where a future reader will actually hit it. Matching is purely normalized-substring ( Tests follow CLAUDE.md properly: real PLOS fixture, no mocks, ligatures injected on content/query/both × contiguous/split, negatives in both directions, plus an idempotency assertion ( Comments below are non-blocking. 1.
|
|
Claude finished @cmungall's task in 3m 26s —— View job Review: PDF ligature matching (#81)
VerdictGood change, and the two new commits since the last round improved it. The central design call — an explicit fold table rather than blanket NFKC — is the right one for a validator, where every new equivalence is a new class of quote you silently accept. The rationale is written down where someone about to "simplify" this to I traced every consumer of
All six are equality/containment on the normalized string; none maps an index back into the original text, so expansion changing string length is safe. Folding at the single choke point means all of them benefit at once.
Nothing below is a blocker. 1. The suggestion path still doesn't fold, and ligatures delete whole words there (medium)
The bite is in words = re.findall(r'\b[a-z0-9]+\b', normalized)
Two user-visible effects, both on the failure path:
Pre-existing, but this PR is what makes the matching layer and the explain-the-failure layer disagree about what a character is. Extracting a shared 2.
|
Summary
PDF-extracted
amyloid fibrilsnow matchesamyloid fibrilsthrough the existing publicnormalize_textmethod. An explicit table folds ff/fi/fl/ffi/ffl/ſt/st and compatibility IJ on both content and queries, including split excerpts and title validation.Æ/æ and Œ/œ remain distinct letters. Broad NFKC is deliberately avoided so scientific subscripts, superscripts, circled digits, and the micro sign do not acquire new validation equivalences. Existing Greek spelling, punctuation, and case handling are preserved. This is the explicit Latin ligature set requested in #73, not a rule to fold every Unicode compatibility character.
Closes #73.
Validation
just doctest: 202 passed.just mypy: passed (93 files);just format: passed.just test: 980 passed, mypy and Ruff passed on192a03e. An earlier run had 977 passed and 1 external-service failure.test_validate_title_partial_match_real_geocould not fetch GEO:GSE67472 because Entrez esearch returned HTTP 429 Too Many Requests. The unchanged test passed on retry (1 passed in 1.81s). No assertions or test selection were weakened.192a03e; automatic review passed with no blocking findings.Automatic review disposition
All three automatic reviews, including the final-head review, found no blockers. Added the suggested title coverage. Deferred Greek/table performance refactoring, fuzzy-suggestion normalization, repair-path expansion, and soft-hyphen/zero-width/standalone-long-s handling: these are pre-existing behavior or separate matching-policy changes outside this ligature fix. The micro-sign negative test deliberately pins existing behavior for this bounded change; it does not preclude a separately reviewed policy change later.
One review claimed NFKC leaves long-s unchanged and maps ſt to ſt; direct Python
unicodedata.normalizechecks instead giveNFKC("ſt") == "st"andNFKC("ſ") == "s". No change was warranted on that basis. The explicit table and documentation enumerate supported characters without claiming coverage of all Unicode compatibility digraphs.