Repository navigation
Add config_diff.py: compare parser configurations in one tree, in parallel - #1025
Merged
Merged
Conversation
…allel `config_diff.py diff` parses the committed corpora or any fetched local corpus (filtered by country or nationality, a regex, a hash sample) under two or more named configurations -- default, plain:<items>, strict:<items> (a pack in capitals, a language tag in lower case) or expr:<python> -- through snapshot.parallel, and reports the names that moved against the first, grouped by the fields that changed, with the words whose role changed ranked. --readings writes every name's readings one line a name, so runs in two trees compare line by line. `config_diff.py gaps` is the strict-gap report on top of it: each language tag's plain choice against its strict one over the records of the countries the language is written in (WRITTEN_IN, a measurement aid only), scored against the ORCID, PatentsView and PSC boxes, with the words strict reads differently ranked by records broken. The layering test's recorded control moves from 16 tool reads to 19: the new tool compares two lexicons set by set through `_sets`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…country tables) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # tests/v2/test_layering.py
…p, hints) 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.
What
tools/differential/config_diff.py, a general tool for the measurement several recent PRs each wrote a single-process throwaway script for (#1000, #1005, #1017, #1019): parse the corpora under two or more configurations of the same tree and report what moves.snapshot.py --localcompares two trees under one configuration andlocal_agreement.pyscores one configuration against filed boxes; neither compared configurations.diff SPEC SPEC...: a SPEC isdefault,plain:<items>,strict:<items>orexpr:<python>.plain:andstrict:areparser_forover the items joined by+: a shipped pack in capitals such asESorPT_BR, or a bare language tag in lower case. Region tags such aspt-BRanden-GBwork, since a bare choice carries a constant code.expr:covers any other lexicon or policy. The first is the baseline.corpus*.jsonl(each name under its shape's order) or any fetched local corpus (--local SOURCE/all).--groupis a fielded corpus's country or nationality, as the corpus writes it. It needs--local, and it refuses--committedand a group no record holds. With--local allit reads the fielded corpora only and says so.--match REGEX(found anywhere in the name),--sample N(snapshot's hash sample).generation,credentials,patronymic,surname2). Reports moves per input, grouped by changed fields, and the words whose token changed role, ranked with an example.--jsonwrites the counts and the moved names.--readingswrites every name's readings, one sorted line a name, so runs in two trees compare line by line.gaps [tag...]: the per-language strict-gap report. For each language tag a choice can name, the plain choice againststrict=True, over the records of the countries the language is written in, from ORCID, PatentsView and PSC. Both are scored against the filed boxes.besidecolumn counts the broken records a word merely stood in.LANGUAGES_OF(ISO 3166-1, plus ISO 3166-2 for the UK's nations) andNATIONALITY(PSC's spellings). They are a measurement aid only: decisions/vocabulary-model forbids a run-time country table.bo,yi).snapshot.parallel: spawned workers, each building a configuration once from its spec string, with the segmenter warning suppressed there too, and refusing a nameparser from outside the tree.Docs: a paragraph and two examples in
tools/differential/README.md("Measuring a change"), a pointer fromnameparser/vocab/README.md, and a rootAGENTS.mdparagraph telling the next measurement to reach for this instead of a script.tests/v2/test_layering.py's recorded negative control moves from 16 tool reads to 19:gapscompares two lexicons set by set through_sets.Review round (22234c1)
An independent review found five defects; each is fixed with a test.
plain:RU'sIvan Ivanovich Petrovmoves only inpatronymic.gapscredited a break to every differing word in the name. pt'sdawas credited with 45 breaks, where its own token moved in 1; theMissbeside it broke the rest.--groupwas silently ignored or mixed with unfiltered names.Nits fixed: the README's example regex now has
\b; anexpr:that raises is a usage error; one test runs throughmain(). Three surviving mutants are now killed, each checked by mutating the file:search→matchingather, the per-name dedup intally, andp.fields == s.fields→p == sinscore_gaps.Measured (2026-11-03, Python 3.11, 12 cores shared with other sessions)
gaps, all 83 tags, before the review fixes: 447 s wall, 956 s user, under load averages of 46 to 97.diffof 162 configurations over the 29,097 local-corpus names holdingingormba, about 4.7M parses: 271 s and 281 s in two trees.gapsafter item 3. Credits change little where the word itself moved (filde474 → 473, cade636 → 626, side332 → 334, pt-BRjr183 andjunior151) and fall where it only co-occurred (ptda45 → 1, pt-BRda23 → 0, ptdo6 → 0).msbreaks 38,117 records across tags, de'sjr48, ar'ssultan227.Tests
tests/v2/test_config_diff.py(41 tests) covers the tool's logic, not its numbers.uv run pytest -qpasses (35,276), as douv run mypy,uv run ruff checkand CI on 3.11 to 3.15. Not run:-n0 -m serial(the change touches no library code).The vocabulary change this tool's report fed (
ms,miss,mba) is #1028.🤖 Generated with Claude Code