Repository navigation
Add a pairs view to the local corpora - #852
Merged
Merged
Conversation
`local_corpora.py pairs SOURCE` reads a paired source (tse-donors, whose records carry the tax registry's name beside the filed one) as two spellings of one person: it sorts each pair by the first shape that fits (case, accents, punctuation, reordered, words left out, added, shortened, misspelled, left out and shortened, mostly the same, few in common) and lists the words most often left out and added, counts and words only, a word shared by fewer than 10 pairs not listed. `--agreement` parses both spellings of each pair that differs and counts the pairs whose readings end the family name in the same word. Accents-only pairs cannot move a surname, so their disagreements are the parser reading one name two ways: 1,310 of 43,724 on tse-donors (2026-10-22), JÚNIOR/JUNIOR (#843) and SÁ/SA. The README records the breakdown, mechanisms.md#NAME-DATA-JOBS the move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit was squashed onto a master that had moved past the branch's base, so it reverted #846. Every file but the four this branch changes is taken back from master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #852 +/- ##
=======================================
Coverage 99.05% 99.05%
=======================================
Files 47 47
Lines 4669 4669
=======================================
Hits 4625 4625
Misses 44 44 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…airs-view # Conflicts: # docs/design/mechanisms.md # tools/differential/README.md # tools/differential/local_corpora.py
- Two readings with no family name no longer count as sharing a
surname ("" == "" had agreed).
- A word left out or added counts once per pair, as the report and the
ten-pair floor say; a word left out once of two copies still counts.
- Accents only now means the case is unchanged; accents with case get
their own shape, and a filed name with no word has its own too.
Words run together are spacing, not a changed word.
- --agreement lists the accents-only pairs read with two surnames by
the two spellings' last words, under the same floor, so the README's
JÚNIOR/JUNIOR and SÁ/SA figures come from the command.
- An empty corpus is refused with its own message.
- Tests: each new shape, the misspelling limit on both sides, the order
of shortened before misspelled and of the words in left out and
shortened, the mostly-the-same threshold, --top, the share column,
--agreement through main, the floor on added words, mixed records;
32 branches mutated out, each failing a test.
- README and mechanisms.md re-measured on the 2026-10-22 fetch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds
local_corpora.py pairs SOURCE, the follow-up planned in #841. It reads a paired source (tse-donors, whose records carry the tax registry's name beside the filed one) as two spellings of one person.What it does
pair_shapeis a pure function with one invented pair per shape and rows at each edge.PAIR_WORD_FLOOR) is not listed, since it could be one family's.--agreement: parses both spellings of each pair with a reference name that differs and counts, per shape, the pairs whose readings end the family name in the same word (surname()). Two readings with no family name share none.tse-donorson 2026-10-22.Findings on
tse-donors(fetch of 2026-10-22)205,925 of 854,531 pairs differ:
DE(left out of 13,412 pairs),DA(5,906) andDOS(3,033), then second surnames such asSILVA(2,869).JÚNIOR/JUNIORin 866 pairs, which is Should José Silva Júnior read Júnior as a suffix, as José Silva Junior does, and where do Filho, Neto and Sobrinho belong? #843.SÁ/SAin 255 pairs, a new finding (now also a comment on Should José Silva Júnior read Júnior as a suffix, as José Silva Junior does, and where do Filho, Neto and Sobrinho belong? #843).sais a listed credential with no may-be-a-name marking, soMARIA DE SAreads familyDE, suffixSA, whereMARIA DE SÁreads familyDE SÁ.JOAO SAreads no family at all.Docs
Review
One round with three reviewers (code, tests, comments), addressed in 93a1999:
Verification
tests/v2/test_local_corpora.py.The branch's first commit was squashed onto a moved master and reverted #846; the second restores those files, and the PR's diff against master is only the four files above.
No parser behavior or vocabulary changes.
🤖 Generated with Claude Code