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 @@ -348,7 +348,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, and since #1256 the Myanmar and Thai scripts; 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, 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.

**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 and Burmese 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 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
2 changes: 1 addition & 1 deletion docs/design/decisions/R3-initials-honor-the-fold.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- The fold partition applies to every role the view renders, though only the family can carry the tag today, pinned from a hand-built name with two tokens per role; P6's half has no rules/R3 example line, its one witness `der, y van` having a contested parse, and is pinned in a unit test — 2026-08-30 #408.
- A connective contributes nothing where it is joining, a part holding another name word for it to join, the part's working particles set aside, and initials like any name word where its part holds nothing else; one rule for every group, asked of the whole part and never by a word count (`John and Jane Smith` → 'J. J. S.', `Juan y Garcia` → 'J. y. G.', `Juan Velasquez y Garcia` → 'J. V. G.', `Jon Dough and` → 'J. D.', `Juan de y` → 'J. y.') — 2026-09-20 #461.
- The fact is decided once per part and recorded on the token as UNJOINED_CONJUNCTION_TAG, a marker separate from UNJOINED_TAG so `family_base`, `family_particles` and case repair do not move; the core view reads it, and `Parser.revise` recomputes both marks (`revise(n, family='de y')` → 'J. y.' for `Juan Smith`) — 2026-09-20 #461.
- The given group's answer is a deliberate 1.4.0 parity break (1.4.0 'J a J. S.' for `John and Jane Smith`), and a lone connective's initial restores 1.4.0's own answer (`JUAN Y GARCIA` → 'J. Y. G.', `محمد و علي` → 'م. و. ع.') — 2026-09-20 #461.
- The given group's answer is a deliberate 1.4.0 parity break (1.4.0 'J a J. S.' for `John and Jane Smith`), and a lone connective's initial restores 1.4.0's own answer (`JUAN Y GARCIA` → 'J. Y. G.'; `محمد و علي` gave 'م. و. ع.' until #1149 gave the Arabic script no initials, decisions/script-properties) — 2026-09-20 #461.
- An initial is the shortest start of its word that composes to the composed word's first character, written in the form the writer used (`e\u0301mile zola` → 'e\u0301. z.'), a first code point excluded from composition kept as written (`\u095bाकिर` → '\u095b.', its nukta kept); composing the initial to NFC and taking the first letter with its following marks were declined — 2026-10-02 #585.
- A word is a particle only where its position makes it one, so a listed particle standing as a name word initials (`Nguyen, Van Le` → 'V. L. N.', `Anh Do` → 'A. D.') — 2026-10-19 (Derek), #761.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Standing

