Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ The 2.0 rewrite landed as underscore-private modules beside the v1 code, which 2

**Cyrillic suffix regexes need `re.I` even when the pattern is suffix-only** — a Latin title-cased word (`Ivanovich`) keeps its suffix lowercase, so `re.I` seemed skippable; but an irregular Cyrillic suffix can be nearly the whole word (`ильич`), so title-casing capitalizes into the suffix itself (`Ильич`). `east_slavic_patronymic_cyrillic` (v1's name for what is `_vocab._EAST_SLAVIC_CYR` since 3.0 removed `config/regexes.py`, #1008) shipped without `re.I` on the Latin reasoning and silently failed on capitalized irregular forms — don't assume Latin's title-case safety transfers to Cyrillic. (#185)

**Suffix words vs the initial veto** — single-letter roman numeral suffixes (`i`, `v`) are suffix words but also initial-shaped, so `_vocab.is_suffix_strict` (v1's `is_suffix`) vetoes them through `_vocab.is_initial`. `_vocab.is_suffix_lenient` accepts suffix words without the veto and is only safe in unambiguous positions, after a comma (#136, #144). **The veto is Latin-only since #320**: `is_initial` ANDs the bare shape test (`is_initial_shaped`) with "not in a script that writes no initials", the rows of `_policy._SCRIPT_PROPERTIES` whose `writes_initials` is false (Han, Hangul, Hiragana, Katakana, since #1256 the Myanmar and Thai scripts, and since #1149 the Arabic script, whose `د.` and `م.` are titles; decisions/script-properties), so the single-character CJK suffix words (씨, 様, 氏, 군, 양, 님, 殿) written with a period read as suffixes: `"김민준 씨."` gives suffix `씨.`. `V.`/`I.` still lose to the veto and still need the lenient test.
**Suffix words vs the initial veto** — single-letter roman numeral suffixes (`i`, `v`) are suffix words but also initial-shaped, so `_vocab.is_suffix_strict` (v1's `is_suffix`) vetoes them through `_vocab.is_initial`. `_vocab.is_suffix_lenient` accepts suffix words without the veto and is only safe in unambiguous positions, after a comma (#136, #144). **The veto is Latin-only since #320**: `is_initial` ANDs the bare shape test (`is_initial_shaped`) with "not in a script that writes no initials", the rows of `_policy._SCRIPT_PROPERTIES` whose `writes_initials` is false (Han, Hangul, Hiragana, Katakana, since #1256 the Myanmar and Thai scripts, since #1149 the Arabic script, whose `د.` and `م.` are titles, and since #1380 the Lao script; decisions/script-properties), so the single-character CJK suffix words (씨, 様, 氏, 군, 양, 님, 殿) written with a period read as suffixes: `"김민준 씨."` gives suffix `씨.`. `V.`/`I.` still lose to the veto and still need the lenient test.

**Comparing against v1 needs `PYTHONSAFEPATH=1` AND a directory outside the worktree** — `uv run --isolated --no-project --with 'nameparser==1.4.0'` still puts the checkout's `nameparser/` ahead of the pinned wheel on `sys.path`, so the "v1" side silently imports the branch and every comparison reports parity. Run it as `cd <scratch dir> && PYTHONSAFEPATH=1 uv run --isolated --no-project --with 'nameparser==1.4.0' python -c "..."`. This produces false confidence rather than an error, so it invalidates results without ever looking wrong. **A `tests/v2/cases.py` row's `parity` means 1.4.0, and no test checks it** -- the table runs every row against the tree, so a row labelled `parity` that only matches master passes for good, and `parity` is the dataclass default, so a row written with no `classification` claims it. #614 added eight such rows, compared against master; #620 found them by running the wheel this way and relabelled each with the change its reading came from, found by `git bisect run` in a scratch worktree (`git worktree add --detach`, never this one). 3.1's prose sweep found 72 more, 27 of them #1395's `md_*` rows, and the check is a kept tool since: `uv run python tools/differential/parity_check.py` reads every default-config `parity` row with the 1.4.0 wheel, hardened as `compare.py` is, and lists each row 1.4.0 reads otherwise with its fields (`--check` exits 1 on one). It needs the network or uv's cache, so no CI job runs it, and it skips the rows carrying a policy or a locale, whose `parity` stays unchecked. Run it after adding a row on the default, and relabel what it lists the way #620 did. When bisecting, run Python with `-B` and `git clean -fdx` the scratch tree at each step: two checkouts within one second leave a stale `.pyc` whose source has the same mtime and size, and in 3.1's relabel one answered for two rows, naming a commit whose parent already read them.

Expand Down
2 changes: 1 addition & 1 deletion docs/design/decisions/H2-leading-abbreviation-title.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- An abbreviation of two or more letters ending in its one period, opening the part that carries the given name (the whole name, or the part after a family comma), is a title even unlisted and even where it is suffix vocabulary, and a single-letter initial is not: `Insp. Jane Morse` → title 'Insp.', `Morse, Det. Insp. Jane` → title 'Det. Insp.', `Esq. Smith` → title 'Esq.', `J. Smith` → given 'J.' — 2026-06-30 #288.
- The shape is an unbroken run of letters, so an unlisted abugida abbreviation written with a vowel sign stays a name word and only vocabulary recognizes it — 2026-06-30 #288 (the run was the whole cause until 2026-11-08 #1191, below, found the word with no sign).
- The shape declines a period-marked word carrying a letter of the ten Brahmic scripts from Devanagari to Sinhala (U+0900 to U+0DFF), an Except of rules/H2, so a Latin initial spelled there with no vowel sign is no title: `एम. एस. वर्मा` → given 'एम.', middle 'एस.' — 2026-11-08 #1191.
- The shape declines a period-marked word carrying a script that writes no period abbreviations (Han, kana, hangul; Thai, Burmese and the Arabic script write no initials but are not among them, decisions/script-properties): `田中. 太郎` → family '田中.', where `Smith. John` keeps title 'Smith.' — 2026-09-10.
- The shape declines a period-marked word carrying a script that writes no period abbreviations (Han, kana, hangul; Thai, Burmese, Lao and the Arabic script write no initials but are not among them, decisions/script-properties): `田中. 太郎` → family '田中.', where `Smith. John` keeps title 'Smith.' — 2026-09-10.
- C13 wins for a credential opening the part after a family comma (`Smith, Esq. John` → suffix 'Esq. John'), and the shape still reads a title there for a word that starts no S8 run (`Smith, Insp. John`, `Smith, Do. John` → title) — 2026-10-20 #761; its `Smith, Ma. John` example moved to the given name on 2026-10-26 #789.
- A given name written short outranks the shape: a word the vocabulary lists with a `given` reading whose `same_as` is the full name, period-marked where the shape would fire, is the given name and the name reads as it would with the full name there (`Chas. Smith` → given 'Chas.', `Mrs Ma. Liza Cruz` → title 'Mrs', given 'Ma.'). The shipped set is the traditional English abbreviations, the Filipino `ma` and `jo`, since #1115 Muhammad, Achmad and Francisco written short (`mohd`, `mhd`, `muh`, `moh`, `moch`, `ach`, `fco`; decisions/H6's 2026-11-06 entry), Sheikh written short (`sk`, #1129) and since #1383 `md`; a listed title still wins — 2026-10-26 #789.
- A transliteration digraph declines the shape, an Except of rules/H2: the Latin spellings of one Cyrillic letter that are no title in any corpus read, `Yu`, `Ya`, `Ye`, `Yo`, `Zh`, `Kh`, `Shch` and `Dzh`, in any case, so `Yu. A. Chibrikova` → given 'Yu.', middle 'A.', as `Ю. А. Чибрикова` reads; `Ts`, `Ch` and `Sh`, each also a title written short, keep the shape, and a digraph of another alphabet or a Latin given name written short (`Th.`) is outside the set — 2026-11-09 #1136.
Expand Down
6 changes: 6 additions & 0 deletions docs/design/decisions/O1-east-slavic-rotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- The rotation is scoped to the default order by a gate on the order assign read: under FAMILY_FIRST `Мицкевич Адам Юзеф` reads family 'Мицкевич', given 'Адам', middle 'Юзеф' as plain FAMILY_FIRST does, and the natural-order `Иван Петрович Сидоров` reads family 'Иван', given 'Петрович', middle 'Сидоров', an accepted consequence pinned in tests/v2/test_locales.py rather than in rules/O1's examples — 2026-09-07 #384.
- Re-deriving the order from the patronymic trace under a declared family-first order, and reporting where the trace and the declared order disagree, are declined — 2026-09-07 #384.
- An initial in the first or the middle of the three name words, read as T5 and T4 read one, blocks the rotation, so `И. Б. Зубкевич`, `Ирина Б. Зубкевич` and `roman a abramovich` under `locales.RU` keep their surnames, and the family-first `Сидоров И. Петрович` reads family 'Петрович' and no patronymic as an accepted cost — 2026-11-08 #1185.
- The patronymic endings take the Ukrainian ones written in Cyrillic, `-івна`, `-ївна`, `-євич` and `Ілліч`, so `Коваленко Олена Петрівна` under `locales.RU` reads family 'Коваленко', given 'Олена', patronymic 'Петрівна'; the Belarusian endings and the Latin spellings of the Ukrainian ones are not read (decisions/R9's Open) — 2026-11-20 #1212.

Not standing: 2026-08-15; the rotation and name-order question it left riding the order-constants issue, which closed without answering it, answered by 2026-09-07 #384.

Expand All @@ -24,6 +25,11 @@ Open: none in this file.
Where the row is pinned, and why not in rules.md. The example grammar admits ONE annotation, and `tests/v2/rules_doc.py`'s `resolve_annotation` resolves it to a policy, a locale or a gated locale — never a pair. Composite keys exist for other pairings (`family-first+middle_as_family`, `[ja+segmenter]`), but no registered annotation combines a pack with an order, so the two cannot be written on the same example line. Registering a combined policy would be a test change made inside a docs decision. #470 asked whether an example line should declare its format and was closed not-planned on 2026-09-02 — "no notation is needed. The Accepted clause is already the right home for this" — so prose in the rule is the decided home here, not a workaround. The parse is a `tests/v2/test_locales.py` row beside the pack's other rows, and rules/O1 states it in prose.
- 2026-11-02 #994 — `Никитич` and `Саввич` (Latin `Nikitich`, `Savvich`) join the irregular forms the patronymic ending lists whole beside `Ильич` and `Кузьмич`: the masculine patronymics of Никита and Савва, which fit neither `-ович` nor `-евич`, so `Петров Иван Никитич` under `locales.RU` read family 'Никитич' and now reads family 'Петров', given 'Иван'. Their feminines already matched `-ична`. Found by scoring the tree against datacoon/russiannames' 61,466 labelled Cyrillic names (`parser_for(locales.RU)` matched 58,011 of them on surname, given name and patronymic, 2026-11-02 at db7e8fc4); that project's patronymic list gives Никитич a count of 1,225 and Саввич 160. Excluded: the spelling `Кузмич` (44 in the same list); the rest of that list's unmatched tail is typos (`Николавна`, `Владимирвич`).
- 2026-11-08 #1185 (the first-word guard and its tag test from #1217, an outside contribution) — an initial in the first or the middle of the three name words blocks the rotation, the initial read as T5 and T4 read one: a one-letter word with its period, a bare unaccented Latin capital, and in a name written wholly in one case a bare lower-case letter (`roman a abramovich`). The test reads classify's `initial` tag, which carries both rules' reading, so a one-case name's two spellings read alike. Two drafts read otherwise, each found by review: the first read the word's text alone and missed the lower-case spellings, and the second read the text beside the tag, whose text arm decided one input only, a bare capital `Y` that P8 reads as a connective, first or in the middle, blocking `SIDOROV Y PETROVICH` and `Y IVAN PETROVICH` while their lower-case spellings rotated. Before it, a surname ending like a patronymic was rotated out of the family wherever initials came before it: `И. Б. Зубкевич` under `locales.RU` read family 'И.', given 'Б.', middle 'Зубкевич', and `Ирина Б. Зубкевич` and `Roman A. Abramovich` read family 'Ирина' and 'Roman', where the default parser reads each right. The first-word half follows from the rotation's own premise: it restores a family-first listing, and a family name is not written as an initial. The middle-word half is a fork the shape cannot settle — `Ирина Б. Зубкевич` (given, initial, surname) and `Сидоров И. Петрович` (surname, initial, patronymic) are one shape, and only knowing which `-ович` word is a surname tells them apart — so it was decided by which writing occurs. The issue measured (2026-11-08) the State Duma's eight convocations and the Federation Council, 2,423 three-word names: 16 surnames (0.7%) end like a patronymic, and composed as `Имя Б. Фамилия` 0 of the 16 read right under the pack; its comment measured the Verkhovna Rada, 35 of 1,587 surnames (2.2%), 0 of 35 right in `И. Б. Фамилия`, and 6 ORCID names from Ukraine breaking in the `Имя Б. Фамилия` shape once Latin `-ovych` endings are simulated. The other writing was looked for and not found. Recipe: parse every name of every `tools/differential/local_corpora.py` corpus but ORCID, PatentsView and FEC (whose names are composed from fields) under `parser_for(locales.RU)` with this change and on master 51d36a31, and list the names whose given, middle or family moved: 11 move on 2026-11-08, every one a given name, a middle initial and a surname (`Viktor F Yanukovich`, `Vladimir B Grinevich`, `ACACIO T GUBEROVICH`), none a family-first listing; all 11 are Latin, the corpora holding no Cyrillic name of the shape with an initial, which says more about the corpora than about the shape. A Russian family-first listing that writes the given name as an initial writes the patronymic as one too (`Сидоров И. П.`), which O1 never reaches. The cost, `Сидоров И. Петрович` reading family 'Петрович', also empties the patronymic view, which read 'Петрович' before: R9's East Slavic arm reads the middle only. A bare Cyrillic capital is no initial by T5, so `Ирина Б Зубкевич` still rotates to family 'Ирина', as it reads that letter a name word everywhere; that is T5's question, not this one's. Recording an ambiguity on the middle-initial shape was weighed and not taken: no reader of `Ирина Б. Зубкевич` hesitates. `locales/ru.py`'s `DEVIATES` is left as it was: it over-declares, the safe direction for the non-interference gate, and the surface shrank.
- 2026-11-20 #1212 — THE UKRAINIAN CYRILLIC ENDINGS. The women's `-івна` and `-ївна`, the soft `-євич` and the irregular `Ілліч` join the endings `_vocab._EAST_SLAVIC_CYR` lists (and `locales/ru.py`'s declared copy), the Ukrainian men's `-ович` and `-йович` being the Russian spelling and read already. Before, a Ukrainian woman's name written family-first under `locales.RU` read the patronymic as the family name (`Коваленко Олена Петрівна` → given 'Коваленко', family 'Петрівна').
MEASURED on the Verkhovna Rada's deputies (`opensanctions-parliaments`, `--group ua_rada`, 1,598 names, written surname, given name, patronymic) with `config_diff.py diff default plain:RU --local opensanctions-parliaments --group ua_rada --readings <file>` in a checkout of master cb5088a9 and in the branch, the two files compared line by line: plain:RU moves 1,367 names from the default at cb5088a9 and 1,596 here. The 229 the change moves are all read right (family the first word, given the second, middle and patronymic the third), 150 `-івна`, 69 `-ївна`, 5 `Ілліч` and 5 `-євич`; none read right before and wrong after; every three-word name of the 1,598 now reads right under plain:RU, and the 2 others are not of three words. (#1212 counted 209 women on 2026-11-08, a smaller fetch.)
THE GROUP SUGGESTER, whose patronymic signals read the same endings: `suggest_measure.py --base <cb5088a9>` moves 3 cells, `ua_rada` under each of the three bases, its votes rising (family-first 1,366 → 1,585 of 1,588, the East Slavic rule 1,367 → 1,586) and its suggestion unchanged (family-first, the rule on); no drawn group of any size moves, the draws holding no Ukrainian list, so no figure `Parser.suggest`'s docstring, docs/suggest.rst or decisions/group-suggestion quotes moves, though a list of Ukrainian names with these endings now suggests the rule and the order (six invented ones written family-first, `Коваленко Олена Петрівна` among them: `PolicyPatch(name_order=FAMILY_FIRST, patronymic_rules={EAST_SLAVIC})`, where master suggested nothing); the `ua_rada` counts in that file's dated entries stand as measured then.
ACCEPTED, the surname cost the Russian endings already carry: a name in the spoken order with two given names and a surname ending in `-євич` rotates (`Олена Марія Гаєвич` → family 'Олена'), as `Анна Мария Абрамович` does with `-евич`; a middle word carrying an ending still blocks it (`Олена Петрівна Гаєвич` keeps family 'Гаєвич'). Left out, as #1212's own measurement found them costly or unmeasured: the Belarusian endings (`-авіч`, `-евіч`, `-овіч`, `-аўна`, `-еўна`, `-оўна`; 859 of the 8,231 Belarusian names it read end their surname in `-овіч` or `-евіч`, out of O1's reach today only for their spelling, which a Belarusian pack could answer), the Latin `-ivna`, `-ovych` and `-evych` (1,688 ORCID family boxes from Ukraine end in `-ovych` or `-evych`, #1185's collision), and the irregular `Хомич` and `Савич`, which are common surnames and were not measured. The Latin `Illich` is left out with the Latin endings.
THE REVIEW found the decomposed `ї` (і and U+0308, the first letter of an ending that decomposes) unread, the predicate matching the word as written: `has_patronymic_ending` and `locales/ru.py`'s `DEVIATES` now compose it first, as #1316 made the Turkic marker test do, with case rows in both cases and a `DEVIATES` test.

Declined:

Expand Down
Loading