Skip to content

Add a conventions corpus: invented names for naming traditions the corpora miss - #691

Merged
derek73 merged 2 commits into
masterfrom
feat/issue-686-conventions-corpus
Oct 17, 2026
Merged

derek73 merged 2 commits into
masterfrom
feat/issue-686-conventions-corpus

Conversation

@derek73

@derek73 derek73 commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #686.

What. tools/differential/conventions.py is a hand-written table of the 35 rows from #686 (body and comment). Each row records the tradition, the convention it exercises, the name, its name_order, and what a reader who knows the convention would expect. build_conventions_corpus.py writes corpus_conventions.jsonl from the table, giving a non-default order its shapes.py id (looked up by order, so a misspelled order fails the build). test_corpora.py pins the file to the table. The README's corpus roster and provenance sections gain the file.

The issue's open questions.

  • One file, or a fields file too? One file, your call: the expectation is a free-text note and nothing scores against it. Many expectations are stated in terms no field states (a father's or grandfather's name, an honorific that is not a title, a married form), some are undecided (H. Budi Santoso), and a fields file must state every part, since cldr_agreement.py reads an unstated one as an empty role. A row whose reading is settled can graduate to tests/v2/cases.py.
  • Runtime? Moot: the snapshot check reads all 4,941 entries in about 2s.

Measured. The snapshot gains 35 names and moves none. All 35 recorded readings match the "Today" column the issue measured on 1a4e8a10; no parser commits land between that and this branch's base. Today's reading is deliberately not copied into the table, since snapshot.jsonl already holds it. The new pin fails when a corpus line is dropped and passes once the corpus is regenerated. Full suite: 19,313 passed; mypy and ruff clean.

Review round (code, comments, tests; 9d3ee1ed). No bugs found. Fixed: the fields-file reasoning cited a patronymic and a missing family name, which the scorer already handles; the order docstring now names the two orders a shape declares; the Kaur note no longer says "every"; the builder loads its siblings by path instead of editing sys.path. Tran Thi Mai stays under FAMILY_FIRST as the issue listed it, and its note now says Mai is a suffix acronym, which reads as a suffix under FAMILY_FIRST_GIVEN_LAST too, so a second row under that order would show nothing new.

🤖 Generated with Claude Code

Our corpora cover Western and CJK names well and have almost none from
traditions with no family name, religious names, positional
patronymics or honorifics written after the name (#686). conventions.py
is a hand-written table of 35 invented names patterned on documented
conventions, each with its tradition, the convention it exercises, and
the reading a reader would expect; build_conventions_corpus.py writes
corpus_conventions.jsonl from it, a non-default order as its shapes.py
id, and test_corpora.py pins the file to the table.

The expectation is a note, not a pin. Derek chose no fields file: many
expectations need fields the model lacks (a patronymic, no family
name), and the agreement scorer reads an unstated part as an empty
role. The snapshot gains 35 names, none moved; all 35 readings match
the ones the issue measured on 1a4e8a1. The snapshot check reads
4,941 entries in about 2s, so the issue's runtime question is moot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added this to the 2.5 milestone Oct 17, 2026
@derek73 derek73 self-assigned this Oct 17, 2026
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.03%. Comparing base (4375b01) to head (9d3ee1e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #691   +/-   ##
=======================================
  Coverage   99.03%   99.03%           
=======================================
  Files          46       46           
  Lines        4541     4541           
=======================================
  Hits         4497     4497           
  Misses         44       44           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Review of #691: the scorer already handles a patronymic (PENDING_ROLES)
and expects an empty family where none is stated, so neither example
showed what a fields file could not say. The ones that do are a
father's or grandfather's name, an honorific that is not a title and a
married form, and some expectations are undecided. The order docstring
now names the two orders a shape declares; Kaur is traditional, not
universal; Tran Thi Mai's note says Mai is a suffix acronym under
either order. The builder loads conventions.py and shapes.py by path,
as snapshot.load_shapes does, instead of putting tools/differential/
on sys.path for the rest of a test run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73
derek73 merged commit c89629b into master Oct 17, 2026
10 checks passed
@derek73
derek73 deleted the feat/issue-686-conventions-corpus branch October 17, 2026 02:35
derek73 added a commit that referenced this pull request Oct 17, 2026
* State the conventions corpus's parts, and score them like CLDR's

Follow-up to #686 (#691). 30 of conventions.py's 35 rows now carry
`fields` in CLDR's vocabulary, drawn from the UK naming-practices guide
and Cultural Atlas research the rows were written from;
build_conventions_corpus.py writes them to conventions_fields.jsonl and
cldr_agreement.py scores them as a fourth source, recorded in
conventions_agreement.json: 5 of 30 agree in every role.

Derek's calls: a word of address written after the name (Bey, ssi,
san) is a new `honorific` field scored inside `suffix`, as nameparser
reads さん; Kaur is given2, Péterné the given name, H. Budi Santoso a
title and one personal name, Ma.'s Cruz a surname2 and Vda. de Mora
part of the surname. Five rows stay unstated, since a stated field
reads an unstated part as an empty role: the kunya, the glued -san,
Szabóné's married form, and arap/ole, patronymic or family name by
family. The fields file is therefore a subset of its corpus, which
test_cldr_agreement now allows for this source alone.

The other sources' records do not move; the corpus file is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Guard the hand-written fields: unknown names raise, fields partition the text

Review of #692:
- A field name no rule reads now raises in expected_roles, for every
  source: a mistyped honorfic was expected in no role and passed as
  agreement. CLDR's locale and given-informal are the only names
  skipped on purpose (KNOWN_FIELDS, IGNORED_FIELDS).
- test_the_fields_partition_their_rendering: every word of a non-CLDR
  rendering is stated by exactly one field, so a left-out part fails.
  GND, Wikidata and conventions already held it.
- Each conventions row carries fields or an unstated reason, and the
  builder refuses neither or both, so a row's fields cannot drop unseen
  behind the subset check.
- _PARSERS gains shape 5, so a FAMILY_FIRST_GIVEN_LAST row no longer
  crashes the scorer.
- Suzuki-san is stated after all: unspaced text matches by substring,
  so surname Suzuki + honorific -san partition it. My earlier reason for
  leaving it out was wrong. 26 of 31 rows now disagree.
- Stale docstrings (two sources named of four), the ur note (a word of
  address, as its fields say), and the record of where today's reading
  lives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Leave wa unstated beside arap and ole

Derek's call: the research groups the three as declining Kenyan
parent-name markers whose last word may now be a family name, and its
wa example names a mother, so wa is no surer a patronymic than the
others. Its row stays in the corpus; 30 rows are stated, 25 disagree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add hand-written example names for naming traditions our corpora barely cover

1 participant