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 @@ -272,7 +272,7 @@ The compiled sets, read by `Lexicon` (mostly as the `_sets` field of the same na
- titles — `TITLES` (every title reading; prenominals), `GIVEN_NAME_TITLES` (the readings with `addresses = "given"`, e.g. "Sir", which treat the following name as given, not family — a subset of the title readings by construction, though not of `TITLES`: a word that may also be a given name, such as `king` or `sheikh`, compiles to `TITLES_AMBIGUOUS` instead) and `AFTER_GIVEN_TITLES` (the salutation readings with `after_given = true`, read as the title where one ends the given part after a family comma, rules/H8, #835 — a subset by construction); `TITLE_ABBREVIATIONS` (the title readings with `abbreviation = true`, `maj`, which rules/H5's trailing chain takes with its period where the word is in `TITLES_AMBIGUOUS`, and on a style rules/H9 gives the article before it as a partner, #999; private, like the kind sets 3.0 added); `DOTTED_TITLES` (the title readings with `dotted = true`, `us`, `uk`, `pd`, the titles abbreviating several words that a run of single letters joined by full stops spells, which rules/H10 reads as the title at the head of a name where a title the run keeps follows it, #490; private); `GLUED_TITLES` (the title readings with `attached = { side = "before" }`, Thai `นาย`, `นางสาว`, `อาจารย์`, which rules/W6's front peel splits off the start of the name's first word they are glued to, #317; private); `TITLES_AMBIGUOUS` (a title reading beside a `given` one, derived, compiled INSTEAD of into `TITLES`: a title only inside a title phrase, rules/H9, #752 phase 2i), `TITLE_MODIFIERS` and `TITLE_STYLES` (by kind) and `TITLE_PHRASES` (the two-word phrases `attaches` makes)
- suffixes — `SUFFIX_ACRONYMS` (suffix readings with `acronym = true`, matched with every period removed, e.g. "M.D.") and `SUFFIX_WORDS` (the rest, e.g. "Jr."), disjoint because a word has one suffix kind; `SUFFIX_ACRONYMS_AMBIGUOUS` (an acronym reading on a word with a `given` or `family` reading, derived since 2026-10-25: the build refuses the phase 1 flag `may_be_name`; a `given` reading carrying `same_as`, a name written short, marks no clash with a suffix reading since #1383 (`ReadingProperties.marks_a_clash`), so `md`, Muhammad written short, stays an unambiguous credential); `SUFFIX_WORDS_AMBIGUOUS` (its word twin, a generation or agnomen reading, or a credential written as a word, on a word with a name reading, `fils`, `junior`, `júnior`, the agnomens and `kc`, `pc` and `dl`, gated by the count, rules/S11, since 2026-10-25, the credentials since 2026-10-30, #965, Junior since #1039) with `AGNOMENS` inside it (the `agnomen` kind) and `TITLE_CASE_NAME_WORDS` beside it (the readings written `title_case_is_name`, `fils`, `père`, `kc`, `pc`, `dl`, whose writing leans, Title case to the name; any other gated word's writing never leans, #1039); and `GLUED_HONORIFICS` (#308, `attached`), the subset of `SUFFIX_WORDS` the peel may split off the END of a name token — a separate, harsher bar, since the glued position has no writer-drawn boundary to lean on, and each word refused it carries `excluded = { attached = … }`
- particles — `PARTICLES` (family-name particles, e.g. "de", "van") and `NON_GIVEN_NAME_PARTICLES`, the curated subset that is *never* a standalone given name (the particles whose word has no `given` reading, each stating `may_be_given = false`; a `given` reading on the word is what makes a particle possibly given, the phase 1 flag `may_be_given = true` refused since 2026-10-25). What the subset licenses is rules/P1's fold in `post_rules` (the "rule 1b" of older issue comments — decisions/legacy-rule-numbers maps the old numbers), and the fold has ONE site: the piece that OPENS the name. A lone never-given particle there, with at least one more name word behind it, starts the family. Titles do not move the opening position (rules/P4), so `Sir de Mesnil` reads family `de Mesnil` under every `name_order`, as `de Mesnil` does. How far the fold reaches depends on the order the name was read under: by default it takes the rest of the name (`de Mesnil Jean` → family `de Mesnil Jean`); under either family-first order it takes the particle run plus ONE name unit and lays the rest out by the order (`de Mesnil Jean` → family `de Mesnil`, given `Jean`); after a family comma it takes the rest of that part whatever the order (`Smith, de Mesnil Jean` → family `Smith de Mesnil Jean`). The leading particle stays a lone piece for the fold to find — `group` does not chain it forward, and the fold walks the particles after it itself — so `de la Vega` reads family `de la Vega` under all three orders. Behind a title-particle (`St`, `Freiherr`, P4's Except) it does chain, and under a family-first order the fold cuts that chain as it cuts a run (`St de Mesnil Jean` → family `de Mesnil`, given `Jean`, #828). The GIVEN position is not a site. It was a second one until #467, which removed it because under a family-first order that slot holds what the caller DECLARED to be the given name: `Mesnil de` under `FAMILY_FIRST` or `FAMILY_FIRST_GIVEN_LAST` reads given `de`, family `Mesnil`. Nor is a particle inside the name: `Juan de la Vega` under a family-first order reads family `Juan`, given `de la Vega`, with no ambiguity recorded — what the vocabulary forbids is the bare particle as a given name, not a name part that begins with one. A bare `de` has nothing to fold into and is placed like any one-word name, by `Policy.lone_name_word` (rules/O5, #1111): given `de` by default under every order, family `de` where the caller sets the switch to family. A leading particle OUTSIDE the set is left to position — `Van Gogh` is given `Van`, family `Gogh` by default and family `Van`, given `Gogh` under both family-first orders — and records a `PARTICLE_OR_GIVEN` ambiguity under all three, save one written in lower case in a mixed-case name under a family-first order, which the fold takes and which records none (`van Gogh` → family `van Gogh`, rules/P11, #670); a never-given particle opening the name records none (`de Mesnil`), and neither does an ambiguous one inside it (`Vincent van Gogh`). The internal `Lexicon._sets.particles_ambiguous`, the particles holding a `given` reading, is its complement within `PARTICLES`, so the two mark OPPOSITE sets — see the flip warning in `docs/migrate.rst` before translating either
- bound given names — `BOUND_GIVEN_NAMES` (`bound_given` readings, e.g. "abdul", "abu"; one that is also a particle needs a `given` reading, a build check); a group-stage rule joins the first non-title piece to its following piece before roles are assigned, reserving a family word unless a family comma has already fixed it or a given-name title stands ahead (#369, rules/P5) (ported from v1's `_join_bound_first_name`), and `BOUND_PHRASES` (#694, rules/P12, the two-word given names a bound word's `completed_by` lists, Arabic `عبد` before the names of God), each pair joined past the first name word, where P5's join does not reach, and `BOUND_COMPLETES_ANY` (#1464, the `completes_any` readings, the Latin `abdul`, `abd`, `abdel`, `abdal`, `abou`) with `BOUND_LONG_NAMES_ONLY` inside it (`long_names_only`, `abdul`), the bound words P12 joins with any plain name word after them, the second only in a name of four name words or more, both private
- bound given names — `BOUND_GIVEN_NAMES` (`bound_given` readings, e.g. "abdul", "abu"; one that is also a particle needs a `given` reading, a build check); a group-stage rule joins the first non-title piece to its following piece before roles are assigned, reserving a family word unless a family comma has already fixed it or a given-name title stands ahead (#369, rules/P5) (ported from v1's `_join_bound_first_name`), and `BOUND_PHRASES` (#694, rules/P12, the two-word given names a bound word's `completed_by` lists, Arabic `عبد` before the names of God), each pair joined past the first name word, where P5's join does not reach, and `BOUND_COMPLETES_ANY` (#1464, the `completes_any` readings, the Latin `abdul`, `abd`, `abdel`, `abdal`, `abou`) with `BOUND_LONG_NAMES_ONLY` inside it (`long_names_only`, `abdul`), the bound words P12 joins with any plain name word after them, the second only in a name of four name words or more, both private; and `BOUND_SECONDS` (#1072, the `bound_second` kind, Arabic-script `الدين` and `الله` with their Persian and Urdu spellings, and `الغنى`, `الفقار`), the words a pair writes second, which P12 joins with the plain word before them at the first name word too, with `BOUND_SECOND_PHRASES` beside it (the pairs a reading's `completes` lists, `ذو الغنى`, the only ones such a word joins), private
- given names written short — `GIVEN_NAME_ABBREVIATIONS` (#789, a `given` reading carrying `same_as`, the full name: "chas", "wm", Filipino "ma", `md`), the given names written short that rules/H2's shape yields to, and that rules/C13's given-name Except reads where one is also a credential opening the part after a family comma (#1393, classify's `vocab:given-abbreviation` tag), and that rules/S8's run declines for in a name written wholly in one case with a name word behind it (#1394, `SITI NORA MD YUSRI`); nothing else reads it
- names a given name's second half reads — `PARTICLE_GIVEN_NAMES` (#704, a `given` reading written `after_particle`: "carmen", "ángeles", "lurdes", "graças", the Spanish and Portuguese words a compound given name writes behind a particle, which rules/P10 reads as a middle name in `María del Carmen García`, by default, and "piedade" only under a Portuguese choice, #1118, #1122), `SAINT_PARTICLES` (the `saint` kind, `san`, `santa`, `st`, `ste`, `sta`, `sto`, whose run P10 refuses, `Santa María` being a surname) and `SHARED_NAMES` (#704, a name reading written `shared`: Sikh "kaur", "singh", which rules/O6 and O7 neither take nor complete and P10 does not complete, `Kaur del Carmen García`), private; each is read through classify's tags or the lexicon in `_post_rules`
- conjunctions — `CONJUNCTIONS` (e.g. "and", "of") used to chain multi-word titles and to join name parts (rules/P3), plus `CONJUNCTIONS_AMBIGUOUS` (#383/#479, rules/P8, `may_be_initial`, refused by the build on anything but a cased single letter), the subset of single cased letters that read as an INITIAL in a name written wholly in one case — a marker set
Expand Down
27 changes: 27 additions & 0 deletions docs/customize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ A kind belongs to a category, which decides what the reading does:
- The word joins the word after it into one given name
(`Bound given names`_).
- ``bound_given``
* - bound_second
- The word joins the word before it into one name (``عز الدين``),
added in 3.2 (`Bound given names`_).
- ``bound_second``
* - relation
- The name after the word is the maiden name (``née``).
- ``birth_marker``
Expand Down Expand Up @@ -325,6 +329,9 @@ arguments to ``add``:
- bound_given
- The words it joins past the first name word
(`Bound given names`_).
* - ``completes=[...]``
- bound_second
- The only words it joins behind (`Bound given names`_).
* - ``after_particle=True``
- ``given``
- Behind a particle the word completes a given name, so
Expand Down Expand Up @@ -1187,6 +1194,26 @@ with the pair as the family, state ``abdul``'s reading without
>>> Parser(lexicon=lex).parse("Tariq Abdul Aziz").family
'Abdul Aziz'

A ``bound_second`` reading (3.2) is the other end of such a pair: the
word written second, which joins the word before it. Arabic script
writes many given names as a word and ``الدين`` ("of the faith") or
``الله`` after it, the word before varying, so ``الدين`` and ``الله``
join any plain word before them, at the start of a name too, where the
pair is the given name. ``الغنى`` and ``الفقار`` are written
``completes=["ذو"]``, joining behind ``ذو`` alone; a word that lists
them joins behind those words only. A name of two name words keeps
them apart, as it keeps ``عبد الله``:

.. doctest::

>>> noor = parse("نور الدين سامر حداد")
>>> noor.given, noor.middle
('نور الدين', 'سامر')
>>> parse("سامر عز الدين").family
'عز الدين'
>>> parse("عز الدين").given
'عز'

.. _rendering-arguments:

Presentation: rendering arguments
Expand Down
Loading