Skip to content

Keep a FAMILY_FIRST base's order where a group's East Slavic patronymics are written last (Karimov Rustam Anvarovich) - #1399

Merged
derek73 merged 4 commits into
masterfrom
fix/issue-1356-family-first-patronymic-order
Nov 15, 2026
Merged

derek73 merged 4 commits into
masterfrom
fix/issue-1356-family-first-patronymic-order

Conversation

@derek73

@derek73 derek73 commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #1356

A group that decided the East Slavic patronymic rule was always given a GIVEN_FIRST order with it, on a family-first base too. A caller who had declared FAMILY_FIRST for a list written family first was moved to a setting that reads its names without a patronymic family-last (Aliyev Farrukh became given Aliyev, family Farrukh).

The rule

The base's order is kept on one branch only:

  • FAMILY_FIRST base, the names' own votes not deciding given-first, and more of the names carrying the patronymic writing it last (Sidorov Ivan Petrovich) than in the middle (Ivan Petrovich Sidorov): the suggestion keeps the order and suggests the rule alone. Under that order the rule reorders no name and fills the patronymic view. The names written the other way get no given-first order, and the patronymic evidence's note counts them.
  • Everything else is as on master: a tie or a middle majority under FAMILY_FIRST, any list under FAMILY_FIRST_GIVEN_LAST, and a given-first base get the given-first order with the rule.
  • A base already carrying the rule keeps its rule value on every branch. The Turkic rule, and a list mixing the two patronymic kinds, are unchanged.
>>> base = Parser(policy=Policy(name_order=FAMILY_FIRST))
>>> s = base.suggest(names)        # the issue's eleven names
>>> s.patch
PolicyPatch(patronymic_rules=frozenset({<PatronymicRule.EAST_SLAVIC: 'east-slavic'>}))
                                   # was also name_order=GIVEN_FIRST
>>> s.parser.parse("Karimov Rustam Anvarovich").patronymic
'Anvarovich'
>>> s.parser.parse("Aliyev Farrukh").family
'Aliyev'