- A word whose first letter is in Han, Hangul or kana, and since 2026-11-12 the Myanmar and Thai scripts (the rows of `_policy._SCRIPT_PROPERTIES` that write no initials, which the parse's initial veto reads, #320, decisions/script-properties) contributes nothing to `initials()`, the test asked of the letter's composed spelling — 2026-10-28 #754 (Derek).
- The Arabic script joins those rows: a word whose first letter is in it contributes nothing to `initials()` (decisions/script-properties) — 2026-11-19 #1149.
- A word opening with conjoining jamo that compose to no syllable gives no initial, the jamo being hangul: `ᄒᆞᆫ 김` gives '' — 2026-11-05 #1087
- A word opening with a letter of the Myanmar script gives no initial: `ကြည် ကြည် ဌေး` gives '' — 2026-11-12 #1234 (decisions/script-properties).
- A word opening with a Thai letter gives no initial: `สมชาย ใจดี` gives '' — 2026-11-12 #1256 (decisions/script-properties).
Expand All @@ -15,3 +16,4 @@ Open: none in this file.
- 2026-11-05 #1087 — A JAMO THAT COMPOSES TO NOTHING WRITES NO INITIAL. The script table's HANGUL took in the conjoining jamo (decisions/nfd-shapes, same date), so a word opening with archaic or lone jamo is hangul to this view: `ᄒᆞᆫ 김` moved from 'ᄒ.' to '', `Mary ᄀ. Smith` from 'M. ᄀ. S.' to 'M. S.' and `John Smith, ꥠᅡ` from 'ꥠ. J. S.' to 'J. S.' (measured 2026-11-05 against 4109b026). A decomposed modern syllable gave none before, the letter being composed first. The compatibility jamo still initial (`ㄱㄴ 김` gives 'ㄱ.').
- 2026-11-12 #1234 — BURMESE WRITES NO INITIALS. The script-property table's Myanmar row (decisions/script-properties, which holds the evidence and the moves) adds Burmese to the rule: `ကြည် ကြည် ဌေး` gave 'က. က. ဌ.' from 1.4.0 through 3.0.1 and gives ''. The rule's Because no longer says the parse reads no period after such a word as an abbreviation: that is H2's own column, which the Myanmar row does not set.
- 2026-11-12 #1256 — THAI WRITES NO INITIALS. The script-property table's Thai row (decisions/script-properties, which holds the count and the moves) adds Thai to the rule, as the 2026-08-02 #320 measurement (`th` 0 of 20) had said it belonged once it earned a row: `สมชาย ใจดี` gave 'ส. ใ.' and gives ''.
- 2026-11-19 #1149 — THE ARABIC SCRIPT WRITES NO INITIALS. The Arabic script takes a row of `_policy._SCRIPT_PROPERTIES` that writes no initials, so a word whose first letter is in it contributes nothing to `initials()`, where 1.4.0 through 3.1.0 gave its first letter; the measurement, the CLDR table it was decided against and the cost are decisions/script-properties' entry of the same date.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Elsewhere: which words divide at all, and what a divided word reads as, decisions/period-joined-words' 2026-11-09 #1255 entries; a run of single letters, which stays one word, decisions/T7.

Open: [#1306](https://github.com/derek73/python-nameparser/issues/1306), which field a Mongolian glued initial takes under the default order or a Mongolian choice (moved from #1235, which this division closed): the pack question the spaced `Ц. Сандаг-Очир` already raises.
Open: a chunk, or a name after the stop, that writes a vowel sign other than Thai's, a name of plain letters dividing in any script (`ড.করম খান`) (`डा.राम शर्मा` keeps title 'डा.राम', where `डा. राम शर्मा` reads title 'डा.', given 'राम'; `ড.রহিম` keeps title 'ড.রহিম', the listed `ড` found but রহিম's U+09BF not, #1166): the shape's letter class counts no such mark (decisions/nfd-shapes), and #1166 added Thai's on the name side alone, so no division is found there, moved here from decisions/period-joined-words' Open line. The local corpora hold almost no such title (nepal-candidates' glued Devanagari words are runs of initials, `के.सी.`, which stay whole anyway, and `मो.`, #1178's), so no issue is filed.
Open: a chunk, or a name after the stop, that writes a vowel sign other than Thai's or a mark of the Arabic script's (counted since #1149, in the gate as on both sides of the stop: `أ.محمد` and `أ.د.أحمد` divide in NFD as in NFC; a zero-width joiner or non-joiner between two letters of the name is counted too, one right after the stop is not), a name of plain letters dividing in any script (`ড.করম খান`) (`डा.राम शर्मा` keeps title 'डा.राम', where `डा. राम शर्मा` reads title 'डा.', given 'राम'; `ড.রহিম` keeps title 'ড.রহিম', the listed `ড` found but রহিম's U+09BF not, #1166): the shape's letter class counts no such mark (decisions/nfd-shapes), and #1166 added Thai's on the name side alone, so no division is found there, moved here from decisions/period-joined-words' Open line. The local corpora hold almost no such title (nepal-candidates' glued Devanagari words are runs of initials, `के.सी.`, which stay whole anyway, and `मो.`, #1178's), so no issue is filed.
Open: a word glued at a full stop other than the ASCII one, in Latin names, as the ideographic stop in `Wenzhao Zhong, Ph。D` (one name in the local corpora, 2026-11-10). The fullwidth stop between Han names was #1312, which rules/T3 reads as the transcription dot.
Open: [#1311](https://github.com/derek73/python-nameparser/issues/1311), a glued word after a family comma, the given part the comma names (`ARTHUR, L.MICHAEL`, 111 in fec-individuals), which the division would reach only once the comma's decision is asked first.
Open: [#1313](https://github.com/derek73/python-nameparser/issues/1313), a particle glued to its surname at its full stop (`Alaa A. El.Baz` reads suffix 'El.Baz'), which the division does not read as a chunk.
Expand Down
Loading