diff --git a/AGENTS.md b/AGENTS.md index 26dcaba4f..f64f15856 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -277,6 +277,7 @@ The compiled sets, read by `Lexicon` (mostly as the `_sets` field of the same na - 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 - maiden markers — `MAIDEN_MARKERS` (`birth_marker` readings, e.g. "née", "geb.") routing the following name to `maiden`; with an `addresses = "given"` title, the one kind a phrase may be (`z domu`) +- alias markers — `ALIAS_MARKERS` (`alias_marker` readings, `@` and `urf`; `alias` and `aka` written `default = false`), private, routing the following words to `nickname` up to a patronymic particle, another marker, a comma or the trailing post-nominal run (rules/N4, #1164); classify tags the word `vocab:alias-marker`, and group's alias take shares `_clause_take` with the maiden take - `config/_ko_surnames.py`, private since 3.0 (`config/surnames.py` through 2.x, 2.8.2 warning of the move) and read as `Lexicon.default().surnames` — `KOREAN_SURNAMES`, the census list the 2.0 API splits unspaced hangul on (#271), still written in Python with an import-time `assert_normalized`: a segmentation list, outside the per-word model, like the locale packs' lists. - the views' kinds — `GENERATION_WORDS`, `CREDENTIAL_WORDS` (a credential written as a word), `HONORIFIC_WORDS` and `PATRONYMIC_PARTICLES` (3.0's 4b and 4c), private: the kinds the other sets do not record, which classify reads to tag a word for the `generation`, `credentials`, `honorifics` and `patronymic` views (rules/R8, rules/R9) - case masks — `CAPITALIZATION_EXCEPTIONS` mapping of case MASKS (e.g. `{'phd': 'PhD'}`), compiled from the `cased` property, at most one per word: each value is its key's own letters and digits recased, laid over the word as written, so `ph.d.` repairs to `Ph.D.` and repair never writes the value's own punctuation into the word (#459); `Lexicon` raises `ValueError` on a value that spells anything else; and `CAPITALIZED_PARTICLES` (the `saint` and `rank` kinds, private), the particles case repair writes with a capital rather than in lowercase, keyed on the kind so a word needs no mask of its own (rules/R4, #1069), and `CAPITAL_OPENING_PARTICLES` (the particle readings written `capital_opening`, `ter` and `der`, private), the particles case repair writes with a capital where the word before it in the family name is no particle, nor, where it opens the family name, the word written right before it in any role (`Levon Ter Petrosyan`, but `Jan van der Berg` and `Van der Walt`), keyed on a property because `der`'s kind, `article`, is `de`'s and `la`'s too (rules/R12) diff --git a/docs/customize.rst b/docs/customize.rst index 0cc1e9620..555a803e0 100644 --- a/docs/customize.rst +++ b/docs/customize.rst @@ -233,8 +233,10 @@ A kind belongs to a category, which decides what the reading does: added in 3.2 (`Bound given names`_). - ``bound_second`` * - relation - - The name after the word is the maiden name (``née``). - - ``birth_marker`` + - The name after the word is the maiden name (``née``), or a + second name the person is known by, read as the nickname + (``@``, ``urf``; added in 3.2, `Alias markers`_). + - ``birth_marker``, ``alias_marker`` * - name - The word is borne as a name. With no property it moves a parse only beside another reading of the word (`Name readings`_). @@ -512,6 +514,34 @@ credential is reachable as its component words: >>> parse("John Smith, MD PhD").suffix 'MD PhD' +Alias markers +^^^^^^^^^^^^^ + +An ``alias_marker`` reading makes a word announce a second name the +person is known by, which is read as the nickname, the marker dropped. +``@`` written as a word of its own and ``urf`` are read so by default. +The English ``alias`` and ``aka`` ship turned off, because each is a +given name or a surname more often than a marker (``Aka`` is a Turkish +and an Ivorian surname); a choice of English (``languages={"en"}``) +turns them on with the rest of English's readings that are off by +default. If your records write them as markers, add just them: + +.. doctest:: + + >>> fec = Parser(lexicon=Lexicon.default().add( + ... "aka", "alias", kind="alias_marker")) + >>> boscia = fec.parse("BOSCIA, FRANK AKA FRANCIS") + >>> boscia.given, boscia.nickname + ('FRANK', 'FRANCIS') + >>> parse("BOSCIA, FRANK AKA FRANCIS").middle + 'AKA FRANCIS' + +The alias runs to a patronymic particle (``bin``, ``a/l``), another +marker or a comma, and otherwise to the end of the name, less any +trailing suffixes and titles. So two words after the marker are both taken, which +is right for a whole second name and wrong for a one-word alias before +the family name. + .. _title-detection-off: Turning title detection off diff --git a/docs/design/decisions/N4-alias-marker.md b/docs/design/decisions/N4-alias-marker.md new file mode 100644 index 000000000..8576cb179 --- /dev/null +++ b/docs/design/decisions/N4-alias-marker.md @@ -0,0 +1,27 @@ +# N4 — the alias marker + +## Standing + +- A word the vocabulary reads as an alias marker (the `alias_marker` kind), written as a word of its own with a name word before it, takes the words after it as the nickname and is dropped; the alias runs to the first patronymic particle or marker of either kind in its part, or with none to the end of the part as far as M2's clause would, and a bracketed or quoted clause led by a marker is the nickname without it — 2026-11-20 #1164. + +- `@` and `urf` are markers by default; `alias` and `aka` ship written `default = false` and are turned on by a caller's `Lexicon.add(word, kind="alias_marker")` — 2026-11-20 #1164. + +- A glued `X@Y`, an e-mail address and an `@handle` stay one word — 2026-11-20 #1164. + +- One name word beside an alias keeps O5's reading, and N3 counts a delimited nickname only; a clause in a maiden pair led by an alias marker is the nickname — 2026-11-20 #1164, THE NEIGHBOURING RULES. + +Open: reporting the fork as an ambiguity, left open by the decision on #1164; it needs an issue of its own. + +## Log + +- 2026-11-20 #1164 — THE ALIAS MARKER TAKES THE WORDS AFTER IT AS THE NICKNAME. Measured first on master e0f698c8 over the local corpora (each occurrence labelled marker, name or unclear by hand): the spaced `X @ Y` is an alias marker in all 109 of its uses and a name in none; `urf` a marker in 3 of 3 (all PSC; the 2024 Lok Sabha candidates' list, no local corpus, writes it 21 times); `alias` a marker in 43 and a name in 97 (a Malay given name and father's name, a Kerala name, a US surname, FEC's `ALIAS, FRED` shape seven times); `aka` a marker in 38 and a name in 90 (an Ivorian, Turkish and Nepali given name and surname). So `@` and `urf` ship on and `alias` and `aka` off, each written with `default = false` so its vetting stays on the word. A narrower default keyed on case was declined: a lower-case `alias` or `aka` in a mixed-case name was a marker in 29 of 29, but it misses every list written in capitals, where most markers stand. + HOW IT WAS COUNTED: every whitespace word of every local corpus's `corpus.jsonl` (all 18, under the tools' cache) equal to `@`, `urf`, `alias`, `aka`, `a.k.a.` or `a/k/a` after stripping brackets and commas, case-folded, and every word holding `@`, sorted by how the `@` is written; each match labelled marker, name or unclear by hand, and the labels not kept, so the figures are a dated hand judgment over that extraction. The Lok Sabha figures are #1164's own comment, from a list no local corpus holds. + THE MECHANISM is M2's take, shared rather than copied: `_group._clause_take` asks M2's three questions (where a marker counts, what it takes, the bound trailing run) for either marker, `_maiden_take` and `_alias_takes` calling it with their own role. What differs is where the alias stops: the scopes labelled over the spaced uses were 23 inside the given part ended by a patronymic particle (`X @ Y bin Z`), 31 after the father's name to the end, 26 one word to the end, 1 one word then a comma, and 29 of two or more words with no patronymic particle (110 labels for 109 uses: one label too many, which the unkept labels cannot settle). M2's clause runs to the end, which would have read all 23 given-part aliases wrong, so the alias also stops at a patronymic particle, at another marker of either kind and at a comma. And it counts in the given part after a family comma too, where FEC writes `FAMILY, GIVEN AKA OTHER`, which M2's marker never reaches. + DECLINED: taking one word after the marker, right on the one-word aliases and wrong on every longer one: the two-word aliases in the given part (4), the two- and three-word aliases after the father's name (10) and the whole second names of the fork below (17), and in the Indian `alias` uses the whole-name aliases (about 9); taking to the end as M2 does (the 23 given-part aliases); pairing word counts on either side of the marker, which no pattern supports (`Lau Chi Keong @ Thomas Lau`); reading `@Word` after a name word as a marker, which is a handle in 13 of 16 such uses; and splitting a glued `X@Y` at tokenize, an alias in 15 uses and no name in 8 (an e-mail address that lost its dot, a team code). + THE FORK: with two or more words after the marker and no boundary among them, the alias takes them all: 17 of the spaced uses are a whole second name (`Tan Wei Keong @ Daniel Tan`) and 10 a one-word alias before the family name, and in the Indian `alias` uses about 9 against 2. The one-word reading loses its family name to the nickname (N4's Accepted). Reporting it is left Open. + THE NEIGHBOURING RULES: N3 reads a lone word beside a delimited nickname as the family name, and an alias leaves it to O5 instead (`Osman @ Jaki` given 'Osman', reported; `Osman (Jaki)` family 'Osman'): N3's premise, a person set down by surname, does not hold of the Malay and Indian names that write an alias marker, which mostly hold no family name. And a clause led by an alias marker in a pair the caller declared maiden reads as the nickname, the marker saying which field it means, as M3's marker overrides a nickname pair. + THE GIVEN PART AFTER A FAMILY COMMA (code review, then its fix's review): the alias first stopped there at the first suffix word, so a trailing title, a bare salutation (H8), a member of the ambiguous class and a numeral its comma-free twin reads out stayed in the nickname (`Smith, John @ Jack Prof.`, `Doe, Jane @ Janey Mrs`, `Osman, Rahim @ Jaki V`). The first fix read the part's end through the clause-free view as the part holding the family name does; its review found that trading three disagreements for others (`Osman, Rahim @ Jaki Mc` read the suffix where the twin reads family `Mc Osman`, `Jaki PhD Ali` went whole into the nickname, a `KC` lost its report), the disagreement between `tail_reading` and the given part's walk that the root AGENTS.md's gotcha records. So the alias there stops instead at the first word that part's own reading may take out of the name (a suffix word, a title opening the part's trailing run, a member of the ambiguous credential class) and hands the rest back to that reading, which then reads it as it reads the same words with no alias: every shape both reviews listed reads as its twin, reports included, save a lone roman numeral. Handed back, `V` was reported with its initial reading in the middle name, while an initial written there (`Osman, Rahim @ Jaki Q`) is the alias's, which `tests/v2/test_cases.py`'s alternative check refused; so the numeral stays in the alias, as the initial it is shaped like does (N4's Accepted). The cost is a word handed back that the reading keeps a name word, read where the twin reads it (`Osman, Rahim @ Jaki St.` gives family `St. Osman`, N4's Accepted). + THE MAIDEN CLAUSE BEFORE THE ALIAS (same reviews): it is left out of the words the alias's trailing run counts against only where M2's take would take it, which is asked of the take itself over the words before the alias: `Jane née Jones @ JJ V` keeps `V` in the nickname, reported, as `Jane née Jones V` keeps it in the maiden name, and a marker M2 refuses (`Dr née Jones @ JJ V`, behind a title) leaves its words counted. A marker of either kind left a word is no name word for an alias marker behind it (`Jane Smith née @ JJ` reads maiden `@ JJ`, as master does). + THE SECOND FIX REVIEW: an alias ended by a maiden marker reads its end over the words before that marker (`Rahim Osman @ Jaki Prof. née Smith` gives title `Prof.`, as its twin does; found by `test_a_maiden_clause_changes_nothing_else`), but only where M2 takes the marker: behind a suffix word or with nothing after it the marker is a word, and its twin's suffix run keeps it (`Rahim Osman @ Jaki Jr. née Smith` gives suffix `Jr. née Smith`). And in the given part a title stops the alias only where it opens the part's trailing run: inside the part the walk keeps it a name word (`Osman, Rahim @ Jaki Dr Ali` gives nickname `Jaki Dr Ali`). Each reading compared with the same name written without the alias under the three name orders. + ORDER: the alias takes run before the maiden take, the alias stopping at a maiden marker, so `Jane Smith @ Janey née Jones` and `Jane Smith née Jones @ JJ` both read nickname and maiden apart. + MEASURED 2026-11-20 against the merge base de8324a8 (a `git archive` export), with `uv run python tools/differential/snapshot.py --local --base ` and `local_agreement.py --base `: every moved name had read the marker inside a name field before (`middle '@ Jaki'`), so no field the change moved had been right; what each now reads, by hand: my-candidates 71 moves, 64 right, 5 the fork with no family left (one-word alias before a surname or a whole second name, unclear which), 2 wrong as before (a whole second name holding `bin`, which ends the alias at the patronymic; and the unlisted `B` abbreviation, which the alias runs through); opensanctions-parliaments 3 right; orcid-researchers 10, 8 right and 2 the fork; nepal-candidates 2, 1 right and 1 the fork; psc-individuals 3, the `urf` names, 1 right and 2 the fork; fec-individuals none (`aka` is off). The committed snapshot moved one name, the fork. Scored against the filed boxes, PSC's 3 count as regressions (the filers typed the alias into the surname box, `Mr Ghulam Ali Urf Adeel` shape) and ORCID's 1 (a whole second name whose last word the filer boxed as the family), its 7 other moves disagreeing with the boxes before and after (the boxes hold the `@`). diff --git a/docs/design/decisions/README.md b/docs/design/decisions/README.md index 75f5d990a..cb67e853d 100644 --- a/docs/design/decisions/README.md +++ b/docs/design/decisions/README.md @@ -70,6 +70,7 @@ Entry conventions: - [N1 — the default delimiter pairs](N1-default-delimiter-pairs.md) - [N2 — same-character quotes and shared-character conventions](N2-same-character-quotes-and-shared-character-conventions.md) - [N3 — the lone-word nickname rule](N3-lone-word-nickname-rule.md) +- [N4 — the alias marker](N4-alias-marker.md) ## Maiden names (M) diff --git a/docs/design/mechanisms.md b/docs/design/mechanisms.md index 9a384c1a5..df25d09b4 100644 --- a/docs/design/mechanisms.md +++ b/docs/design/mechanisms.md @@ -110,9 +110,9 @@ This catalog converts discovery into a one-time cost — it does not remove disc **Contract statement.** Read the name as if the construct were not written, using the rule that reads that position, not the whole parse. The construct takes only what that reading leaves. Where later stages could still move what the reading decided, give those words their roles at the take so no later join can reach them. The invariant then holds by construction and is not a property each stop must defend. -**How it works.** M2 before #601 scanned forward, stopped at suffix-looking words, and kept a release check asking at each stop whether the name left standing would read what was given up as post-nominals. That check modelled the P2 chain, the P5 bound join and P6's attachment, and #548 was it failing at the one stop that never asked. #601 replaced the stops and the check with the clause-free reading plus the bind: a net 689 lines out of `_group.py` (+210/−899 in the #601 commit), and #535's grids went from 15,586 and 8,713 invariant violations to 0 (prototype measurement, 2026-10-03, #601's comments). The first half already appears twice. H5's trailing title is TRANSPARENT: "what stands once the chain is taken reads exactly as it would read written without the title, plus the title". P3 and P8 ask the word count and the one-case question of the name's OWN words, so a clause beside the name changes neither. M2 is the first to bind as well, because its construct sits in front of the run it reads and the joins come later. C1 is the second (#613, rules/C7): the part after the comma is read once, after classify and before any join, by the reading a part holding no name word gets, and a postnominal part's roles are set there. segment had decided the structure before the tags existed, so it modelled group's particle chain (#562's pair) and assign's reading of a run the capitals settle, and assign re-decided #296's positional read with a second count; all three went. S2 is the third (#614): the trailing run of a main segment is read once, between P3's connective joins and the particle chain, and split off, so the joins that had re-asked the peel before and after themselves -- the chain's stop and its rollback, the bound-given reserve's two views -- answer from that one reading, and assign places the run off it. Where the read sits is the lesson. Joins the run does not depend on but whose units it counts come FIRST: read before P3's connectives, the H5 chain took the second title of a bare `Mr. and Mrs.` and left 'and' as the family name, and a joined pair counted as two words (#614's review). Joins the run does depend on come after, and the read counts what they will build instead -- the particle chain's run and the words it joins as one unit, marked on the pieces rather than built, with every word the reading weighs still a word of its own: #614 counted through a merged copy, whose review found it hiding a shape-only roman numeral and a title inside a credential run, each patched there, until #620 counted the chain's units over the pieces as written (decisions/S2). Two limits, both measured on #601. Read with the TRAILING rule, not the full parse: a head the full parse reads differently (H1's lone title, a P5 join) would otherwise move where the construct ends. And binding means the run can read differently from the same words with no construct (`JANE Q. DOE GEB. LE DO DO` gives suffix `DO DO`, while the full parse of `JANE Q. DOE DO DO` chains them into the family), which rules/M2 accepts in so many words. +**How it works.** M2 before #601 scanned forward, stopped at suffix-looking words, and kept a release check asking at each stop whether the name left standing would read what was given up as post-nominals. That check modelled the P2 chain, the P5 bound join and P6's attachment, and #548 was it failing at the one stop that never asked. #601 replaced the stops and the check with the clause-free reading plus the bind: a net 689 lines out of `_group.py` (+210/−899 in the #601 commit), and #535's grids went from 15,586 and 8,713 invariant violations to 0 (prototype measurement, 2026-10-03, #601's comments). The first half already appears twice. H5's trailing title is TRANSPARENT: "what stands once the chain is taken reads exactly as it would read written without the title, plus the title". P3 and P8 ask the word count and the one-case question of the name's OWN words, so a clause beside the name changes neither. M2 is the first to bind as well, because its construct sits in front of the run it reads and the joins come later. C1 is the second (#613, rules/C7): the part after the comma is read once, after classify and before any join, by the reading a part holding no name word gets, and a postnominal part's roles are set there. segment had decided the structure before the tags existed, so it modelled group's particle chain (#562's pair) and assign's reading of a run the capitals settle, and assign re-decided #296's positional read with a second count; all three went. S2 is the third (#614): the trailing run of a main segment is read once, between P3's connective joins and the particle chain, and split off, so the joins that had re-asked the peel before and after themselves -- the chain's stop and its rollback, the bound-given reserve's two views -- answer from that one reading, and assign places the run off it. Where the read sits is the lesson. Joins the run does not depend on but whose units it counts come FIRST: read before P3's connectives, the H5 chain took the second title of a bare `Mr. and Mrs.` and left 'and' as the family name, and a joined pair counted as two words (#614's review). Joins the run does depend on come after, and the read counts what they will build instead -- the particle chain's run and the words it joins as one unit, marked on the pieces rather than built, with every word the reading weighs still a word of its own: #614 counted through a merged copy, whose review found it hiding a shape-only roman numeral and a title inside a credential run, each patched there, until #620 counted the chain's units over the pieces as written (decisions/S2). Two limits, both measured on #601. Read with the TRAILING rule, not the full parse: a head the full parse reads differently (H1's lone title, a P5 join) would otherwise move where the construct ends. And binding means the run can read differently from the same words with no construct (`JANE Q. DOE GEB. LE DO DO` gives suffix `DO DO`, while the full parse of `JANE Q. DOE DO DO` chains them into the family), which rules/M2 accepts in so many words. N4's alias marker (#1164) reads and binds through the same function rather than a copy: an alias reaching the end of a part the trailing rules read (no comma, or the part before a suffix comma) takes the trailing run as M2's clause does; one a patronymic particle or another marker ends inside the part, and one in the given part after a family comma, stops at the first suffix word and binds nothing. -**Lives in.** nameparser/_pipeline/_group.py (`_maiden_take`: the view, `tail_reading` over it, and the role-tagged pieces `group()` applies); nameparser/_pipeline/_pieces.py (`tail_reading`, H5's chain); the P3 own-word test in `_group.py`; nameparser/_pipeline/_comma.py (C1's read-and-bind); `_pieces.read_trailing_run` and `_chain_units`, and the read after P3's joins in `_group._group_segment` (S2's). +**Lives in.** nameparser/_pipeline/_group.py (`_clause_take`, shared by `_maiden_take` and `_alias_takes`: the view, `tail_reading` over it, and the role-tagged pieces `group()` applies); nameparser/_pipeline/_pieces.py (`tail_reading`, H5's chain); the P3 own-word test in `_group.py`; nameparser/_pipeline/_comma.py (C1's read-and-bind); `_pieces.read_trailing_run` and `_chain_units`, and the read after P3's joins in `_group._group_segment` (S2's). **Reach for it when.** A rule is growing stops, exceptions or a release check whose job is to keep one construct from disturbing the rest of the name, and above all when that check has started to model another stage. Ask what the name reads as without the construct, and make that the rule. @@ -136,7 +136,9 @@ This catalog converts discovery into a one-time cost — it does not remove disc **How it works.** M2 (#601): a marker counts only behind a name word of the part holding the family name, not behind the leading title run, an unambiguous suffix word or a connective. So `Dr. nee Smith` gives first `nee`, last `Smith`, and `Jane Doe PhD nee Smith` gives suffix `PhD nee Smith`, neither designed. P3 is the same shape for the connectives that are also generational vocabulary: `i` joins only where "a name word stands on each side of it". The condition must be checked against real names, not just against the vocabulary. #601's first cut also refused a marker behind a particle and broke `Mai Le née Nguyen` and `Anh Do née Tran` — Le, Do and Van are particle vocabulary and among the commonest Vietnamese surnames. -**Lives in.** nameparser/_pipeline/_group.py (`_maiden_take`'s head rule; `_between_name_words` for P3). +N4 (#1164) holds its alias marker to the same neighbor, through the same function. + +**Lives in.** nameparser/_pipeline/_group.py (`_clause_take`'s head rule, for M2's and N4's markers; `_between_name_words` for P3). **Reach for it when.** A structural word is producing bad readings in positions its structure does not fit. Make its claim depend on the neighbor before adding a reading or a stop for each position. diff --git a/docs/design/rules/N-nicknames-and-quoted-names.md b/docs/design/rules/N-nicknames-and-quoted-names.md index ae6025fbd..97bbcf927 100644 --- a/docs/design/rules/N-nicknames-and-quoted-names.md +++ b/docs/design/rules/N-nicknames-and-quoted-names.md @@ -2,5 +2,5 @@ Background: a nickname is written beside the formal name, set off by quotes or brackets. Quotation conventions vary by language („…“, «…», “…”), several share characters — one convention's closer is -another's opener — and the straight apostrophe doubles as a quotation mark and as a letter-like mark inside names (O'Connor). Which pairs delimit nicknames is caller configuration. +another's opener — and the straight apostrophe doubles as a quotation mark and as a letter-like mark inside names (O'Connor). Which pairs delimit nicknames is caller configuration. A second name the person is also known by is written with a marker word too, mostly on official lists: Malaysian ballots and honours lists write `@` between the two names (`Rahim @ Jaki bin Osman`), Indian lists `urf` or `alias`, and US filings `aka`. The marker says what follows it, as a maiden marker does (M2), and the alias often stands inside the name, before a patronymic particle, rather than after it (N4). `alias` and `aka` are also given names and surnames, more often than markers, so they are read as markers only where a caller lists them. diff --git a/docs/design/rules/N3-lone-word-nickname-rule.md b/docs/design/rules/N3-lone-word-nickname-rule.md index 36d0a4ab1..bf16a3825 100644 --- a/docs/design/rules/N3-lone-word-nickname-rule.md +++ b/docs/design/rules/N3-lone-word-nickname-rule.md @@ -29,6 +29,10 @@ **Precedence:** +- **A nickname announced by an alias marker** (N4) is not counted: the rule reads a delimited nickname, and the one name word beside an alias keeps O5's reading. + ``` + "Smith @ Jack Jr." → given="Smith" + ``` - **A title word left as the one name word** ("'Smitty' Pope Jr."): this rule reads it as the family name as it reads any other, and where the suffix is written without a comma H4 keeps its doubt, whether the word is a title at all, and its report; a title-particle keeps the reading it has, as a particle does. ``` "'Smitty' Pope Jr." → family="Pope" diff --git a/docs/design/rules/N4-alias-marker.md b/docs/design/rules/N4-alias-marker.md new file mode 100644 index 000000000..e445c4c9d --- /dev/null +++ b/docs/design/rules/N4-alias-marker.md @@ -0,0 +1,128 @@ +# N4 — the alias marker + +**When:** a recognized alias marker stands as a word in a name, as in "Rahim @ Jaki bin Osman". + +**Then:** a marker that counts takes the words after it as the nickname, and is itself dropped. + +- **Where a marker counts.** Where M2's maiden marker counts, with a name word straight before it, but in any part that may hold a name word: the whole name where no comma divides it, the part before a suffix comma or a family comma, and the given part after a family comma. A part after a suffix comma holds post-nominals and titles (C2), so a marker there has no name word before it and is an ordinary word. + ``` + "Ravi Kumar urf Raju" → nickname="Raju" + "Osman, Rahim @ Jaki" → nickname="Jaki" + "Wang @ Chan, Chris" → nickname="Chan" + "Wang @ Chan, Chris" → family="Wang" + "Rahim Osman @ Jaki, PhD" → nickname="Jaki" + "Smith, John, Jr. @ Jack" → nickname="" · boundary + ``` +- **It takes the words up to the first boundary inside its part:** a word read as a patronymic particle or another marker of either kind, a suffix word before such a boundary ending the alias too. With none, it takes to the end of the part as far as M2's clause would: up to the trailing run of post-nominals and titles in the part holding the family name, and up to the first suffix word before a family comma. In the given part after a family comma it stops at the first word that part's own reading may take out of the name, a suffix word, a title opening the part's trailing run or a member of the ambiguous credential class, and hands the rest back to that reading. The words the boundary leaves are read as the name. + ``` + "Rahim @ Jaki bin Osman" → nickname="Jaki" + "Rahim @ Jaki bin Osman" → family="bin Osman" + "Rahim bin Osman @ Usman" → family="bin Osman" + "Rahim @ Jaki a/l Osman" → family="a/l Osman" + "Rahim Osman @ Jaki PhD" → suffix="PhD" + "Rahim Osman @ Jaki Prof." → title="Prof." + "Rahim @ Jaki PhD bin Osman" → nickname="Jaki" + "Smith, John @ Jack Jr." → suffix="Jr." + "Doe, Jane @ Janey Mrs" → title="Mrs" + "Osman, Rahim @ Jaki PhD Ali" → nickname="Jaki" + "Osman, Rahim @ Jaki Dr Ali" → nickname="Jaki Dr Ali" + "Jane Smith @ Janey née Jones" → maiden="Jones" + "Jane Smith née Jones @ JJ" → nickname="JJ" + ``` +- **Several words with no boundary among them are all taken**, so a whole second name is the nickname, and so is a byname of two words. + ``` + "Tan Wei Keong @ Daniel Tan" → nickname="Daniel Tan" + "Rahim Osman @ Tok Ben" → nickname="Tok Ben" + ``` +- **Two aliases join into one nickname**, as two bracketed nicknames do. + ``` + "Mohd @ Ali bin Abu @ Bakar" → nickname="Ali Bakar" + ``` +- **A bracketed or quoted clause whose content opens with a recognized alias marker and carries a word after it reads as the nickname**, whichever bucket the enclosing pair sits in, the marker dropped as M3 drops it. + ``` + "Ravi Kumar (urf Raju)" → nickname="Raju" + "Ravi (urf Raju) Kumar" → family="Kumar" + "Ravi Kumar (urf Raju)" maiden-parens → nickname="Raju" + ``` + +**Because:** an alias marker announces a second name the person is also known by; the marker is an announcement, not a name. + +``` +"Rahim Osman @ Jaki" → nickname="Jaki" +``` + +**Except:** + +- **The at sign is a marker only written as a word of its own.** Glued to a word it is part of that word, as in an e-mail address or a handle. + ``` + "Rahim Osman@Usman" → nickname="" · boundary + "Rahim Osman@Usman" → family="Osman@Usman" · boundary + "Rahim @Usman" → nickname="" · boundary + ``` +- **The English alias and aka are recognized only where a caller lists them or chooses English**, each being a given name or a surname more often than a marker. + ``` + "Ravi Kumar alias Raju" → nickname="" · boundary + "Ravi Kumar alias Raju" aka+alias → nickname="Raju" + "Boscia, Frank aka Francis" aka+alias → nickname="Francis" + ``` +- **A marker with nothing after it or no name word before it is just a word**, and so is one behind a title, a suffix word, a connective or a marker of either kind left a word, as M2 says of its marker. + ``` + "Rahim Osman @" → family="@" · boundary + "Osman, @ Jaki" → nickname="" · boundary + "Sir @ Jaki Osman" → nickname="" · boundary + "Jane Smith née @ JJ" → maiden="@ JJ" · boundary + ``` +- **A suffix word, a patronymic particle or another marker straight after a bare marker announces nothing**, and the marker is then a word. + ``` + "Rahim Osman @ Jr" → nickname="" · boundary + ``` +- **A marker followed by a comma in a delimited clause is no marker**, as M3 says of its marker. + ``` + "Ravi Kumar (urf, Raju)" → nickname="urf, Raju" · boundary + ``` + +**Precedence:** + +- **A maiden marker in the same part:** the alias ends at it, and the maiden clause then reads as M2 reads it without the alias, so either may come first; an alias ended by a maiden marker that M2 takes reads its end as the name with no clause written, and a maiden clause M2 takes before the alias is no word of the name the alias's trailing run is counted against. + ``` + "Rahim Osman @ Jaki Prof. née Smith" → title="Prof." + "Rahim Osman @ Jaki Jr. née Smith" → suffix="Jr. née Smith" + "Jane née Jones @ JJ V" → nickname="JJ V" + "Dr née Jones @ JJ V" → suffix="V" · boundary + ``` +- **A pair configured for maiden names** (M1): a clause it encloses that opens with an alias marker reads as the nickname, the marker saying which field it means as M3's marker does; M1 governs a clause with no marker. +- **The lone-word nickname rule** (N3) counts a delimited nickname only. One name word left beside an alias keeps the reading O5's convention gives it, the given name by default, and the fork is reported, since a name written with an alias marker is mostly a Malay or Indian name with no family name in it. + ``` + "Osman @ Jaki" → given="Osman" + "Osman (Jaki)" → family="Osman" · boundary + ``` + +**Accepted:** + +- A word the given part after a family comma hands back stops the alias even where that reading then keeps it a name word, so a particle-title such as `St.` ending the part is the family name's, as it is with no alias. + ``` + "Osman, Rahim @ Jaki St." → family="St. Osman" + ``` +- A lone roman numeral ending an alias in the given part after a family comma is taken with it, being shaped like the initial an alias there takes, where the same words with no alias read it as the suffix, reported. + ``` + "Osman, Rahim @ Jaki V" → nickname="Jaki V" + "Osman, Rahim Jaki V" → suffix="V" · boundary + ``` + +- A one-word alias followed by the family name takes the family name with it, the two shapes being written alike: the whole second name reads right and the one-word alias loses its family name to the nickname. + ``` + "Rahim @ Jaki Osman" → nickname="Jaki Osman" + "Rahim @ Jaki Osman" → family="" + ``` +- A marker opening a delimited clause is dropped whatever word follows it, as M3 takes the word after its marker untested, so a suffix word there is the nickname where after a bare marker it would leave the marker a word. + ``` + "Ravi Kumar (urf Jr)" → nickname="Jr" + ``` +- Where a particle ends the words before the marker, it bounds the particle join as M2's marker does, and the particle is left as the family name. + ``` + "Rahim de la @ Jaki Vega" → family="de la" + ``` + +--- +**Signal:** neighbor +**history:** decisions/N4 · **implemented:** nameparser/_pipeline/_group.py, nameparser/_pipeline/_extract.py, nameparser/_pipeline/_classify.py diff --git a/docs/design/rules/README.md b/docs/design/rules/README.md index d97eaccea..946849afc 100644 --- a/docs/design/rules/README.md +++ b/docs/design/rules/README.md @@ -163,6 +163,7 @@ Terms the rules use without defining them each time, each with the rule that def - [N1 — the default delimiter pairs](N1-default-delimiter-pairs.md) - [N2 — same-character quotes and shared-character conventions](N2-same-character-quotes-and-shared-character-conventions.md) - [N3 — the lone-word nickname rule](N3-lone-word-nickname-rule.md) +- [N4 — the alias marker](N4-alias-marker.md) ## [Maiden names (M)](M-maiden-names.md) diff --git a/docs/migrate.rst b/docs/migrate.rst index 544263727..a3e9bf266 100644 --- a/docs/migrate.rst +++ b/docs/migrate.rst @@ -2412,3 +2412,31 @@ To read one of the four as a name, remove its reading: >>> as_31 = Parser(lexicon=Lexicon.default().remove("qari", kind="religious")) >>> as_31.parse("Qari Ahmed Khan").given 'Qari' + +Alias markers: @ and urf +^^^^^^^^^^^^^^^^^^^^^^^^ + +A second name written after ``@`` standing as a word of its own, or +after ``urf``, is the nickname, and the marker is dropped, where 1.4 +through 3.1 read both as name words. The alias stops at a patronymic +particle such as ``bin``, so the father's name after it stays the family +name. An ``@`` glued to a word, as in an e-mail address, is part of that +word, as before: + +.. doctest:: + + >>> rahim = parse("Rahim @ Jaki bin Osman") + >>> rahim.given, rahim.nickname, rahim.family + ('Rahim', 'Jaki', 'bin Osman') + >>> parse("Ravi Kumar urf Raju").nickname + 'Raju' + >>> parse("Rahim Osman@Usman").family + 'Osman@Usman' + +To read the two as name words again, remove their readings: + +.. doctest:: + + >>> as_31 = Parser(lexicon=Lexicon.default().remove("@", "urf", kind="alias_marker")) + >>> as_31.parse("Ravi Kumar urf Raju").middle + 'Kumar urf' diff --git a/docs/release_log.rst b/docs/release_log.rst index 888cac325..eb656b403 100644 --- a/docs/release_log.rst +++ b/docs/release_log.rst @@ -4,6 +4,7 @@ Release Log nameparser 3.2 is under development. + - **Read a second name written after @ or urf as the nickname.** ``parse("Rahim @ Jaki bin Osman")`` gives given ``Rahim``, nickname ``Jaki``, family ``bin Osman``, where 1.4.0 through 3.1.0 gave middle ``@ Jaki``; the alias runs to a patronymic particle, another marker or a comma, and a one-word alias before the family name takes the family name with it (``Rahim @ Jaki Osman`` gives no family name). ``alias`` and ``aka`` are read so only where you add them (``Lexicon.add("aka", kind="alias_marker")``); an ``@`` glued to a word is part of it. :issue:`1164` - **Fix an Arabic-script name written with الدين or الله second, which read as two names.** ``parse("نور الدين سامر حداد")`` gives given ``نور الدين``, where 1.4.0 through 3.1.0 gave given ``نور``, middle ``الدين سامر``; ending the name the pair is the family name, and ``الدین``, ``اله`` and ``اللہ`` read the same way; a name of two name words keeps them apart. ``Lexicon.add`` accepts a new kind, ``bound_second``, for such a word. :issue:`1072` - **Add Qari, Moulana, Alhaj and Alhajj as titles, the religious titles written before a name in Pakistan and Bangladesh.** ``parse("Qari Ahmed Khan")`` gives title ``Qari``, given ``Ahmed``, where 1.4.0 through 3.1.0 gave given ``Qari``, middle ``Ahmed``. ``Hafiz``, ``Hafez``, ``Haji`` and the spelling ``Maulana``, often borne as given names, still read as the given name. :issue:`1469` - **Fix Abdel, Abd and Abou past the first word of a name, which read as a middle name of their own.** ``parse("Tariq Abdel Aziz")`` gives family ``Abdel Aziz``, where 1.4.0 through 3.1.0 gave middle ``Abdel``, family ``Aziz``. ``Abdul`` joins only in a name of four words or more, titles and suffixes not counted, so ``Tariq Abdul Aziz`` keeps middle ``Abdul``; and after a family comma ``Abd`` before a name word is no longer the credential ABD. :issue:`1464` diff --git a/docs/shapes.rst b/docs/shapes.rst index 0287a1295..05bdac3ee 100644 --- a/docs/shapes.rst +++ b/docs/shapes.rst @@ -275,6 +275,10 @@ Each row's reading kind is what :meth:`Lexicon.words(kind=...) - the following name - ``maiden`` - ``Jane Smith née Jones`` → ``Jones`` + * - Alias markers (``alias_marker``) + - the following name, up to ``bin`` or a comma + - ``nickname`` + - ``Rahim @ Jaki bin Osman`` → ``Jaki`` * - Conjunctions (``conjunction``) - the words on both sides - any @@ -404,6 +408,17 @@ Nicknames and maiden names >>> parse("Jane Smith née Jones").maiden 'Jones' +A second name written after ``@`` or ``urf`` is a nickname too, as +Malaysian and Indian lists write one; it runs to a patronymic particle +such as ``bin``, so the father's name after it stays the family name +(``alias`` and ``aka`` are read so only where you add them, see +:doc:`customize`): + +.. doctest:: + + >>> parse("Rahim @ Jaki bin Osman").nickname + 'Jaki' + Both fields appear in the default ``str()`` rendering — the nickname quoted after the given name, the maiden name parenthesized after the family name: diff --git a/nameparser/_lexicon.py b/nameparser/_lexicon.py index ce2fe0c91..209929c75 100644 --- a/nameparser/_lexicon.py +++ b/nameparser/_lexicon.py @@ -610,6 +610,10 @@ class _LexiconSets: #: the words of `bound_seconds` every reading of which lists #: `completes`, joining behind those words alone bound_seconds_listed: frozenset[str] + #: the words that announce a second name the person is known by + #: (`@`, `urf`), which rules/N4 reads the words after as the + #: nickname (#1164) + alias_markers: frozenset[str] #: Lexicon field -> the compiled constant it is read from, for every @@ -656,6 +660,7 @@ class _LexiconSets: "bound_seconds": "BOUND_SECONDS", "bound_second_phrases": "BOUND_SECOND_PHRASES", "bound_seconds_listed": "BOUND_SECONDS_LISTED", + "alias_markers": "ALIAS_MARKERS", } #: What the 2.x sets do not record: the kinds the views read (rules/R8, @@ -2458,7 +2463,8 @@ def add(self, *words: str, kind: str | None = None, ``nameparser._reading_index.CATEGORY`` (``"title"``, ``"office"``, ``"credential"``, ``"generation"``, ``"preposition"``, ``"conjunction"``, ``"bound_given"``, - ``"bound_second"`` (3.2), ``"birth_marker"``, ``"given"``, + ``"bound_second"`` (3.2), ``"birth_marker"``, ``"alias_marker"`` + (3.2), ``"given"``, ``"family"``, ...), and `properties` that kind's behavioral properties as the files spell them (``addresses="given"``, ``after_given=True``, diff --git a/nameparser/_pipeline/_classify.py b/nameparser/_pipeline/_classify.py index 54cc9aaac..92a06cc42 100644 --- a/nameparser/_pipeline/_classify.py +++ b/nameparser/_pipeline/_classify.py @@ -21,7 +21,7 @@ and the kinds of its suffix words and particles (Lexicon's generation_words, credential_words, honorific_words and patronymic_particles, internal -sets, 3.0) and the +sets, 3.0) and the alias markers (alias_markers, rules/N4, 3.2) and the suffix words whose Title case leans to the name (title_case_name_words, rules/S6, #1039) and the titles written short (title_abbreviations, #999) and the names a @@ -60,9 +60,9 @@ "vocab:suffix-word-ambiguous", "vocab:agnomen", "vocab:title-case-name" (a suffix word whose Title case leans to the name, rules/S6), "vocab:particle-ambiguous", "vocab:bound-given", -"vocab:given-abbreviation", "vocab:maiden-marker" and -"vocab:maiden-marker-cont" (a marker group drops leaves no token; one -read as a word keeps its tag); namespaced, read by the later stages and dropped +"vocab:given-abbreviation", "vocab:maiden-marker", +"vocab:maiden-marker-cont" and "vocab:alias-marker" (rules/N4; a +marker group drops leaves no token; one read as a word keeps its tag); namespaced, read by the later stages and dropped by assemble (`_assemble._KIND_TAGS`): "vocab:generation-word", "vocab:credential-word", "vocab:honorific-word" and "vocab:patronymic", Token.reading carrying the kind out, "vocab:trailing-title", @@ -108,7 +108,7 @@ class (rules/S12). from nameparser._pipeline._state import ( AGNOMEN_TAG, AMBIGUOUS_ACRONYM_TAG, AMBIGUOUS_WORD_TAG, COMMA_STRIP, CREDENTIAL_WORD_TAG, GENERATION_WORD_TAG, GIVEN_ABBREVIATION_TAG, HONORIFIC_WORD_TAG, - BOUND_PHRASE_TAG, BOUND_SECOND_TAG, PARTICLE_GIVEN_TAG, PATRONYMIC_TAG, SHAPE_ACRONYM_TAG, SHARED_NAME_TAG, SPLIT_CREDENTIAL_TAG, SPLIT_MEMBER_TAG, TITLE_AMBIGUOUS_TAG, + ALIAS_MARKER_TAG, BOUND_PHRASE_TAG, BOUND_SECOND_TAG, PARTICLE_GIVEN_TAG, PATRONYMIC_TAG, SHAPE_ACRONYM_TAG, SHARED_NAME_TAG, SPLIT_CREDENTIAL_TAG, SPLIT_MEMBER_TAG, TITLE_AMBIGUOUS_TAG, TITLE_CASE_NAME_TAG, CHAIN_TITLE_TAG, DOTTED_TITLE_TAG, JOINED_TITLE_TAG, TRAILING_TITLE_TAG, ParseState, @@ -317,6 +317,9 @@ def _tags_for(token: WorkToken, n: str, state: ParseState, # kind, read here as a suffix word's is (decisions/R9, #754) if n in lex._sets.patronymic_particles: tags.add(PATRONYMIC_TAG) + # rules/N4: "a recognized alias marker" -- group reads the tag + if n in lex._sets.alias_markers: + tags.add(ALIAS_MARKER_TAG) # rules/P8: "a single-letter connective reads as an initial # where the writing says so: written as a bare Latin capital in a # name that is not written wholly in one case, or — in a name @@ -583,13 +586,18 @@ def classify(state: ParseState) -> ParseState: # gives each word its vocabulary whichever side of the comma it # stands ('(Jr, PhD)', '(MBA, PhD)'); a maiden marker's comma # unmakes the marker (M3), which the marker pass above has already - # read off the word as written (decisions/S1, #792) + # read off the word as written (decisions/S1, #792), and so does an + # alias marker's (rules/N4), which keeps its comma here to be read + # as no marker if state.extracted: for i, t in enumerate(state.tokens): if (t.role is not None and i not in marker_tags and (bare := t.text.strip(COMMA_STRIP)) and bare != t.text): + fold = _normalize(bare) + if fold in state.lexicon._sets.alias_markers: + continue readers[i] = copy_with(t, text=bare) - folded[i] = _normalize(bare) + folded[i] = fold # a list, not a generator: tuple() over a generator cost a frame # per token for each resume tokens = tuple([ diff --git a/nameparser/_pipeline/_extract.py b/nameparser/_pipeline/_extract.py index e2f0be7a9..9078688df 100644 --- a/nameparser/_pipeline/_extract.py +++ b/nameparser/_pipeline/_extract.py @@ -10,10 +10,13 @@ it from a multi-token clause (#329). A region reaches that role two ways: the pair that matched sits in Policy.maiden_delimiters (M1), or the content itself opens with a -marker word (M3), which reassigns the role after the match and so is -the one thing here that a bucket alone does not decide. +marker word (M3). The content's marker reassigns the role after the +match both ways -- a maiden marker to the maiden name (M3), an alias +marker to the nickname (N4) -- and so is the one thing here that a +bucket alone does not decide. Reads: Policy.nickname_delimiters, Policy.maiden_delimiters, -Lexicon.maiden_markers, Lexicon.particles (an apostrophe opening a +Lexicon.maiden_markers, Lexicon.alias_markers (rules/N4), +Lexicon.particles (an apostrophe opening a listed particle, rules/N2), Policy.strip_emoji and Policy.strip_bidi (through `_tokenize._ignorable`, where that particle's word ends), and through `_vocab.set_apart_kind` and @@ -25,7 +28,7 @@ honorific_words (through `_vocab.settles_a_member`, the words that do NOT settle a member beside them, rules/S1). -Implements rules N1, N2, S1, M1 and M3 of docs/design/rules/ (the #273 +Implements rules N1, N2, N4, S1, M1 and M3 of docs/design/rules/ (the #273 matching mechanism); each is cited at its code below. One scan mechanic worth stating up front: matching is one left-to-right pass, no nesting, and delimiter characters inside a matched region are @@ -122,6 +125,20 @@ def _maiden_marked(content: str, lexicon: Lexicon) -> bool: and not comma_follows_marker(words[run])) +# rules/N4: "a bracketed or quoted clause whose content opens with a +# recognized alias marker and carries a word after it reads as the +# nickname" +def _alias_marked(content: str, lexicon: Lexicon) -> bool: + """M3's test for an alias marker, which is one word: the marker + opens the content, a word follows it, and no comma follows the + marker. Split on whitespace as `_maiden_marked` is, for the same + reason (this stage runs before tokenize).""" + words = content.split(None, 2) + return (len(words) > 1 + and _normalize(words[0]) in lexicon._sets.alias_markers + and not comma_follows_marker(words[1])) + + # rules/N2: "a quote whose open and close are the same character # opens only at a word start and closes only at a word end, so an # apostrophe inside or at the end of a word is literal" @@ -340,6 +357,12 @@ def extract_delimited(state: ParseState) -> ParseState: if (role is Role.NICKNAME and _maiden_marked( text[inner.start:inner.end], state.lexicon)): role = Role.MAIDEN + elif (role is Role.MAIDEN and _alias_marked( + text[inner.start:inner.end], state.lexicon)): + # rules/N4: "whichever bucket the enclosing pair + # sits in" -- M3's mirror for a pair configured + # maiden + role = Role.NICKNAME extracted.append((role, inner)) masked.append(Span(i, j + len(close))) # position-driven scanning makes overlapping matches diff --git a/nameparser/_pipeline/_group.py b/nameparser/_pipeline/_group.py index 4661a0f08..8f626512a 100644 --- a/nameparser/_pipeline/_group.py +++ b/nameparser/_pipeline/_group.py @@ -67,12 +67,14 @@ the merge and rules/P3's connective joins (join_connectives), when the comma decision's own copy of those joins was folded into them. What remains defined here is group's own: the piece predicates -_is_rootname, _is_maiden_marker_piece, _is_lone_letter and -_is_name_word, beside the helpers of its joins and its maiden take. +_is_rootname, _is_maiden_marker_piece, _ends_an_alias, _is_lone_letter +and _is_name_word, beside the helpers of its joins and its marker takes +(maiden and alias, rules/M2 and N4). """ from __future__ import annotations import bisect +import operator from collections.abc import Iterable, Sequence, Set from enum import IntEnum from typing import assert_never @@ -89,7 +91,7 @@ trailing_start_past_titles, ) from nameparser._pipeline._state import ( - AMBIGUOUS_ACRONYM_TAG, BOUND_PHRASE_TAG, BOUND_SECOND_TAG, SPLIT_CREDENTIAL_TAG, + ALIAS_MARKER_TAG, AMBIGUOUS_ACRONYM_TAG, BOUND_PHRASE_TAG, PATRONYMIC_TAG, BOUND_SECOND_TAG, SPLIT_CREDENTIAL_TAG, SPLIT_MEMBER_TAG, TRAILING_TITLE_TAG, ParseState, Deferred, PendingAmbiguity, Structure, WorkToken, _AMBIGUOUS_CREDENTIAL_TAGS, copy_with, @@ -112,15 +114,19 @@ # merged reading Piece = list[int] -#: What the marker pass took out of a segment: the marker's TOKEN -#: indices (more than one where the entry is a phrase, 'z domu'), and -#: every other piece it took with the role that piece takes -- the -#: maiden name's Role.MAIDEN, and the trailing run's SUFFIX or TITLE -#: (#601). `_group_segment` produces it. +_SPAN_START = operator.attrgetter("span.start") +_MARKER_TAGS = frozenset({ALIAS_MARKER_TAG, "vocab:maiden-marker"}) +#: What the marker passes took out of a segment: the markers' TOKEN +#: indices (a maiden marker's more than one where the entry is a +#: phrase, 'z domu'; every alias marker's, rules/N4), and every other +#: piece they took with the role that piece takes -- the maiden name's +#: Role.MAIDEN, an alias's Role.NICKNAME, and the trailing run's SUFFIX +#: or TITLE (#601). `_apply_take` builds it, take by take. MaidenTake = tuple[Piece, list[tuple[Piece, Role]]] -#: What `_maiden_take` answers with, one index space further out: PIECE -#: indices into its own `pieces` argument. `_group_segment` resolves -#: them to the token indices MaidenTake declares, which is the only +#: What `_clause_take` answers with (through `_maiden_take` and +#: `_alias_takes`), one index space further out: PIECE indices into its +#: own `pieces` argument. `_apply_take` resolves them to the token +#: indices MaidenTake declares, which is the only #: reason the two are different types rather than one name used twice. MaidenIndices = tuple[list[int], list[tuple[int, Role]]] @@ -130,14 +136,15 @@ class ClauseSite(IntEnum): counts there at all and which rule reads the end of the part (rules/M2, #601). - A marker counts only in the part holding the family name, so - GIVEN_SLOT and TAIL are statements, not defaults: a marker there is - an ordinary word. FAMILY_PART is the part before a family comma, - where a marker counts but no trailing rule reads the words after - the clause. + A maiden marker counts only in the part holding the family name, so + GIVEN_SLOT and TAIL are statements, not defaults: a maiden marker + there is an ordinary word; an alias marker (rules/N4) counts in + GIVEN_SLOT too, and in no TAIL. FAMILY_PART is the part before a + family comma, where a marker counts but no trailing rule reads the + words after the clause. - A CLOSED set: `_maiden_take` dispatches on it exhaustively, ONCE - (`typing.assert_never`). group() is the one place (structure, + A CLOSED set: `_clause_take` dispatches on it exhaustively, ONCE + (`typing.assert_never`), for both markers. group() is the one place (structure, segment index) is mapped onto it, and tests/v2/pipeline/ test_group.py's `test_the_site_is_pinned_to_the_structure_it_is_ read_from` pins that mapping -- by watching the call, not by @@ -146,7 +153,7 @@ class ClauseSite(IntEnum): FAMILY_PART = 0 # FAMILY_COMMA segment 0: a marker counts, nothing trails TRAILING = 1 # NO_COMMA, SUFFIX_COMMA segment 0: S2 peel + H5 chain - GIVEN_SLOT = 2 # FAMILY_COMMA segment 1: a marker is an ordinary word + GIVEN_SLOT = 2 # FAMILY_COMMA segment 1: a maiden marker is a word; an alias marker counts TAIL = 3 # every tail segment: a marker is an ordinary word @@ -265,7 +272,8 @@ def _maiden_take(pieces: Sequence[Sequence[int]], an ordinary word. Piece indices into `pieces`, not the TOKEN indices `_group_segment` builds out of them. - Three questions, in order (rules/M2, #601): + Three questions, in order (rules/M2, #601), answered by + `_clause_take`, which rules/N4's alias take shares: * WHERE A MARKER COUNTS. Only in the part holding the family name -- never in the given part after a family comma, never in a tail @@ -300,11 +308,49 @@ def _maiden_take(pieces: Sequence[Sequence[int]], return None # the marker may be a phrase, in which case it is several pieces lo = m + _marker_run_pieces(pieces, tokens, m) - if lo >= len(pieces): + return _clause_take(pieces, ptags, tokens, one_case, site, ambiguities, + m, lo, len(pieces), Role.MAIDEN, _MAIDEN_WORDS) + + +#: How a take's reports name the clause and its marker, per role +_MAIDEN_WORDS = ("maiden name", "maiden marker") +_ALIAS_WORDS = ("nickname", "alias marker") + + +def _clause_take(pieces: Sequence[Sequence[int]], + ptags: Sequence[Set[str]], + tokens: Sequence[WorkToken], + one_case: bool | None, + site: ClauseSite, + ambiguities: list[PendingAmbiguity], + m: int, lo: int, stop: int, role: Role, + words: tuple[str, str], + skip: Set[int] = frozenset(), + lead: int | None = None, + ) -> MaidenIndices | None: + """What the marker at pieces[m] takes, its own words being + pieces[m:lo]: the maiden take's three questions (see `_maiden_take`) + asked for either marker. `stop` is where a boundary ends the clause + before the end of the part (rules/N4's patronymic word or another + marker), and is `len(pieces)` where none does; `role` is the role + the clause's words take; `skip` holds the piece indices an earlier + take in the same part has already taken, which the clause-free + reading of the trailing run does not count. `lead`, where given, + stands in for the leading title run of pieces[:m]: any value below + m - 1 reads the word before the marker as past the run, so the + suffix-word test applies to it and S2's opening-suffix allowance + does not, as the run does wherever an earlier take stands between + them. None where the + marker is an ordinary word. + """ + if site is ClauseSite.TAIL: + return None + if lo >= stop: return None before = m - 1 - lead = (1 if m == 1 and is_title_piece(pieces[0], ptags[0], tokens) - else leading_titles(pieces[:m], ptags[:m], tokens)) + if lead is None: + lead = (1 if m == 1 and is_title_piece(pieces[0], ptags[0], tokens) + else leading_titles(pieces[:m], ptags[:m], tokens)) if (before < lead or (before > lead and is_suffix_piece(pieces[before], ptags[before], tokens)) @@ -313,13 +359,25 @@ def _maiden_take(pieces: Sequence[Sequence[int]], # a suffix word straight after the marker: nothing was announced if is_suffix_piece(pieces[lo], ptags[lo], tokens): return None - if site is ClauseSite.FAMILY_PART: - end = next((j for j in range(lo + 1, len(pieces)) - if "suffix" in ptags[j] - or is_suffix_piece(pieces[j], ptags[j], tokens)), - len(pieces)) - return list(range(m, lo)), [(j, Role.MAIDEN) - for j in range(lo, end)] + # no trailing rule reads the end of the clause: before a family + # comma, or where a boundary ends the clause inside the part. A + # suffix word ends it there and hands the rest back unbound. In the + # given part after a family comma (an alias only, rules/N4) so does + # any word that part's own reading may take out of the name -- a + # title, a member of the ambiguous class -- which is handed back for + # that reading to decide + given_slot = site is ClauseSite.GIVEN_SLOT + if (site is ClauseSite.FAMILY_PART or site is ClauseSite.GIVEN_SLOT + or stop < len(pieces)): + end = stop + for j in range(lo + 1, stop): + if ("suffix" in ptags[j] + or is_suffix_piece(pieces[j], ptags[j], tokens) + or (given_slot and _leaves_the_given_part( + j, pieces, ptags, tokens))): + end = j + break + return list(range(m, lo)), [(j, role) for j in range(lo, end)] if site is not ClauseSite.TRAILING: assert_never(site) c = trailing_candidates(lo, pieces, ptags, tokens) @@ -330,7 +388,12 @@ def _maiden_take(pieces: Sequence[Sequence[int]], # nothing behind the clause that a trailing rule could take: the # view would be the head alone, and the whole rest is the clause if c < len(pieces): - left = list(range(m)) + list(range(c, len(pieces))) + left = (list(range(m)) if not skip + else [i for i in range(m) if i not in skip]) + list( + range(c, len(pieces))) + # where the clause stood in the view: the words before it, less + # an earlier take's + vm = len(left) - (len(pieces) - c) view = [pieces[i] for i in left] vtags = [ptags[i] for i in left] vrest, vchained, vpeel = tail_reading( @@ -339,21 +402,21 @@ def _maiden_take(pieces: Sequence[Sequence[int]], picked = vpeel.picks titles = set(vchained) | set(vpeel.run_titles) in_run = titles | set(vrest[vpeel.names:]) | { - q for q in range(m, len(view)) if "suffix" in vtags[q]} + q for q in range(vm, len(view)) if "suffix" in vtags[q]} e = len(view) - while e - 1 >= m and (e - 1) in in_run: + while e - 1 >= vm and (e - 1) in in_run: e -= 1 - end = c + (e - m) - released = [(j, Role.TITLE if m + (j - c) in titles + end = c + (e - vm) + released = [(j, Role.TITLE if vm + (j - c) in titles else Role.SUFFIX) for j in range(end, len(pieces))] # rules/S12: "where the count takes the pair, the reading is reported" -- # the clause-free reading took it, and the take binds it here - for j, role in released: - if "split" in ptags[j] and role is Role.SUFFIX: + for j, given in released: + if "split" in ptags[j] and given is Role.SUFFIX: ambiguities.append( split_credential_report( pieces[j], tokens, - name_reading(tokens[pieces[j][0]], Role.MAIDEN))) + name_reading(tokens[pieces[j][0]], role))) # mechanisms.md#AMBIGUITY-AT-THE-DECISION-SITE: "Emit at the # site that takes the branch, not where an ambiguous tag sits" # -- the take consumed the run, so the forks the reading called @@ -364,12 +427,12 @@ def _maiden_take(pieces: Sequence[Sequence[int]], if piece[0] in consumed: ambiguities.append(PendingAmbiguity( AmbiguityKind.SUFFIX_OR_NAME, - f"{tokens[piece[0]].text!r} after the maiden name " + f"{tokens[piece[0]].text!r} after the {words[0]} " f"reads as a suffix; it may be a name word", tuple(piece), - # a name word there ends the clause's maiden name + # a name word there ends the clause alternative=name_reading(tokens[piece[0]], - Role.MAIDEN))) + role))) # ...and the member the clause KEEPS as its last word: the reading # left it a name word, which is a fork too last = pieces[end - 1] @@ -380,8 +443,8 @@ def _maiden_take(pieces: Sequence[Sequence[int]], if len(last) == 1 and not word.tags.isdisjoint(_AMBIGUOUS_CREDENTIAL_TAGS): ambiguities.append(PendingAmbiguity( AmbiguityKind.SUFFIX_OR_NAME, - f"{word.text!r} ending the maiden name is also a " - f"post-nominal; the maiden marker's clause keeps it rather " + f"{word.text!r} ending the {words[0]} is also a " + f"post-nominal; the {words[1]}'s clause keeps it rather " f"than reading it as one", tuple(last), alternative=suffix_reading(word))) elif tuple(last) in picked: @@ -393,8 +456,8 @@ def _maiden_take(pieces: Sequence[Sequence[int]], else "but written in Title case it leans to the name") ambiguities.append(PendingAmbiguity( AmbiguityKind.SUFFIX_OR_NAME, - f"{word.text!r} ending the maiden name is a roman numeral, " - f"{why}; the maiden marker's clause keeps it rather than " + f"{word.text!r} ending the {words[0]} is a roman numeral, " + f"{why}; the {words[1]}'s clause keeps it rather than " f"reading it as a generational suffix", tuple(last), alternative=suffix_reading(word))) elif (released and len(last) == 1 and end - 2 >= lo @@ -407,12 +470,181 @@ def _maiden_take(pieces: Sequence[Sequence[int]], # numeral its released post-nominal stands behind ambiguities.append(PendingAmbiguity( AmbiguityKind.SUFFIX_OR_NAME, - f"{word.text!r} ending the maiden name is a roman numeral, " - f"but a post-nominal follows it; the maiden marker's clause " + f"{word.text!r} ending the {words[0]} is a roman numeral, " + f"but a post-nominal follows it; the {words[1]}'s clause " f"keeps it rather than reading it as a generational suffix", tuple(last), alternative=suffix_reading(word))) return (list(range(m, lo)), - [(j, Role.MAIDEN) for j in range(lo, end)] + released) + [(j, role) for j in range(lo, end)] + released) + + +def _leaves_the_given_part(j: int, + pieces: Sequence[Sequence[int]], + ptags: Sequence[Set[str]], + tokens: Sequence[WorkToken]) -> bool: + """Whether the given part's own reading may read pieces[j] as no + name word, so an alias there stops before it (rules/N4): a title + word opening the part's trailing run of titles and post-nominals + (a trailing title, H8's salutation), or a member of the ambiguous + credential class. A lone roman numeral is not asked: it + is shaped like an initial, which the alias takes, and a report + naming its initial reading would name a field the alias denies it + (`test_cases`' alternative check).""" + if is_title_piece(pieces[j], ptags[j], tokens): + # a title inside the part is the walk's name word: only one + # every piece after which, to the part's end, is a title or a + # post-nominal opens the trailing run + for k in range(j + 1, len(pieces)): + if not (is_title_piece(pieces[k], ptags[k], tokens) + or "suffix" in ptags[k] + or is_suffix_piece(pieces[k], ptags[k], tokens) + or not tokens[pieces[k][0]].tags.isdisjoint( + _AMBIGUOUS_CREDENTIAL_TAGS)): + return False + return True + return (len(pieces[j]) == 1 and not tokens[pieces[j][0]].tags + .isdisjoint(_AMBIGUOUS_CREDENTIAL_TAGS)) + + +def _ends_an_alias(piece: Sequence[int], tokens: Sequence[WorkToken]) -> bool: + """rules/N4's boundaries inside a part: a word with a patronymic + reading, or another marker of either kind.""" + tags = tokens[piece[0]].tags + return len(piece) == 1 and ( + PATRONYMIC_TAG in tags or ALIAS_MARKER_TAG in tags + or "vocab:maiden-marker" in tags) + + +# rules/N4: "a marker that counts takes the words after it as the +# nickname, and is itself dropped" (history: decisions/N4, #1164) +def _alias_takes(pieces: Sequence[Sequence[int]], + ptags: Sequence[Set[str]], + tokens: Sequence[WorkToken], + one_case: bool | None, + site: ClauseSite, + ambiguities: list[PendingAmbiguity], + ) -> MaidenIndices | None: + """Every alias marker's take in the part, left to right, as one + MaidenIndices: the markers' pieces, then each alias's pieces with + Role.NICKNAME (and, where the last alias ends the name, the + trailing run's with the role the clause-free reading gives it). + + One pass over the part rather than a take and a deletion per + marker, so a part holding many markers costs no more than a linear + walk. A marker counts where M2's marker does, in any part that may + hold a name word (the given part after a family comma included, + but no tail part), and its alias runs to the first boundary + (`_ends_an_alias`) or, with none, as far as M2's clause would. + """ + n = len(pieces) + # a tail part is refused in `_clause_take` + if n < 3: + return None + markers: list[int] = [] + taken: list[tuple[int, Role]] = [] + skip: set[int] = set() + m = 1 + while m < n - 1: + # inline: asked per piece of a part holding a marker + piece = pieces[m] + if len(piece) != 1 or ALIAS_MARKER_TAG not in tokens[piece[0]].tags: + m += 1 + continue + # a marker of either kind left a word is no name word for this + # one to stand behind ('Osman @ @ Jaki', 'Smith née @ JJ') + behind = pieces[m - 1] + if len(behind) == 1 and not tokens[behind[0]].tags.isdisjoint( + _MARKER_TAGS): + m += 1 + continue + stop = next((j for j in range(m + 1, n) + if _ends_an_alias(pieces[j], tokens)), n) + # an alias a maiden marker ends in the part holding the family + # name reads its end as the name with no clause written does + # (rules/M2's "as if the clause were not written"): over the + # words before that marker, which end the name there + # -- where M2 takes that marker: a name word before it (no + # suffix word, no connective) and a word after it that is no + # suffix word, M2's head rule + end_of_name = n + if (stop < n and site is ClauseSite.TRAILING + and "vocab:maiden-marker" in tokens[pieces[stop][0]].tags): + after = stop + _marker_run_pieces(pieces, tokens, stop) + last = stop - 1 + if (after < n + and not is_suffix_piece(pieces[after], ptags[after], + tokens) + and "suffix" not in ptags[last] + and not is_suffix_piece(pieces[last], ptags[last], + tokens) + and not is_conj_piece(pieces[last], ptags[last], + tokens)): + end_of_name = stop + # a maiden clause before the marker is no word of the name the + # alias's trailing run is read against, as the maiden take reads + # without the alias (rules/N4's Precedence); a plain loop, no + # frame + view_skip: Set[int] = skip + if stop == end_of_name and site is ClauseSite.TRAILING: + for k in range(1, m): + if "vocab:maiden-marker" in tokens[pieces[k][0]].tags: + # only a clause M2's take would take: ask it, over + # the words before the alias, its reports discarded + before = _maiden_take(pieces[:m], ptags[:m], tokens, + one_case, site, []) + if before is not None: + view_skip = skip | set(before[0]) | { + j for j, _ in before[1]} + break + # past the first take, the leading title run ends before it, + # so the earlier marker's index is below m - 1 and stands in + # for the run: asking `leading_titles` of a slice per marker + # made a part of n markers quadratic (the `alias_markers` row + # of tests/v2/test_benchmark.py) + take = _clause_take( + pieces if end_of_name == n else pieces[:end_of_name], + ptags if end_of_name == n else ptags[:end_of_name], + tokens, one_case, site, ambiguities, m, m + 1, stop, + Role.NICKNAME, _ALIAS_WORDS, view_skip, + markers[0] if markers else None) + if take is None: + m += 1 + continue + markers.extend(take[0]) + taken.extend(take[1]) + skip.update(take[0]) + skip.update(j for j, _ in take[1]) + m = stop + return (markers, taken) if markers else None + + +def _apply_take(take: MaidenIndices, pieces: list[Piece], + ptags: list[set[str]], + taken: MaidenTake | None) -> MaidenTake: + """Remove a take's pieces from the segment, adding their tokens to + what the marker passes took so far: the markers' tokens, and each + other piece with its role. One rebuild rather than a deletion per + piece, so a part holding many markers stays linear.""" + marker_ks, removed = take + if taken is None: + taken = ([], []) + # plain loops, no frame: a maiden take costs two frames more than + # its inline form did, this helper's and `_clause_take`'s + gone = set(marker_ks) + for k in marker_ks: + taken[0].extend(pieces[k]) + for k, role in removed: + taken[1].append((pieces[k], role)) + gone.add(k) + kept: list[Piece] = [] + kept_tags: list[set[str]] = [] + for k in range(len(pieces)): + if k not in gone: + kept.append(pieces[k]) + kept_tags.append(ptags[k]) + pieces[:] = kept + ptags[:] = kept_tags + return taken #: What `_between_name_words` reads instead of walking: two arrays over @@ -907,15 +1139,21 @@ def _group_segment(seg: tuple[int, ...], additional: int, # The tokens are not touched here: this function reads them and # returns what it took, and group() records the drop and the roles. taken: MaidenTake | None = None + # rules/N4's alias markers first: an alias stops at a maiden marker, + # and the maiden take is then asked of what is left, so either may + # follow the other (decisions/N4). A plain loop, no frame, so a name + # with no marker pays no call (decisions/parse-cost) + for piece in pieces: + if len(piece) == 1 and ALIAS_MARKER_TAG in tokens[piece[0]].tags: + take = _alias_takes(pieces, ptags, tokens, one_case, site, + ambiguities) + if take is not None: + taken = _apply_take(take, pieces, ptags, None) + break take = _maiden_take(pieces, ptags, tokens, one_case, site, ambiguities) if take is not None: - marker_ks, removed = take - taken = ([i for k in marker_ks for i in pieces[k]], - [(pieces[k], role) for k, role in removed]) - for k in reversed(marker_ks + [k for k, _ in removed]): - del pieces[k] - del ptags[k] + taken = _apply_take(take, pieces, ptags, taken) # S2's trailing run, read once below once the connectives have # joined (#614) @@ -1733,36 +1971,43 @@ def group(state: ParseState) -> ParseState: # replicates, the exact ratio moves with the runner. Same idiom, # and the same reason, as _extract._overlaps and _tokenize's origin # resolution. test_benchmark's maiden_pairs shape is the guard. - if any(role is Role.MAIDEN for role, _ in state.extracted): - starts = [t.span.start for t in tokens] - for role, clause in state.extracted: - if role is not Role.MAIDEN: - continue - # first token starting at or after the clause opens; tokens - # are span-sorted and group never reorders or resizes them - first = bisect.bisect_left(starts, clause.start) - if (first >= len(tokens) - or "vocab:maiden-marker" not in tokens[first].tags): - continue - # How many tokens the marker is: one, or the whole run of a - # phrase entry, as classify recorded it. Same walk the - # piece test above makes, in token-index space. - run = marker_run_length( - tokens[k].tags for k in range(first + 1, len(tokens))) - # Testing the end of the token AFTER the run proves the run - # AND that token are all inside: tokens do not overlap and - # are index-ordered, so every earlier one ends no later, - # and bisect already put first.start at or after - # clause.start. That is also the "more than the marker" - # test, since the tokens inside a clause are contiguous in - # index order -- a clause holding nothing but its marker - # keeps its words, exactly as a one-token "(Nee)" does. - # rules/M3: "a marker followed by a comma is no marker" - # -- asked of the same word extract's M3 test asks it of - if (first + run < len(tokens) - and tokens[first + run].span.end <= clause.end - and not comma_follows_marker(tokens[first + run].text)): - dropped.extend(range(first, first + run)) + # rules/N4: "the marker dropped as M3 drops it" -- a nickname + # clause opening with an alias marker, by the same walk (#1164); + # a plain loop, no frame, for a name with no clause + starts: list[int] | None = None + for role, clause in state.extracted: + # extract gives a clause one of the two roles + tag = ("vocab:maiden-marker" if role is Role.MAIDEN + else ALIAS_MARKER_TAG) + if starts is None: + # map over a C getter, no frame: a name with a nickname + # clause pays none for this (decisions/parse-cost) + starts = list(map(_SPAN_START, tokens)) + # first token starting at or after the clause opens; tokens + # are span-sorted and group never reorders or resizes them + first = bisect.bisect_left(starts, clause.start) + if first >= len(tokens) or tag not in tokens[first].tags: + continue + # How many tokens the marker is: one, or the whole run of a + # phrase entry, as classify recorded it. Same walk the + # piece test above makes, in token-index space. An alias + # marker is one word, and no token carries its continuation. + run = marker_run_length( + tokens[k].tags for k in range(first + 1, len(tokens))) + # Testing the end of the token AFTER the run proves the run + # AND that token are all inside: tokens do not overlap and + # are index-ordered, so every earlier one ends no later, + # and bisect already put first.start at or after + # clause.start. That is also the "more than the marker" + # test, since the tokens inside a clause are contiguous in + # index order -- a clause holding nothing but its marker + # keeps its words, exactly as a one-token "(Nee)" does. + # rules/M3: "a marker followed by a comma is no marker" + # -- asked of the same word extract's M3 test asks it of + if (first + run < len(tokens) + and tokens[first + run].span.end <= clause.end + and not comma_follows_marker(tokens[first + run].text)): + dropped.extend(range(first, first + run)) return copy_with( state, tokens=tuple(tokens), pieces=tuple(all_pieces), piece_tags=tuple(all_ptags), dropped=tuple(dropped), diff --git a/nameparser/_pipeline/_state.py b/nameparser/_pipeline/_state.py index 73c36957a..7d96eb7a9 100644 --- a/nameparser/_pipeline/_state.py +++ b/nameparser/_pipeline/_state.py @@ -131,6 +131,13 @@ class WorkToken: #: names, and dropped from the published token like the kind tags above. PATRONYMIC_TAG = "vocab:patronymic" +#: On a word the lexicon holds as an alias marker (`@`, `urf`), which +#: group reads to take the words after it as the nickname (rules/N4, +#: #1164). Kept on the published token, as "vocab:maiden-marker" is: a +#: marker the rule takes leaves no token, and one read as a word keeps +#: its tag. +ALIAS_MARKER_TAG = "vocab:alias-marker" + #: On each word of a particle chain opening a family-first name past #: the reach of rules/P1's fold (#828), written by post_rules whether or #: not the fold cuts the chain there, so assemble can tell where a diff --git a/nameparser/_pipeline/_vocab.py b/nameparser/_pipeline/_vocab.py index 336b7e772..e4c8255c5 100644 --- a/nameparser/_pipeline/_vocab.py +++ b/nameparser/_pipeline/_vocab.py @@ -2987,8 +2987,10 @@ def comma_follows_marker(word: str) -> bool: delimited clause, opens with a comma -- standing alone (' , ') or glued to the name after it (' ,Jones'). A comma glued to the marker itself ('née,') needs no test: that word is no marker to begin with, - the vocabulary storing no comma. The one predicate for extract's M3 - test over whitespace words and group's M1 drop over tokens, which + the vocabulary storing no comma (and an alias marker's, which classify + keeps on the word for that reason, rules/N4). The one predicate for + extract's M3 and N4 tests over whitespace words and group's M1 and + N4 drops over tokens, which since #653 hold the same comma (mechanisms.md#ONE-PREDICATE-PER-QUESTION). diff --git a/nameparser/_reading_index.py b/nameparser/_reading_index.py index 095fb023e..eb224042c 100644 --- a/nameparser/_reading_index.py +++ b/nameparser/_reading_index.py @@ -40,7 +40,7 @@ #: name is also a kind (`title = {}`: a title not yet classified), so #: classifying a word later moves no set. bound_given's one kind shares #: its category's name, and so does bound_second's, the word a bound -#: pair writes second and joins from (rules/P12, #1072); the relation (birth_marker) and name (given, +#: pair writes second and joins from (rules/P12, #1072); the relation (birth_marker, alias_marker) and name (given, #: family) categories have no generic kind. Kind #: names are unique across categories; a fine kind arrives with its #: category's classification, in a core PR, as one row here. The @@ -88,6 +88,7 @@ "bound_given": "bound_given", "bound_second": "bound_second", "birth_marker": "relation", + "alias_marker": "relation", "given": "name", "family": "name", "familiar": "familiar", @@ -647,6 +648,7 @@ class Compiled(TypedDict): BOUND_GIVEN_NAMES: frozenset[str] GIVEN_NAME_ABBREVIATIONS: frozenset[str] MAIDEN_MARKERS: frozenset[str] + ALIAS_MARKERS: frozenset[str] SUFFIX_WORDS: frozenset[str] GLUED_HONORIFICS: frozenset[str] SUFFIX_WORDS_AMBIGUOUS: frozenset[str] @@ -709,6 +711,7 @@ def compile_readings(readings: Iterable[ReadingProperties]) -> Compiled: initial_conjunctions: set[str] = set() bound: set[str] = set() markers: set[str] = set() + alias_markers: set[str] = set() words: set[str] = set() glued: set[str] = set() ambiguous_words: set[str] = set() @@ -828,7 +831,9 @@ def compile_readings(readings: Iterable[ReadingProperties]) -> Compiled: else: open_seconds.add(t) elif category == "relation": - markers.add(t) + # a birth marker routes what follows it to the maiden name + # (rules/M2), an alias marker to the nickname (rules/N4) + (markers if r.kind == "birth_marker" else alias_markers).add(t) contested = titles & given - particles out = Compiled( GIVEN_NAME_TITLES=frozenset(given_titles), @@ -866,6 +871,7 @@ def compile_readings(readings: Iterable[ReadingProperties]) -> Compiled: # rules/H2's shape (#789) GIVEN_NAME_ABBREVIATIONS=frozenset(short_names.get("given", ())), MAIDEN_MARKERS=frozenset(markers), + ALIAS_MARKERS=frozenset(alias_markers), SUFFIX_WORDS=frozenset(words), GLUED_HONORIFICS=frozenset(glued), SUFFIX_WORDS_AMBIGUOUS=frozenset(ambiguous_words), diff --git a/nameparser/config/_compiled.py b/nameparser/config/_compiled.py index b9092a9a9..ab863fa44 100644 --- a/nameparser/config/_compiled.py +++ b/nameparser/config/_compiled.py @@ -2632,6 +2632,11 @@ '旧姓', }) +ALIAS_MARKERS: frozenset[str] = frozenset({ + '@', + 'urf', +}) + SUFFIX_WORDS: frozenset[str] = frozenset({ '2', 'dl', diff --git a/nameparser/config/_index.py b/nameparser/config/_index.py index 8ea52245d..b21cf6f01 100644 --- a/nameparser/config/_index.py +++ b/nameparser/config/_index.py @@ -35,6 +35,7 @@ ('8-vsb', (('en', 'credential', ()),)), ('8th', (('en', 'modifier', ()),)), ('9th', (('en', 'modifier', ()),)), + ('@', (('mul', 'alias_marker', ()),)), ('a/l', (('ms', 'patronymic', ()),)), ('a/p', (('ms', 'patronymic', ()),)), ('a1c', (('en', 'military', ()),)), @@ -108,6 +109,7 @@ ('air', (('en', 'modifier', ()),)), ('ait', (('ber', 'clan', (('cased', 'Ait'),)),)), ('ajay', (('mul', 'familiar', (('short_for', ('ajaykumar',)),)),)), + ('aka', (('en', 'alias_marker', (('default', False),)),)), ('akhoond', (('fa', 'religious', ()),)), ('akin', (('mul', 'familiar', (('short_for', ('akinwumi',)),)),)), ('al', (('ar', 'article', ()), ('ar', 'given', ()), ('en', 'familiar', (('short_for', ('alan', 'alastair', 'albert', 'alexander', 'alfred')),)))), @@ -131,6 +133,7 @@ ('alhaj', (('ar', 'style', ()),)), ('alhajj', (('ar', 'style', (('same_as', 'alhaj'),)),)), ('ali', (('en', 'familiar', (('short_for', ('alexandra', 'aliakbar', 'alireza', 'alison', 'allison', 'seyedali')),)), ('fa', 'familiar', (('short_for', ('alireza',)),)), ('mul', 'familiar', (('short_for', ('abdolali', 'mohammadali')),)))), + ('alias', (('en', 'alias_marker', (('default', False),)),)), ('alkis', (('el', 'familiar', (('short_for', ('alkiviadis',)),)),)), ('alli', (('en', 'familiar', (('short_for', ('allison',)),)),)), ('allie', (('en', 'familiar', (('short_for', ('alexandra', 'alexandria', 'allison')),)),)), @@ -2772,6 +2775,7 @@ ('ungfrú', (('is', 'salutation', (('after_given', True),)),)), ('united', (('en', 'modifier', ()),)), ('univ.prof', (('de', 'academic', ()),)), + ('urf', (('hi', 'alias_marker', ()),)), ('urologist', (('en', 'occupation', ()),)), ('us', (('en', 'modifier', (('dotted', True),)),)), ('usa', (('en', 'credential', ()),)), diff --git a/nameparser/vocab/README.md b/nameparser/vocab/README.md index 11be0254e..321f5adc6 100644 --- a/nameparser/vocab/README.md +++ b/nameparser/vocab/README.md @@ -131,6 +131,7 @@ A reading's key is its **kind**. The table lists the kinds in their canonical or | `bound_given` | `bound_given` | `BOUND_GIVEN_NAMES` | | `bound_second` | `bound_second` | `BOUND_SECONDS` | | `birth_marker` | `relation` | `MAIDEN_MARKERS` | +| `alias_marker` | `relation` | `ALIAS_MARKERS` | | `given` | `name` | nothing | | `family` | `name` | nothing | | `familiar` | `familiar` | `FAMILIAR` | diff --git a/nameparser/vocab/en.toml b/nameparser/vocab/en.toml index 970391b0f..f702c9c0c 100644 --- a/nameparser/vocab/en.toml +++ b/nameparser/vocab/en.toml @@ -5999,6 +5999,14 @@ birth_marker = { gender = "f" } text = "nee" birth_marker = { issue = 274, same_as = "née", gender = "f", note = "née typed without its accent" } +[[word]] +text = "aka" +alias_marker = { default = false, issue = 1164, expands = "also known as", note = "off by default: Aka is a given name and a surname (Ivorian, Turkish, Nepali), 90 name uses against 38 markers across the local corpora (2026-11-20); FEC writes the marker in 24 of 1,893,964 names (BOSCIA, FRANK AKA FRANCIS). A caller whose data uses it turns it on with Lexicon.add('aka', kind='alias_marker')" } + +[[word]] +text = "alias" +alias_marker = { default = false, issue = 1164, note = "off by default: Alias is a Malay given name and father's name, a Kerala name and a US surname, 97 name uses against 43 markers across the local corpora, the markers mostly Indian (2026-11-20). A caller whose data uses it turns it on with Lexicon.add('alias', kind='alias_marker')" } + [[word]] text = "ben" familiar = { short_for = ["benedict", "benjamin"], note = "found in CC0 or public-domain data and reviewed, tools/vocab/familiar_reviewed.tsv" } diff --git a/nameparser/vocab/hi.toml b/nameparser/vocab/hi.toml index 0408c10b0..397dffa76 100644 --- a/nameparser/vocab/hi.toml +++ b/nameparser/vocab/hi.toml @@ -240,3 +240,7 @@ issue = [346, 344, 343] note = "Maharaj, trailing; the leading महाराजा is a title (#344)" [word.courtesy.excluded] attached = "जी ends बनर्जी, मुखर्जी, चटर्जी, so a glued peel would strand a bare virama (बनर् + जी); the 殿 criterion in a non-CJK script (decisions/indic-honorifics)" + +[[word]] +text = "urf" +alias_marker = { issue = 1164, expands = "alias", note = "the romanized उर्फ़ (Ravi Kumar urf Raju); a marker in all 3 uses across the local corpora, all in PSC, and in none a name; 21 names on the 2024 Lok Sabha candidates' list write it (2026-11-20)" } diff --git a/nameparser/vocab/mul.toml b/nameparser/vocab/mul.toml index 23375f7ee..092b436ca 100644 --- a/nameparser/vocab/mul.toml +++ b/nameparser/vocab/mul.toml @@ -143,6 +143,10 @@ credential = { expands = "Doctor of Philosophy", cased = "PhD", note = "written text = "&" conjunction = {} +[[word]] +text = "@" +alias_marker = { issue = 1164, note = "the at sign written as a word of its own between two names, the second a name the person is also known by (RAHIM @ JAKI BIN OSMAN): an alias marker in all 109 spaced uses across the local corpora, a name in none (master e0f698c8, 2026-11-20); Malaysian ballots and honours lists write it most. Glued to a word (Saad@Yahaya, an e-mail address, a handle) it is part of that word and no marker" } + [[word]] text = "mhd" given = { same_as = "muhammad", note = "Muhammad written short, in Indonesia, Syria, Turkey and Germany: ORCID given boxes 426 (Indonesia 86, Syria 37), family boxes 71 (2026-11-06); written with its period at the head of a name (Dr Mhd. Azhar Kharsa), it read as a title by the leading-abbreviation shape (#1115)" } diff --git a/tests/v2/cases.py b/tests/v2/cases.py index f05e80a07..66bb5ed03 100644 --- a/tests/v2/cases.py +++ b/tests/v2/cases.py @@ -22754,4 +22754,180 @@ def _check_cjk_shape_purity(self) -> None: "family": unicodedata.normalize("NFD", "López")}, classification="fix(#1149)", notes="the title-side NFD twin"), + # rules/N4, the alias marker (#1164): a second name written after a + # marker word is the nickname, the marker dropped + Case("alias_marker_inside_the_given_part_stops_at_bin", + "Rahim @ Jaki bin Osman", + {"given": "Rahim", "nickname": "Jaki", "family": "bin Osman"}, + classification="fix(#1164)", + notes="1.4.0 through 3.1 read middle '@ Jaki'"), + Case("alias_marker_after_the_fathers_name_runs_to_the_end", + "RAHIM BIN OSMAN @ USMAN", + {"given": "RAHIM", "nickname": "USMAN", "family": "BIN OSMAN"}, + classification="fix(#1164)"), + Case("alias_marker_urf_reads_the_alias", + "Ravi Kumar urf Raju", + {"given": "Ravi", "nickname": "Raju", "family": "Kumar"}, + classification="fix(#1164)"), + Case("alias_marker_takes_every_word_with_no_boundary", + "Tan Wei Keong @ Daniel Tan", + {"given": "Tan", "middle": "Wei", "family": "Keong", + "nickname": "Daniel Tan"}, + classification="fix(#1164)", + notes="the fork: a whole second name; a one-word alias before " + "the family loses the family (N4's Accepted)"), + Case("alias_marker_in_the_given_part_after_a_family_comma", + "Osman, Rahim @ Jaki", + {"given": "Rahim", "nickname": "Jaki", "family": "Osman"}, + classification="fix(#1164)"), + Case("alias_marker_before_a_family_comma", + "Wang @ Chan, Chris", + {"given": "Chris", "nickname": "Chan", "family": "Wang"}, + classification="fix(#1164)"), + Case("alias_marker_leaves_the_trailing_suffix_run", + "Rahim Osman @ Jaki PhD", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki", + "suffix": "PhD"}, + classification="fix(#1164)"), + Case("alias_marker_and_maiden_marker_read_apart", + "Jane Smith @ Janey née Jones", + {"given": "Jane", "family": "Smith", "nickname": "Janey", + "maiden": "Jones"}, + classification="fix(#1164)"), + Case("alias_marker_leading_a_bracketed_clause_is_dropped", + "Ravi Kumar (urf Raju)", + {"given": "Ravi", "family": "Kumar", "nickname": "Raju"}, + classification="fix(#1164)", + notes="1.4.0 through 3.1 read nickname 'urf Raju'"), + Case("alias_marker_glued_to_a_word_is_part_of_it", + "Rahim Osman@Usman", + {"given": "Rahim", "family": "Osman@Usman"}, + notes="boundary: an @ glued to a word, as in an e-mail address"), + Case("alias_marker_with_nothing_before_it_is_a_word", + "Osman, @ Jaki", + {"given": "@", "middle": "Jaki", "family": "Osman"}, + notes="boundary: no name word before the marker"), + Case("alias_marker_aka_is_off_by_default", + "BOSCIA, FRANK AKA FRANCIS", + {"given": "FRANK", "middle": "AKA FRANCIS", "family": "BOSCIA"}, + notes="boundary: aka is a given name and a surname too, so it " + "ships turned off (#1164)"), + Case("alias_marker_second_alias_before_a_trailing_suffix", + "Mohd @ Ali bin Abu @ Bakar PhD", + {"given": "Mohd", "family": "bin Abu", "suffix": "PhD", + "nickname": "Ali Bakar"}, + classification="fix(#1164)", + notes="the second alias's trailing run is read over a view " + "without the first alias's words"), + Case("alias_marker_second_alias_ended_by_a_marker", + "Osman, Rahim @ Jaki @ Joe", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki Joe"}, + classification="fix(#1164)"), + Case("alias_marker_before_a_patronymic_announces_nothing", + "Rahim Osman @ bin Ali", + {"given": "Rahim", "middle": "Osman @", "family": "bin Ali"}, + notes="boundary: a boundary straight after the marker"), + Case("alias_marker_behind_a_marker_left_a_word", + "Rahim Osman @ @ Jaki", + {"given": "Rahim", "middle": "Osman @ @", "family": "Jaki"}, + notes="boundary: a marker left a word is no name word"), + Case("alias_marker_reports_a_numeral_after_the_nickname", + "Rahim Osman @ Jaki V", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki", + "suffix": "V"}, + ambiguities=("suffix-or-name",), + classification="fix(#1164)"), + Case("alias_marker_counts_the_words_to_spare_without_earlier_aliases", + "Ali @ X @ Y Z V", + {"given": "Ali", "nickname": "X Y Z V"}, + ambiguities=("suffix-or-name", "given-or-family"), + classification="fix(#1164)", + notes="the first alias's words are no words to spare for V"), + Case("alias_marker_alone_in_a_maiden_clause_keeps_the_clause", + "Ravi Kumar (urf)", + {"given": "Ravi", "family": "Kumar", "maiden": "urf"}, + policy=Policy(maiden_delimiters=frozenset({("(", ")")})), + notes="boundary: no word after the marker"), + Case("alias_marker_before_a_comma_in_a_maiden_clause_is_no_marker", + "Ravi Kumar (urf ,Raju)", + {"given": "Ravi", "family": "Kumar", "maiden": "urf ,Raju"}, + policy=Policy(maiden_delimiters=frozenset({("(", ")")})), + notes="boundary: rules/M3's comma after the marker"), + Case("alias_marker_leading_a_quoted_clause_is_dropped", + 'Ravi "urf Raju" Kumar', + {"given": "Ravi", "family": "Kumar", "nickname": "Raju"}, + classification="fix(#1164)"), + Case("alias_marker_fullwidth_at_sign_is_no_marker", + "Rahim Osman \uff20 Jaki", + {"given": "Rahim", "middle": "Osman \uff20", "family": "Jaki"}, + notes="boundary: only the ASCII at sign is listed"), + Case("alias_marker_given_part_hands_back_a_title", + "Smith, John @ Jack Prof.", + {"title": "Prof.", "given": "John", "family": "Smith", + "nickname": "Jack"}, + classification="fix(#1164)"), + Case("alias_marker_given_part_keeps_a_numeral", + "Osman, Rahim @ Jaki V", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki V"}, + classification="fix(#1164)", + notes="N4's Accepted: shaped like an initial, which the alias " + "takes"), + Case("alias_marker_given_part_hands_back_a_credential_run", + "Osman, Rahim @ Jaki PhD Ali", + {"given": "Rahim", "family": "Osman", "suffix": "PhD Ali", + "nickname": "Jaki"}, + ambiguities=("suffix-or-name",), + classification="fix(#1164)", + notes="the narrower first form's suffix stop, kept"), + Case("alias_marker_given_part_keeps_a_particle_word", + "Osman, Rahim @ Jaki Van", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki Van"}, + classification="fix(#1164)"), + Case("alias_marker_counts_without_a_maiden_clause_before_it", + "Jane née Jones @ JJ V", + {"family": "Jane", "nickname": "JJ V", "maiden": "Jones"}, + ambiguities=("suffix-or-name",), + classification="fix(#1164)"), + Case("alias_marker_counts_a_refused_maiden_marker_as_a_word", + "Dr née Jones @ JJ V", + {"title": "Dr", "given": "née", "family": "Jones", "suffix": "V", + "nickname": "JJ"}, + ambiguities=("suffix-or-name",), + classification="fix(#1164)"), + Case("alias_marker_behind_a_maiden_marker_left_a_word", + "Jane Smith née @ JJ", + {"given": "Jane", "family": "Smith", "maiden": "@ JJ"}, + notes="boundary: master's reading kept"), + Case("alias_marker_ended_by_a_maiden_marker_leaves_the_trailing_run", + "Rahim Osman @ Jaki Prof. née Smith", + {"title": "Prof.", "given": "Rahim", "family": "Osman", + "nickname": "Jaki", "maiden": "Smith"}, + classification="fix(#1164)", + notes="read as 'Rahim Osman @ Jaki Prof.' is, the maiden clause " + "aside (test_parser's maiden-clause invariant)"), + Case("alias_marker_before_a_refused_maiden_marker_keeps_the_suffix_run", + "Rahim Osman @ Jaki Jr. née Smith", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki", + "suffix": "Jr. née Smith"}, + ambiguities=("suffix-or-name", "suffix-or-name"), + classification="fix(#1164)", + notes="M2 refuses a marker behind a suffix word, as in " + "'Rahim Osman Jr. née Smith'"), + Case("alias_marker_before_a_maiden_marker_with_nothing_after_it", + "Jane Smith @ JJ Jr. née", + {"given": "Jane", "family": "Smith", "nickname": "JJ", + "suffix": "Jr. née"}, + ambiguities=("suffix-or-name",), + classification="fix(#1164)"), + Case("alias_marker_given_part_keeps_a_title_inside_it", + "Osman, Rahim @ Jaki Dr Ali", + {"given": "Rahim", "family": "Osman", "nickname": "Jaki Dr Ali"}, + classification="fix(#1164)", + notes="a title inside the given part is its walk's name word"), + Case("alias_marker_given_part_hands_back_a_trailing_title_run", + "Smith, John @ Jack Prof. Dr.", + {"title": "Prof. Dr.", "given": "John", "family": "Smith", + "nickname": "Jack"}, + classification="fix(#1164)", + notes="a title followed by another opens the trailing run"), ) diff --git a/tests/v2/rules_doc.py b/tests/v2/rules_doc.py index 0f7da835e..acf3838b9 100644 --- a/tests/v2/rules_doc.py +++ b/tests/v2/rules_doc.py @@ -230,6 +230,11 @@ def has_boundary_or_waiver(self) -> bool: #: a rule names the data as it names the switch. _ES_GIVEN = Lexicon.default() | Lexicon(given_names=GIVEN_NAMES) CONFIGS: dict[str, tuple[Policy, Lexicon]] = { + #: rules/N4's opt-in markers (#1164), shipped off by default: the + #: default policy with a lexicon that turns both on, the call + #: docs/customize.rst teaches. + "aka+alias": (Policy(), Lexicon.default().add( + "aka", "alias", kind="alias_marker")), "two_family_names+es_given_names": ( POLICIES["two_family_names"], _ES_GIVEN), "family-first+two_family_names+es_given_names": ( diff --git a/tests/v2/test_benchmark.py b/tests/v2/test_benchmark.py index 770a4490e..60be8ad36 100644 --- a/tests/v2/test_benchmark.py +++ b/tests/v2/test_benchmark.py @@ -369,6 +369,11 @@ def test_a_thousand_names_still_parse_in_reasonable_time( "hyphen_chain": "MD-", # vocab: the same cut, hyphens only "member_chain": "MA/PhD/", # vocab: the cut's member arm (#1138) "bracket_joined_members": "(MA/PhD) ", # post_rules: joined members + # group: N4's alias takes, one pass and one rebuild per part, each + # marker's alias ended by the next marker (#1164); asking the + # leading title run of a slice per marker measured 7.1x at base 800 + # (2026-11-20), the first build's quadratic + "alias_markers": "a @ ", } _BASE = 800 diff --git a/tests/v2/test_cases.py b/tests/v2/test_cases.py index 3f2b506ec..1e678bb39 100644 --- a/tests/v2/test_cases.py +++ b/tests/v2/test_cases.py @@ -512,9 +512,13 @@ def test_the_field_sweep_sees_the_claims_it_checks() -> None: # orders; 2211 -> 2214 on 2026-11-20, #1149's 'Dr/' (rules/T9's # boundary, no name after the slash) reporting given-or-family under # three orders; 2214 -> 2217 the same day, its review's 'Dr/ Dean - # Smith' reporting title-or-name under three orders. - assert claims == 2217, ( - f"the field sweep checks {claims} claims, recorded as 2217 on " + # Smith' reporting title-or-name under three orders; 2217 -> 2238 + # the same day, #1164's alias rows ('Rahim Osman @ Jaki V', 'Ali @ X + # @ Y Z V', 'Osman, Rahim @ Jaki PhD Ali', 'Jane née Jones @ JJ V', + # 'Dr née Jones @ JJ V', 'Rahim Osman @ Jaki Jr. née Smith', 'Jane + # Smith @ JJ Jr. née') under three orders. + assert claims == 2238, ( + f"the field sweep checks {claims} claims, recorded as 2238 on " f"2026-11-20") @@ -999,8 +1003,13 @@ def test_the_alternative_sweep_sees_the_fields_it_checks() -> None: # 'Nur Aina bt Rosli' under the three orders, its suffix-or-name # reports all skipped # 605 -> 608 the same day, from #1464's two suffix-or-name rows - # ('Ali Abdul Rahim VI', 'Ram Abdul Bahadur B.K.') - assert (checked, skipped) == (608, 497), (checked, skipped) + # ('Ali Abdul Rahim VI', 'Ram Abdul Bahadur B.K.'); 608 -> 611 on + # 2026-11-20, from #1164's alias rows' three reports ('Rahim Osman @ + # Jaki V', 'Ali @ X @ Y Z V'); 611 -> 614 and 497 -> 500 the same + # day, from its fix review's three suffix-or-name rows; 500 -> 509 + # the same day, its second fix review's two rows, their reports all + # skipped + assert (checked, skipped) == (614, 509), (checked, skipped) def test_every_case_name_is_unique() -> None: diff --git a/tests/v2/test_lexicon.py b/tests/v2/test_lexicon.py index f84f86732..970c2a347 100644 --- a/tests/v2/test_lexicon.py +++ b/tests/v2/test_lexicon.py @@ -1962,7 +1962,7 @@ def test_migrate_s_table_covers_every_compiled_constant() -> None: "GLUED_TITLES", "BOUND_PHRASES", "BOUND_COMPLETES_ANY", "BOUND_LONG_NAMES_ONLY", "BOUND_SECONDS", "BOUND_SECOND_PHRASES", "BOUND_SECONDS_LISTED", - "SAME_AS", "SAME_AS_NAMED", "FAMILIAR", + "ALIAS_MARKERS", "SAME_AS", "SAME_AS_NAMED", "FAMILIAR", "ALTERNATE_SPELLINGS"} assert public_in_2x <= named assert len(_migrate_constant_rows()) >= 20 # the rows with code diff --git a/tools/differential/corpus_rules.jsonl b/tools/differential/corpus_rules.jsonl index e7c9d6377..6d5f73980 100644 --- a/tools/differential/corpus_rules.jsonl +++ b/tools/differential/corpus_rules.jsonl @@ -218,6 +218,7 @@ "Bin Zhang, MH, PhD" "Bob 'T Bone' Smith" "Bob 'T-Bone Jones' Smith" +"Boscia, Frank aka Francis" "Brig Gen Mark Kimmitt" "Buddha Bahadur Tamang" "CAMPBELL, MAJESTY BARRETT" @@ -283,6 +284,7 @@ "Doe Jane Mrs" "Doe nee Smith Jr. Prof., Jane" "Doe nee Smith, Jane" +"Doe, Jane @ Janey Mrs" "Doe, Jane Dr" "Doe, Jane Fru" "Doe, Jane Miss" @@ -326,6 +328,7 @@ "Dr Jr" "Dr Pope Jr" "Dr Smith V" +"Dr née Jones @ JJ V" "Dr." "Dr. (MA)" "Dr. A.Smith" @@ -705,6 +708,7 @@ "Jane Smith (née PhD)" "Jane Smith (née V)" "Jane Smith (née)" +"Jane Smith @ Janey née Jones" "Jane Smith APRN-FNP-C" "Jane Smith CCC-SLP/L" "Jane Smith CCC/SLP/L" @@ -721,7 +725,9 @@ "Jane Smith PhD/NP-C" "Jane Smith SLP-M.A" "Jane Smith Vice." +"Jane Smith née @ JJ" "Jane Smith née Jones" +"Jane Smith née Jones @ JJ" "Jane Smith née Jones PhD" "Jane Smith née Jones, PhD" "Jane Smith née PhD" @@ -733,6 +739,7 @@ "Jane and née Jones" "Jane de la née Jones" "Jane nee Smith Jr., AD" +"Jane née Jones @ JJ V" "Jane née Jones Smith" "Jane née Jr y Jones" "Jane van der Berg nee Prof. Pope. MA" @@ -1370,6 +1377,7 @@ "Mgr.A. Marek Rejent" "Mohamad, Mahathir bin" "Mohamed Ali Abd Allah" +"Mohd @ Ali bin Abu @ Bakar" "Morse, Det. Insp. Jane" "Moshe bar Yosef" "Mother Superior of the Convent Mary Smith" @@ -1429,6 +1437,15 @@ "Ortega y Gasset, Ed" "Ortega y Gasset, José" "Ortega y Gasset, MJ, PhD" +"Osman (Jaki)" +"Osman @ Jaki" +"Osman, @ Jaki" +"Osman, Rahim @ Jaki" +"Osman, Rahim @ Jaki Dr Ali" +"Osman, Rahim @ Jaki PhD Ali" +"Osman, Rahim @ Jaki St." +"Osman, Rahim @ Jaki V" +"Osman, Rahim Jaki V" "P.D. Dr. Hans Meier" "P.D. Judge Smith" "PEDRO DA SILVA FILHO" @@ -1515,6 +1532,23 @@ "ROB ROY MACGREGOR" "ROBERT (RA) ALLEN" "RONALD MACDONALD" +"Rahim @ Jaki Osman" +"Rahim @ Jaki PhD bin Osman" +"Rahim @ Jaki a/l Osman" +"Rahim @ Jaki bin Osman" +"Rahim @Usman" +"Rahim Osman @" +"Rahim Osman @ Jaki" +"Rahim Osman @ Jaki Jr. née Smith" +"Rahim Osman @ Jaki PhD" +"Rahim Osman @ Jaki Prof." +"Rahim Osman @ Jaki Prof. née Smith" +"Rahim Osman @ Jaki, PhD" +"Rahim Osman @ Jr" +"Rahim Osman @ Tok Ben" +"Rahim Osman@Usman" +"Rahim bin Osman @ Usman" +"Rahim de la @ Jaki Vega" "Rahman Khan, Md Abdul" "Rahman, Abdul MB ChB" "Rahman, Ahmad bin Abd Ali" @@ -1538,6 +1572,12 @@ "Ram KC" "Ram R S" "Rashid, Harun al-" +"Ravi (urf Raju) Kumar" +"Ravi Kumar (urf Jr)" +"Ravi Kumar (urf Raju)" +"Ravi Kumar (urf, Raju)" +"Ravi Kumar alias Raju" +"Ravi Kumar urf Raju" "Ravi PC" "Rev. John Smith" "Rev. Sr. Smith, Mary" @@ -1591,6 +1631,7 @@ "Silva, Junior Carlos" "Silva, M.Filho" "Silva, Neto" +"Sir @ Jaki Osman" "Sir Abu Bakar" "Sir John" "Sir John Prof." @@ -1615,6 +1656,7 @@ "Smith (MA), John" "Smith (MD), John" "Smith (née Jones)" +"Smith @ Jack Jr." "Smith E.T." "Smith John Jr. Jones" "Smith Jones Jr., J.A." @@ -1669,6 +1711,7 @@ "Smith, John (MA)" "Smith, John (V)" "Smith, John - Paul" +"Smith, John @ Jack Jr." "Smith, John Dipl.Ing." "Smith, John Jr. Jones" "Smith, John Junior" @@ -1703,6 +1746,7 @@ "Smith, John v" "Smith, John van der Berg Prof." "Smith, John, Jr." +"Smith, John, Jr. @ Jack" "Smith, John, Jr., MD, Esq." "Smith, John, MD - PhD" "Smith, John, MD - née Jones Smith" @@ -1777,6 +1821,7 @@ "TER HORST, JAN VAN" "TER PETROSYAN, LEVON" "THE ROCK Mary" +"Tan Wei Keong @ Daniel Tan" "Tariq Abdel Aziz" "Tariq Abdul Aziz" "Tariq Abdul Aziz Jr." @@ -1832,6 +1877,7 @@ "W. Russell Jr. Withers" "WILLEM 'S-GRAVESANDE" "WILLEM SMIT-'S-GRAVESANDE" +"Wang @ Chan, Chris" "Wang M.Eng." "Wang Ma PhD" "Wang Xiaoming, Jr." diff --git a/tools/differential/snapshot.jsonl b/tools/differential/snapshot.jsonl index 3ba3c5ea5..d155f6298 100644 --- a/tools/differential/snapshot.jsonl +++ b/tools/differential/snapshot.jsonl @@ -558,6 +558,7 @@ {"name": "Bonneville, Benjamin Louis Eulalie de", "given": "Benjamin", "middle": "Louis Eulalie", "family": "de Bonneville", "initials": "B. L. E. B."} {"name": "Bonvi", "given": "Bonvi", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "B."} {"name": "Borcke, Karl August Ferdinand von", "given": "Karl", "middle": "August Ferdinand", "family": "von Borcke", "ambiguities": ["PARTICLE_OR_GIVEN"], "alternatives": ["PARTICLE_OR_GIVEN: name as middle (declared)"], "initials": "K. A. F. B."} +{"name": "Boscia, Frank aka Francis", "given": "Frank", "middle": "aka Francis", "family": "Boscia", "initials": "F. a. F. B.", "capitalized_force": "Frank Aka Francis Boscia"} {"name": "Bouchart, Jean-Nicolas Louis Marcel de", "given": "Jean-Nicolas", "middle": "Louis Marcel", "family": "de Bouchart", "initials": "J. L. M. B."} {"name": "Bourne, Samuel", "given": "Samuel", "family": "Bourne", "initials": "S. B."} {"name": "Brais Manoel Souto", "given": "Brais", "middle": "Manoel", "family": "Souto", "initials": "B. M. S."} @@ -843,6 +844,7 @@ {"name": "Doe, J. MA", "given": "J.", "family": "Doe", "suffix": "MA", "initials": "J. D."} {"name": "Doe, J. ba", "given": "J.", "family": "Doe", "suffix": "ba", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as middle (declared)"], "initials": "J. D.", "capitalized_force": "J. Doe BA"} {"name": "Doe, J. nee MA ba", "given": "J.", "middle": "nee", "family": "Doe", "suffix": "MA ba", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as middle (declared)"], "initials": "J. n. D.", "capitalized_force": "J. Nee Doe MA BA"} +{"name": "Doe, Jane @ Janey Mrs", "title": "Mrs", "given": "Jane", "family": "Doe", "nickname": "Janey", "initials": "J. D."} {"name": "Doe, Jane Dr", "given": "Jane", "middle": "Dr", "family": "Doe", "initials": "J. D. D."} {"name": "Doe, Jane Fru", "given": "Jane", "middle": "Fru", "family": "Doe", "initials": "J. F. D."} {"name": "Doe, Jane Miss", "title": "Miss", "given": "Jane", "family": "Doe", "initials": "J. D."} @@ -947,6 +949,7 @@ {"name": "Dr Martin Luther King, Jr.", "title": "Dr", "given": "Martin", "middle": "Luther", "family": "King", "suffix": "Jr.", "initials": "M. L. K.", "generation": "Jr."} {"name": "Dr Pope Jr", "title": "Dr", "family": "Pope", "suffix": "Jr", "ambiguities": ["TITLE_OR_NAME"], "alternatives": ["TITLE_OR_NAME: title as title (vocabulary)"], "initials": "P.", "generation": "Jr"} {"name": "Dr Smith V", "title": "Dr", "given": "Smith", "family": "V", "ambiguities": ["ORDER", "SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: generation as suffix (vocabulary)"], "initials": "S. V."} +{"name": "Dr née Jones @ JJ V", "title": "Dr", "given": "née", "family": "Jones", "suffix": "V", "nickname": "JJ", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: initial as nickname (shape)"], "initials": "n. J.", "capitalized_force": "Dr Née \"Jj\" Jones V", "generation": "V"} {"name": "Dr 田中さん, V.", "title": "Dr", "family": "田中", "suffix": "さん, V.", "generation": "V.", "honorifics": "さん"} {"name": "Dr 김민준, Jr.", "title": "Dr", "given": "민준", "family": "김", "suffix": "Jr.", "generation": "Jr."} {"name": "Dr 김민준, MA", "title": "Dr", "given": "민준", "family": "김", "suffix": "MA"} @@ -1912,6 +1915,7 @@ {"name": "Jane Smith (née PhD)", "given": "Jane", "family": "Smith", "maiden": "PhD", "initials": "J. S."} {"name": "Jane Smith (née V)", "given": "Jane", "family": "Smith", "maiden": "V", "initials": "J. S."} {"name": "Jane Smith (née)", "given": "Jane", "family": "Smith", "nickname": "née", "initials": "J. S.", "capitalized_force": "Jane \"Née\" Smith"} +{"name": "Jane Smith @ Janey née Jones", "given": "Jane", "family": "Smith", "nickname": "Janey", "maiden": "Jones", "initials": "J. S."} {"name": "Jane Smith APRN-FNP-C", "given": "Jane", "family": "Smith", "suffix": "APRN-FNP-C", "initials": "J. S."} {"name": "Jane Smith CCC-SLP/L", "given": "Jane", "family": "Smith", "suffix": "CCC-SLP/L", "initials": "J. S."} {"name": "Jane Smith CCC/SLP/L", "given": "Jane", "family": "Smith", "suffix": "CCC/SLP/L", "initials": "J. S."} @@ -1929,7 +1933,9 @@ {"name": "Jane Smith SLP-M.A", "given": "Jane", "family": "Smith", "suffix": "SLP-M.A", "initials": "J. S."} {"name": "Jane Smith Vice.", "title": "Vice.", "given": "Jane", "family": "Smith", "initials": "J. S."} {"name": "Jane Smith born Jones", "given": "Jane", "middle": "Smith born", "family": "Jones", "initials": "J. S. b. J.", "capitalized_force": "Jane Smith Born Jones"} +{"name": "Jane Smith née @ JJ", "given": "Jane", "family": "Smith", "maiden": "@ JJ", "initials": "J. S.", "capitalized_force": "Jane Smith (@ Jj)"} {"name": "Jane Smith née Jones", "given": "Jane", "family": "Smith", "maiden": "Jones", "initials": "J. S."} +{"name": "Jane Smith née Jones @ JJ", "given": "Jane", "family": "Smith", "nickname": "JJ", "maiden": "Jones", "initials": "J. S.", "capitalized_force": "Jane \"Jj\" Smith (Jones)"} {"name": "Jane Smith née Jones PhD", "given": "Jane", "family": "Smith", "suffix": "PhD", "maiden": "Jones", "initials": "J. S."} {"name": "Jane Smith née Jones, PhD", "given": "Jane", "family": "Smith", "suffix": "PhD", "maiden": "Jones", "initials": "J. S."} {"name": "Jane Smith née PhD", "given": "Jane", "middle": "Smith", "family": "née", "suffix": "PhD", "initials": "J. S. n.", "capitalized_force": "Jane Smith Née PhD"} @@ -1941,6 +1947,7 @@ {"name": "Jane and née Jones", "given": "Jane and née", "family": "Jones", "initials": "J. n. J.", "capitalized_force": "Jane and Née Jones"} {"name": "Jane de la née Jones", "given": "Jane", "family": "de la", "maiden": "Jones", "initials": "J. d. l.", "capitalized_force": "Jane De La (Jones)"} {"name": "Jane nee Smith Jr., AD", "given": "AD", "family": "Jane", "suffix": "Jr.", "maiden": "Smith", "initials": "A. J.", "capitalized_force": "Ad Jane (Smith) Jr.", "generation": "Jr."} +{"name": "Jane née Jones @ JJ V", "family": "Jane", "nickname": "JJ V", "maiden": "Jones", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: generation as suffix (vocabulary)"], "initials": "J.", "capitalized_force": "\"Jj V\" Jane (Jones)"} {"name": "Jane née Jones Smith", "family": "Jane", "maiden": "Jones Smith", "initials": "J."} {"name": "Jane née Jr y Jones", "given": "Jane", "middle": "née", "family": "Jr y Jones", "initials": "J. n. J. J.", "capitalized_force": "Jane Née Jr y Jones"} {"name": "Jane née and Jones Smith", "family": "Jane", "maiden": "and Jones Smith", "initials": "J."} @@ -3313,6 +3320,7 @@ {"name": "Mohamed Ali Abd Allah", "given": "Mohamed", "middle": "Ali", "family": "Abd Allah", "initials": "M. A. A. A."} {"name": "Mohamed Khir Johari", "given": "Mohamed", "middle": "Khir", "family": "Johari", "initials": "M. K. J."} {"name": "Mohamed bin Hamzah", "given": "Mohamed", "family": "bin Hamzah", "initials": "M. H.", "patronymic": "bin Hamzah"} +{"name": "Mohd @ Ali bin Abu @ Bakar", "given": "Mohd", "family": "bin Abu", "nickname": "Ali Bakar", "initials": "M. b. A.", "capitalized_force": "Mohd \"Ali Bakar\" Bin Abu"} {"name": "Mohd Najib bin Abdul Razak", "given": "Mohd", "middle": "Najib", "family": "bin Abdul Razak", "initials": "M. N. A. R.", "patronymic": "bin Abdul Razak"} {"name": "Molnar, Thomas", "given": "Thomas", "family": "Molnar", "initials": "T. M."} {"name": "Monsieur Jean Dupont", "title": "Monsieur", "given": "Jean", "family": "Dupont", "initials": "J. D."} @@ -3521,6 +3529,15 @@ {"name": "Orueta y Duarte, Ricardo de", "given": "Ricardo", "family": "de Orueta y Duarte", "initials": "R. O. D."} {"name": "Orval, Pierre d'", "given": "Pierre", "family": "d' Orval", "initials": "P. O."} {"name": "Orville, Johann Friedrich d'", "given": "Johann", "middle": "Friedrich", "family": "d' Orville", "initials": "J. F. O."} +{"name": "Osman (Jaki)", "family": "Osman", "nickname": "Jaki", "initials": "O."} +{"name": "Osman @ Jaki", "given": "Osman", "nickname": "Jaki", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "O."} +{"name": "Osman, @ Jaki", "given": "@", "middle": "Jaki", "family": "Osman", "initials": "@. J. O."} +{"name": "Osman, Rahim @ Jaki", "given": "Rahim", "family": "Osman", "nickname": "Jaki", "initials": "R. O."} +{"name": "Osman, Rahim @ Jaki Dr Ali", "given": "Rahim", "family": "Osman", "nickname": "Jaki Dr Ali", "initials": "R. O."} +{"name": "Osman, Rahim @ Jaki PhD Ali", "given": "Rahim", "family": "Osman", "suffix": "PhD Ali", "nickname": "Jaki", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as middle (position)"], "initials": "R. O."} +{"name": "Osman, Rahim @ Jaki St.", "given": "Rahim", "family": "St. Osman", "nickname": "Jaki", "ambiguities": ["PARTICLE_OR_GIVEN"], "alternatives": ["PARTICLE_OR_GIVEN: title as title (vocabulary)"], "initials": "R. O."} +{"name": "Osman, Rahim @ Jaki V", "given": "Rahim", "family": "Osman", "nickname": "Jaki V", "initials": "R. O."} +{"name": "Osman, Rahim Jaki V", "given": "Rahim", "middle": "Jaki", "family": "Osman", "suffix": "V", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: initial as middle (shape)"], "initials": "R. J. O.", "generation": "V"} {"name": "Ospina Pérez, Mariano", "given": "Mariano", "family": "Ospina Pérez", "initials": "M. O. P."} {"name": "Otto III.", "given": "Otto", "suffix": "III.", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "O.", "generation": "III."} {"name": "Outrein, Johannes d'", "given": "Johannes", "family": "d' Outrein", "initials": "J. O."} @@ -3747,6 +3764,23 @@ {"name": "Rafael Sousa dos Anjos", "given": "Rafael", "middle": "Sousa", "family": "dos Anjos", "initials": "R. S. A."} {"name": "Rafael Viciana Aráez", "given": "Rafael", "middle": "Viciana", "family": "Aráez", "initials": "R. V. A."} {"name": "Ragnar Bjarnason", "given": "Ragnar", "family": "Bjarnason", "initials": "R. B."} +{"name": "Rahim @ Jaki Osman", "given": "Rahim", "nickname": "Jaki Osman", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "R."} +{"name": "Rahim @ Jaki PhD bin Osman", "given": "Rahim", "middle": "PhD", "family": "bin Osman", "nickname": "Jaki", "initials": "R. P. O.", "patronymic": "bin Osman"} +{"name": "Rahim @ Jaki a/l Osman", "given": "Rahim", "family": "a/l Osman", "nickname": "Jaki", "initials": "R. O.", "patronymic": "a/l Osman"} +{"name": "Rahim @ Jaki bin Osman", "given": "Rahim", "family": "bin Osman", "nickname": "Jaki", "initials": "R. O.", "patronymic": "bin Osman"} +{"name": "Rahim @Usman", "given": "Rahim", "family": "@Usman", "initials": "R. @."} +{"name": "Rahim Osman @", "given": "Rahim", "middle": "Osman", "family": "@", "initials": "R. O. @."} +{"name": "Rahim Osman @ Jaki", "given": "Rahim", "family": "Osman", "nickname": "Jaki", "initials": "R. O."} +{"name": "Rahim Osman @ Jaki Jr. née Smith", "given": "Rahim", "family": "Osman", "suffix": "Jr. née Smith", "nickname": "Jaki", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as family (position)", "SUFFIX_OR_NAME: name as family (position)"], "initials": "R. O.", "capitalized_force": "Rahim \"Jaki\" Osman Jr. Née Smith", "generation": "Jr.", "credentials": "née Smith"} +{"name": "Rahim Osman @ Jaki PhD", "given": "Rahim", "family": "Osman", "suffix": "PhD", "nickname": "Jaki", "initials": "R. O."} +{"name": "Rahim Osman @ Jaki Prof.", "title": "Prof.", "given": "Rahim", "family": "Osman", "nickname": "Jaki", "initials": "R. O."} +{"name": "Rahim Osman @ Jaki Prof. née Smith", "title": "Prof.", "given": "Rahim", "family": "Osman", "nickname": "Jaki", "maiden": "Smith", "initials": "R. O."} +{"name": "Rahim Osman @ Jaki, PhD", "given": "Rahim", "family": "Osman", "suffix": "PhD", "nickname": "Jaki", "initials": "R. O."} +{"name": "Rahim Osman @ Jr", "given": "Rahim", "middle": "Osman", "family": "@", "suffix": "Jr", "initials": "R. O. @.", "generation": "Jr"} +{"name": "Rahim Osman @ Tok Ben", "given": "Rahim", "family": "Osman", "nickname": "Tok Ben", "initials": "R. O."} +{"name": "Rahim Osman@Usman", "given": "Rahim", "family": "Osman@Usman", "initials": "R. O."} +{"name": "Rahim bin Osman @ Usman", "given": "Rahim", "family": "bin Osman", "nickname": "Usman", "initials": "R. O.", "patronymic": "bin Osman"} +{"name": "Rahim de la @ Jaki Vega", "given": "Rahim", "family": "de la", "nickname": "Jaki Vega", "initials": "R. d. l.", "capitalized_force": "Rahim \"Jaki Vega\" De La"} {"name": "Rahman Khan, Md Abdul", "given": "Rahman", "family": "Khan", "suffix": "Md Abdul", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as given (position)"], "initials": "R. K.", "capitalized_force": "Rahman Khan, MD Abdul"} {"name": "Rahman, Abdul MB ChB", "given": "Abdul", "family": "Rahman", "suffix": "MB ChB", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: name as given (position)"], "initials": "A. R."} {"name": "Rahman, Ahmad bin Abd Ali", "given": "Ahmad", "middle": "bin Abd Ali", "family": "Rahman", "initials": "A. A. A. R.", "patronymic": "bin Abd Ali"} @@ -3775,6 +3809,12 @@ {"name": "Rascón Navarro Seña y Redondo, Juan Antonio", "given": "Juan", "middle": "Antonio", "family": "Rascón Navarro Seña y Redondo", "initials": "J. A. R. N. S. R."} {"name": "Rashid Maidin", "given": "Rashid", "family": "Maidin", "initials": "R. M."} {"name": "Rashid, Harun al-", "given": "Harun", "family": "al- Rashid", "initials": "H. R."} +{"name": "Ravi (urf Raju) Kumar", "given": "Ravi", "family": "Kumar", "nickname": "Raju", "initials": "R. K."} +{"name": "Ravi Kumar (urf Jr)", "given": "Ravi", "family": "Kumar", "nickname": "Jr", "initials": "R. K."} +{"name": "Ravi Kumar (urf Raju)", "given": "Ravi", "family": "Kumar", "nickname": "Raju", "initials": "R. K."} +{"name": "Ravi Kumar (urf, Raju)", "given": "Ravi", "family": "Kumar", "nickname": "urf, Raju", "initials": "R. K.", "capitalized_force": "Ravi \"Urf, Raju\" Kumar"} +{"name": "Ravi Kumar alias Raju", "given": "Ravi", "middle": "Kumar alias", "family": "Raju", "initials": "R. K. a. R.", "capitalized_force": "Ravi Kumar Alias Raju"} +{"name": "Ravi Kumar urf Raju", "given": "Ravi", "family": "Kumar", "nickname": "Raju", "initials": "R. K."} {"name": "Ravi PC", "given": "Ravi", "family": "PC", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (vocabulary)"], "initials": "R. P."} {"name": "Razija Mujanović", "given": "Razija", "family": "Mujanović", "initials": "R. M."} {"name": "Reem Al-Bahrani, CPA", "given": "Reem", "family": "Al-Bahrani", "suffix": "CPA", "initials": "R. A."} @@ -4019,6 +4059,7 @@ {"name": "Sindbad", "given": "Sindbad", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "S."} {"name": "Sindbad", "order": "FAMILY_FIRST", "given": "Sindbad", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "S."} {"name": "Sinibaldo Gutiérrez Mas", "given": "Sinibaldo", "middle": "Gutiérrez", "family": "Mas", "initials": "S. G. M."} +{"name": "Sir @ Jaki Osman", "title": "Sir", "given": "@", "middle": "Jaki", "family": "Osman", "initials": "@. J. O."} {"name": "Sir Abu Bakar", "title": "Sir", "given": "Abu Bakar", "initials": "A. B."} {"name": "Sir Bob Andrew Dole", "title": "Sir", "given": "Bob", "middle": "Andrew", "family": "Dole", "initials": "B. A. D."} {"name": "Sir Gerald", "title": "Sir", "given": "Gerald", "initials": "G."} @@ -4055,6 +4096,7 @@ {"name": "Smith (MD), John", "given": "John", "family": "Smith", "suffix": "MD", "initials": "J. S."} {"name": "Smith (née Jones)", "family": "Smith", "maiden": "Jones", "initials": "S."} {"name": "Smith , John", "given": "John", "family": "Smith", "initials": "J. S."} +{"name": "Smith @ Jack Jr.", "given": "Smith", "suffix": "Jr.", "nickname": "Jack", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "S.", "generation": "Jr."} {"name": "Smith Cecilia Angela", "order": "FAMILY_FIRST", "given": "Cecilia", "middle": "Angela", "family": "Smith", "initials": "C. A. S."} {"name": "Smith Dr", "given": "Smith", "family": "Dr", "initials": "S. D."} {"name": "Smith E.T.", "given": "Smith", "family": "E.T.", "ambiguities": ["ORDER", "SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: credential as suffix (shape)"], "initials": "S. E. T."} @@ -4131,6 +4173,7 @@ {"name": "Smith, John (V)", "given": "John", "family": "Smith", "suffix": "V", "initials": "J. S.", "generation": "V"} {"name": "Smith, John ,", "given": "John", "family": "Smith", "initials": "J. S."} {"name": "Smith, John - Paul", "given": "John", "middle": "- Paul", "family": "Smith", "initials": "J. -. P. S."} +{"name": "Smith, John @ Jack Jr.", "given": "John", "family": "Smith", "suffix": "Jr.", "nickname": "Jack", "initials": "J. S.", "generation": "Jr."} {"name": "Smith, John Dipl.Ing.", "title": "Dipl.Ing.", "given": "John", "family": "Smith", "initials": "J. S."} {"name": "Smith, John E, III, Jr", "given": "John", "middle": "E", "family": "Smith", "suffix": "III, Jr", "initials": "J. E. S.", "generation": "III, Jr"} {"name": "Smith, John I", "given": "John", "family": "Smith", "suffix": "I", "ambiguities": ["SUFFIX_OR_NAME"], "alternatives": ["SUFFIX_OR_NAME: initial as middle (shape)"], "initials": "J. S.", "generation": "I"} @@ -4171,6 +4214,7 @@ {"name": "Smith, John van der Berg Prof.", "title": "Prof.", "given": "John", "middle": "van der Berg", "family": "Smith", "initials": "J. B. S."} {"name": "Smith, John, Extra, Jr.", "given": "John", "family": "Smith", "suffix": "Extra, Jr.", "ambiguities": ["COMMA_STRUCTURE"], "initials": "J. S.", "generation": "Jr.", "credentials": "Extra"} {"name": "Smith, John, Jr.", "given": "John", "family": "Smith", "suffix": "Jr.", "initials": "J. S.", "generation": "Jr."} +{"name": "Smith, John, Jr. @ Jack", "given": "John", "family": "Smith", "suffix": "Jr. @ Jack", "ambiguities": ["COMMA_STRUCTURE"], "initials": "J. S.", "generation": "Jr.", "credentials": "@ Jack"} {"name": "Smith, John, Jr., MD, Esq.", "given": "John", "family": "Smith", "suffix": "Jr., MD, Esq.", "initials": "J. S.", "generation": "Jr.", "credentials": "MD, Esq."} {"name": "Smith, John, MD - PhD", "given": "John", "family": "Smith", "suffix": "MD, PhD", "initials": "J. S."} {"name": "Smith, John, MD - née Jones Smith", "given": "John", "family": "Smith", "suffix": "MD, née Jones Smith", "ambiguities": ["COMMA_STRUCTURE"], "initials": "J. S.", "capitalized_force": "John Smith MD, Née Jones Smith"} @@ -4337,7 +4381,7 @@ {"name": "Syed Hassan Syed Sadiq", "order": "FAMILY_FIRST", "given": "Hassan", "middle": "Syed Sadiq", "family": "Syed", "initials": "H. S. S. S."} {"name": "Syed Hassan, Syed Sadiq", "given": "Syed", "middle": "Sadiq", "family": "Syed Hassan", "initials": "S. S. S. H."} {"name": "Syed Sadiq Syed Hassan", "given": "Syed", "middle": "Sadiq Syed", "family": "Hassan", "initials": "S. S. S. H."} -{"name": "Syukri @ Shu Qi Mohd Nor", "given": "Syukri", "middle": "@ Shu Qi Mohd", "family": "Nor", "initials": "S. @. S. Q. M. N."} +{"name": "Syukri @ Shu Qi Mohd Nor", "given": "Syukri", "nickname": "Shu Qi Mohd Nor", "ambiguities": ["GIVEN_OR_FAMILY"], "alternatives": ["GIVEN_OR_FAMILY: name as family (position)"], "initials": "S."} {"name": "Szabados Máté Bendegúz", "order": "FAMILY_FIRST", "given": "Máté", "middle": "Bendegúz", "family": "Szabados", "initials": "M. B. S."} {"name": "Szabados, Máté Bendegúz", "given": "Máté", "middle": "Bendegúz", "family": "Szabados", "initials": "M. B. S."} {"name": "Szabó Péter úr", "order": "FAMILY_FIRST", "given": "Péter", "middle": "úr", "family": "Szabó", "initials": "P. ú. S.", "capitalized_force": "Szabó Péter Úr"} @@ -4360,6 +4404,7 @@ {"name": "Takeyama, Michio", "given": "Michio", "family": "Takeyama", "initials": "M. T."} {"name": "Tammik hr Mari-Ann Henri Roobert parlamendiliige", "order": "FAMILY_FIRST", "given": "hr", "middle": "Mari-Ann Henri Roobert parlamendiliige", "family": "Tammik", "initials": "h. M. H. R. p. T.", "capitalized_force": "Tammik Hr Mari-Ann Henri Roobert Parlamendiliige"} {"name": "Tammik, Mari-Ann Henri Roobert, parlamendiliige", "given": "Mari-Ann", "middle": "Henri Roobert", "family": "Tammik", "suffix": "parlamendiliige", "ambiguities": ["COMMA_STRUCTURE"], "initials": "M. H. R. T.", "capitalized_force": "Mari-Ann Henri Roobert Tammik Parlamendiliige"} +{"name": "Tan Wei Keong @ Daniel Tan", "given": "Tan", "middle": "Wei", "family": "Keong", "nickname": "Daniel Tan", "initials": "T. W. K."} {"name": "Tariq Abdel Aziz", "given": "Tariq", "family": "Abdel Aziz", "initials": "T. A. A."} {"name": "Tariq Abdul Aziz", "given": "Tariq", "middle": "Abdul", "family": "Aziz", "initials": "T. A. A."} {"name": "Tariq Abdul Aziz Jr.", "given": "Tariq", "middle": "Abdul", "family": "Aziz", "suffix": "Jr.", "initials": "T. A. A.", "generation": "Jr."} @@ -4555,6 +4600,7 @@ {"name": "Waly Mari shu Halimatu", "order": "FAMILY_FIRST", "given": "Mari", "middle": "shu Halimatu", "family": "Waly", "initials": "M. s. H. W.", "capitalized_force": "Waly Mari Shu Halimatu"} {"name": "Wang \"Tony\" Jr.", "order": "FAMILY_FIRST", "family": "Wang", "suffix": "Jr.", "nickname": "Tony", "initials": "W.", "generation": "Jr."} {"name": "Wang \"Tony\" Xiaoming", "order": "FAMILY_FIRST", "given": "Xiaoming", "family": "Wang", "nickname": "Tony", "initials": "X. W."} +{"name": "Wang @ Chan, Chris", "given": "Chris", "family": "Wang", "nickname": "Chan", "initials": "C. W."} {"name": "Wang Dr Xiaoming", "order": "FAMILY_FIRST", "given": "Dr", "middle": "Xiaoming", "family": "Wang", "initials": "D. X. W."} {"name": "Wang Dr. Xiaoming", "order": "FAMILY_FIRST", "given": "Dr.", "middle": "Xiaoming", "family": "Wang", "initials": "D. X. W."} {"name": "Wang Insp. Xiaoming", "order": "FAMILY_FIRST", "given": "Insp.", "middle": "Xiaoming", "family": "Wang", "initials": "I. X. W."} diff --git a/tools/vocab/build.py b/tools/vocab/build.py index 9646bef4f..cd774c085 100644 --- a/tools/vocab/build.py +++ b/tools/vocab/build.py @@ -1513,6 +1513,7 @@ def _behavior(r: Reading, prop: str) -> object: "BOUND_GIVEN_NAMES", "GIVEN_NAME_ABBREVIATIONS", "MAIDEN_MARKERS", + "ALIAS_MARKERS", "SUFFIX_WORDS", "GLUED_HONORIFICS", "SUFFIX_WORDS_AMBIGUOUS",