Implementation choices beside it: a name writes the patronymic in the middle where its middle word carries the ending (the first of the vote's own two tests), last otherwise; a name with the ending on both words counts as middle, as rules/O1 reads it; names casting no East Slavic vote are not counted.

Why this form

Measured by parse on master:

  • Under a declared family-first order the rule's reordering stands down, but the view it fills does not: FAMILY_FIRST with the rule reads Sidorov Ivan Petrovich with the fields of FAMILY_FIRST alone, plus patronymic Petrovich.
  • FAMILY_FIRST_GIVEN_LAST reads the family of Sidorov Ivan Petrovich right and its given name wrong (given Petrovich). The rule alone does nothing there.
  • With a given-first order the rule reads both writings right, rotating the one written family first. What that order costs is the names with no patronymic in a list written family first.

The first form pushed here (commits 6a2c9e4, a9dacf7) kept the order of every family-first base. Independent review found it regressed against master in two places, both now tested:

list (five made-up names) base master first form now
Zzyvan Petrovich Qqsidorov (given, patronymic, family) FAMILY_FIRST given-first + rule, 5 of 5 whole names right rule alone, 0 of 5, a note saying the base "reads these names already" as master
QQSIDOROV Zzyvan Petrovich (family in capitals) FAMILY_FIRST_GIVEN_LAST rule + capitals_as_family, view filled on 5 capitals_as_family alone, view on 0 as master

Measured

uv run python tools/differential/suggest_measure.py --wrong-words 12 --base <an export of 8f4b77b9>, 2026-11-15, 300 groups a size, seed 20261110. Parliament rows are from the opensanctions-parliaments cache as fetched 2026-11-12, not re-fetched. Five rows moved against master, and nothing else:

row before after
pv-RU-patronymic (new: 8,393 Russian inventors whose given box holds a patronymic), written family-first, family-first base, share of groups right at 2 / 3 / 4 / 5 / 10 / 20 / 50 / 200 names 100 / 100 / 100 / 0.7 / 0.0 / 0.0 / 0.7 / 4.3 100 / 100 / 100 / 100 / 100 / 100 / 100 / 99.0
pv-RU (all Russian inventors), the same row 100 / 100 / 100 / 98.3 / 98.0 / 100 / 100 / 100 100 at every size
kz_senate (48), uz_senate (59), ua_rada (1,588), FAMILY_FIRST base order GIVEN_FIRST, decided with no order vote the base's order, undecided; rule decided as before
  • Under the given-first base and under FAMILY_FIRST_GIVEN_LAST every parliament row is identical to master's.
  • No other order cell, per-name or per-signal count, or TURKIC row moved.
  • Harness proof (--set _MIN_VOTES=1000000 --set _MIN_PATRONYMIC_VOTES=1000000 --set _MIN_RUN_NAMES=1000000): 0% on all 60 rows written against their base, 100% on all 60 written in it.

Whole names read right (family the first word and given name the second, by each list's convention), base / master's suggestion / this PR's:

list FAMILY_FIRST base FAMILY_FIRST_GIVEN_LAST base given-first base
kz_senate (48) 48 / 41 / 48 4 / 41 / 41 0 / 41 / 41
uz_senate (59) 59 / 52 / 59 5 / 52 / 52 0 / 52 / 52
ua_rada (1,588) 1,588 / 1,367 / 1,588 2 / 1,367 / 1,367 0 / 1,367 / 1,367

Under FAMILY_FIRST no field of any name moves against the base, and the patronymic view fills on 41, 52 and 1,367.

Field-level differential against master. The decisions entry names the eleven made-up lists (built from the invented triples in tests/v2/test_suggest.py) and the six base settings precisely enough to rebuild it: 198 made-up cases and 72 parliament cases, comparing the patch, every role field and the view of the suggested parser, and each note. The independent code review ran its own over 156,192 generated cases and found the same classes.

  • A patch or reading differs in 24 made-up cases and 3 parliament lists, all under FAMILY_FIRST, all lists whose patronymics are mostly written last.
  • Under the given-first and FAMILY_FIRST_GIVEN_LAST bases no patch and no reading differs. 12 cases there differ by one note's wording: where the names' votes decide family-first, the order note said the rule "stands down" and now says it "reorders no name".
  • No base setting changes which lists differ.

Accepted, recorded in decisions/group-suggestion (2026-11-15 #1356)

  • A list written mostly family first with a given-first minority keeps a FAMILY_FIRST base's order and leaves the minority under it, misread unless another setting of the patch reads it: five written last and three in the middle read 5 of 8 whole, where the forced order reads 8. The minority is every name written given first, with or without the patronymic: a two-word Wwyuri Wworlovin or a Turkic Yyegor Rasim oglu Yysokolan beside six names written last is read as the base reads it, where the forced order read it right. The note counts only the East Slavic names that write the patronymic in the middle.
  • FAMILY_FIRST_GIVEN_LAST bases get nothing from this change: kz_senate and uz_senate read 41 of 48 and 52 of 59 there, as on master.

Measured, and no cost: under the given-first base nothing changes.

Observed, recorded in the entry: a name written given, patronymic, family usually casts a given-first vote by its given name, and one written family, given, patronymic casts none. So two names written the first way can decide given-first by themselves, and the list then gets the given-first order with the rule: eight invented names written last keep the order beside Anna Petrovna Zzkarelina, and are moved once Igor Pavlovich Xxdorin joins her.

Not taken for 3.1 and not decided against, under Open:: for a mixed list, suggesting both rules ({EAST_SLAVIC, TURKIC} reads uz_senate 54/59 against 52/59) and reading the Kazakh -uly/-kyzy endings as a Turkic signal.

_MIN_PATRONYMIC_VOTES is unchanged, with what it decides now recorded: with --set _MIN_PATRONYMIC_VOTES=1 on this tree no same-order cell moves, and groups written given-first move a family-first base sooner (pv-RU-patronymic 53.3 / 83.7 / 94.7 / 100 to 100 at every size).

Tool

  • suggest_measure.py gains pv-RU-patronymic and reads every parliament list under FAMILY_FIRST_GIVEN_LAST as a third base. On master that population's same-order row shows the harm in full (the first table row).
  • Held by tests alone, and said so in the tool's docstring and the entry: a FAMILY_FIRST_GIVEN_LAST draw, the rule beside capitals_as_family in one patch, and a given-first patronymic list whose words cast no order vote. The tool as it stood for the first form gave one table for it and for this one. With the two additions it tells the first form from master in four places: the three family-first lists under FAMILY_FIRST_GIVEN_LAST, and pv-RU-patronymic written given-first under a family-first base at five names (99.0% for 100%).

Tests

  • tests/v2/test_suggest.py: both regression lists; a pure list written last; one with two-word names; a tie, 5+3 and 3+5; an ending on both words counting as middle; non-voters not counted; FAMILY_FIRST_GIVEN_LAST with a plain list; a base carrying the rule under each family-first order and each writing; a base carrying the Turkic rule; the names' own votes deciding given-first and family-first; both notes' text.
  • 15 rows fail on master's module and 17 on a9dacf7's.
  • Mutants, each caught: majority test inverted (18 failures); a tie kept (2); FAMILY_FIRST_GIVEN_LAST given the keep branch (4); position read from the last word (1) or the first (9); the count made over all names (1); the names' given-first votes ignored (1, by its notes); never kept (13).

Docs

Decisions entry rewritten to this form with the first form kept as dated history; Standing lines, head notes, Open:; Parser.suggest's docstring and docs/suggest.rst (the same sentences); docs/getting-started.rst (a limit sentence the first form added is gone); the tool's docstring and printed line; tools README; AGENTS.md's lesson, naming the two inputs. Sentences that said the rule "stands down" where only its reordering does are corrected in _suggest.py, docs/locales.rst and the decisions head notes.

Checks

uv run pytest (48,627 passed), uv run pytest -n0 -m serial, uv run mypy, uv run ruff check, sphinx-build -b doctest and -b html, python -m doctest README.rst, and the suite on 3.15 in its own environment, all on 05501df. The closing commit 965d0ec changes one note string, prose, example names and test rows; on it the suggester, tool and doc tests, ruff, mypy and the doctest build were re-run. Private NAMEPARSER_TOOLS_CACHE on every tool run. Example names checked against the ORCID, PatentsView and parliaments files, by whole name and by family and given boxes.

Unrelated, not fixed: the HTML build warns that docs/migrate.rst:1338 references the label customize-md-title with no title, since #1395.

🤖 Generated with Claude Code

derek73 and others added 2 commits November 14, 2026 22:56
…c rule

A decided East Slavic rule decided the order as given-first on any
base, so a caller who had declared a family-first order for a list
written family first was moved to a setting that reads its names
without a patronymic family-last. The rule's reordering stands down
under a declared family-first order, but its patronymic view does not:
under FAMILY_FIRST it fills the view and moves no field.

Under a FAMILY_FIRST base the suggestion now keeps the order and still
suggests the rule; under FAMILY_FIRST_GIVEN_LAST, where the rule names
no patronymic of a list written family first, it leaves both as the
base has them. The names' own given-first votes move either base as
before, the rule coming with the order, and a base already carrying the
rule keeps its order and its own value. A given-first base is as
before, and so is a list mixing East Slavic and Turkic patronymics.

suggest_measure.py: kz_senate, uz_senate and ua_rada keep a
family-first base, with no field moved and the patronymic view filled
on 41 of 48, 52 of 59 and 1,367 of 1,588 names; PatentsView's Russian
groups written family-first under a family-first base read 100% at
every size (98% at five and ten names before).

Closes #1356

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The design-docs review found sentences the change left saying the rule
forces or brings an order: the harness proof's rationale (AGENTS.md,
the tools README, the tool's docstring), the comments on the two
patronymic thresholds, Suggestion.disagreeing's docstring and a
locales.rst sentence about the Mongolian pack. Each now says what the
tree does. The #1397 entry carries a head note for its superseded
table; the mixed list's line says one decision is made by the
thresholds, not that the larger set always wins; "names no patronymic"
under FAMILY_FIRST_GIVEN_LAST is said of a name written family, given,
patronymic. The code review found no defect; the note for a base that
already carries the rule no longer says it "is not suggested", and rows
are added for a FAMILY_FIRST_GIVEN_LAST base whose votes decide its own
order and for a base carrying the Turkic rule.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@derek73 derek73 added this to the 3.1 milestone Nov 15, 2026
@derek73 derek73 added bug suggester The group suggester: Parser.suggest() and its signals labels Nov 15, 2026
@derek73 derek73 self-assigned this Nov 15, 2026
…en last

The form this branch first pushed kept the order of every family-first
base where a group decided the East Slavic rule. Review found it
regressed against master: a list written given, patronymic, family
under FAMILY_FIRST was left misread where master moved the base and
read it; and under FAMILY_FIRST_GIVEN_LAST, which takes the patronymic
of a family-first name for the given name, the base was left as it was
and the rule dropped, though with capitals_as_family in the same patch
the rule names the patronymic there.

Now the order is kept on one branch only: a FAMILY_FIRST base, the
names' own votes not deciding given-first, and more of the names
carrying the patronymic writing it last than in the middle. The group
then gets the rule alone, and its note counts the names written the
other way, which stay as the base reads them. A tie, a middle majority,
a FAMILY_FIRST_GIVEN_LAST base and a given-first base get the
given-first order with the rule, as on master.

suggest_measure.py gains a population of patronymic names in both
writings (pv-RU-patronymic) and reads the parliament lists under
FAMILY_FIRST_GIVEN_LAST too. Written family-first under a family-first
base, that population kept its order in under 5% of groups of five or
more on master and keeps it in 99% or more now. kz_senate, uz_senate
and ua_rada keep a FAMILY_FIRST base with every name read whole (48,
59 and 1,588, where the forced order read 41, 52 and 1,367).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@derek73 derek73 changed the title Keep a family-first base's order where a group decides the East Slavic rule (Karimov Rustam Anvarovich) Keep a FAMILY_FIRST base's order where a group's East Slavic patronymics are written last (Karimov Rustam Anvarovich) Nov 15, 2026
…e costs whole

The note on a kept FAMILY_FIRST order said the names writing the
patronymic in the middle "are left as the base reads them", which is
false where capitals_as_family, suggested in the same patch, reads
them. It now says they get no given-first order from the suggestion,
and a test holds the list that showed it. The accepted cost is stated
whole: every name written given first stays under the kept order,
whether or not it carries the patronymic. The entry records that two
names written given first can decide the order by their own votes,
names the lists of its differential so that it can be rebuilt, says
what the tool could not see then and sees now, and corrects three
sentences that outran their rows. Two example names that share their
boxes with an ORCID record are replaced.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@derek73
derek73 merged commit 0d643d2 into master Nov 15, 2026
14 checks passed
@derek73
derek73 deleted the fix/issue-1356-family-first-patronymic-order branch November 15, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug suggester The group suggester: Parser.suggest() and its signals

Projects

None yet

1 participant