Skip to content

Read a comma with nothing before it as a family comma naming no surname (rules/C15, #892) - #914

Merged
derek73 merged 1 commit into
masterfrom
fix/issue-892-empty-head-rule
Oct 27, 2026
Merged

derek73 merged 1 commit into
masterfrom
fix/issue-892-empty-head-rule

Conversation

@derek73

@derek73 derek73 commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Refs #892 (points 1–3; point 4, removing code written for the empty head alone, stays open in decisions/C15).

What

A name opening with a comma (, John Smith) had no rule. Clauses in H8, O6 and M2, and review findings in decisions/C1, S10, A1 and H5, each decided it locally, and nameparser/AGENTS.md made every comma change sweep the shape. This PR states it once, as rules/C15 (a comma with nothing before it): the comma is a family comma naming no surname, and the part after it reads as the given part after any family comma reads.

No reading moves. The parser already followed the rule; the only code edit is a citation comment in _comma.py. The snapshot diff only adds the new rule examples.

The exception: H1 (a title and one name word)

A title and one name word read that word as the family: , Dr. John → family John, where Smith, Dr. John → given John. The comma names no surname, so it does not decide the field, mirroring H1's existing clause for a comma with nothing but titles after it. A new Then bullet in H1 says so. H8 and O6 now cite C15.

The invariant

test_an_empty_head_reads_as_its_family_comma_twin (tests/v2/test_properties.py) checks that , X reads as Smith, X does, less the surname, comparing fields and ambiguity kinds.

  • Grid: 10 title runs × 32 bodies × 11 trailing words, 3,519 given parts under each of the three orders (about 2 s).
  • H1 rows: checked against a predicted reading, not skipped, and counted (1,075 per order, recorded) so the exception can't grow unseen.
  • Negative control: putting back Rethink the suffix-comma rule (C1): decide the comma's structure once, after the words are tagged #613's early return on an empty head fails 1,098 rows.
  • Case matching: the twin's surname is written in the given part's case. A mixed-case Smith adds a case contrast (rules/S6) that the empty head doesn't have. That is why , MA reads given MA here, as SMITH, MA does, while Smith, MA reads suffix MA. C15's Accepted bullet records this. The "MA fix" first considered for this PR turned out to be an artifact of the comparison, not a parser defect.

nameparser/AGENTS.md's comma sweep now points at the invariant for fields and kinds. It keeps the empty head, with a trailing title, in grids that check report details, which the invariant doesn't compare.

Review

A design-docs review found that the first draft's "the family stays empty" was false where P6 (a particle ending the name) attaches one. , Jane van reads family van, and C15 now has a P6 Precedence bullet for it. The same review found that "as it does with no comma" was false on 493 of the 1,075 H1 rows per order (, Jane Mrs, , Dr. abdul Rahman). The exception is now stated by its result instead. The corpus count was recounted: 10 of 6,005,647 local-corpus names, adding one in tw-donors that opens with a fullwidth comma.

Follow-up noted, not done

, Sir Jones vd reports that vd "joins the family the comma named", but C15 says that comma names none. This is report wording only (decisions/C15's Log).

Checks

The full suite and the serial benchmarks pass, as do ruff and mypy. On the first serial run, three wall-clock scaling ratios landed at 6.0–6.5× against a limit of 6.0. They passed on rerun, and no parser code changed.

🤖 Generated with Claude Code

…me (rules/C15, #892)

A name opening with a comma had no rule: clauses in H8, O6 and M2 and
review findings in five decisions files each decided it locally, and
every comma change had to sweep the shape. rules/C15 states it once:
the part after the comma reads as the given part after a family comma
reads, with no surname supplied. H1 is the one exception -- a title
and one name word read that word as the family (', Dr. John'), the
comma naming no surname to decide the field by.

No reading moves. test_an_empty_head_reads_as_its_family_comma_twin
holds ', X' to 'Smith, X' less the surname over 3,519 given parts per
order, with H1's 1,075 rows per order counted and a recorded negative
control (#613's early return fails 1,098 rows). The twin's surname is
written in the given part's case: a mixed-case 'Smith' brings a case
contrast (S6) the empty head lacks, which is why ', MA' reads given
'MA' as 'SMITH, MA' does. nameparser/AGENTS.md's comma sweep points
at the invariant for fields and kinds, keeping the empty head in
report-detail grids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 2.7 milestone Oct 27, 2026
@derek73 derek73 added docs Documentation fixes and updates tests design labels Oct 27, 2026
@derek73 derek73 self-assigned this Oct 27, 2026
@derek73
derek73 merged commit a3db9d6 into master Oct 27, 2026
12 checks passed
@derek73
derek73 deleted the fix/issue-892-empty-head-rule branch October 27, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design docs Documentation fixes and updates tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant