Skip to content

Keep the titles 2.6.0 listed in v1's Constants().titles (#752) - #904

Merged
derek73 merged 4 commits into
masterfrom
fix/v1-titles-phrase-only-words
Oct 27, 2026
Merged

derek73 merged 4 commits into
masterfrom
fix/v1-titles-phrase-only-words

Conversation

@derek73

@derek73 derek73 commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Phase 2i/2j of #752 moved titles that are also given names (king, mahdi, bard, buddha, siddha, gyani, wing) out of TITLES into the phrase-only TITLES_AMBIGUOUS (rules/H9, the title phrase). v1's default Constants().titles was copied from TITLES, so it lost them: on master Constants().titles.remove('king') raises KeyError and 'king' in Constants().titles is False, where 2.6.0 accepted the removal and answered True. Never released; this lands it before 2.7.0.

  • nameparser/config/_titles_2_6_0.py freezes 2.6.0's TITLES (812 words, generated from the wheel, never edited, deleted with the facade in 3.0).
  • v1's default titles = TITLES | (TITLES_2_6_0 & TITLES_AMBIGUOUS).
  • Constants._build_snapshot passes a kept moved word to titles_ambiguous (phrase reading, so a default Constants still equals Lexicon.default()), and a removed one to neither, which turns its modifier, style and phrase readings off too. After c.titles.remove('king'), Hon. King Smith reads title 'Hon.', given 'King', as 2.6.0 does after the same removal.
  • Words 2.6.0 never listed (dean, justice, grace, major, marshal) are untouched: c.titles.add('dean') still makes a title everywhere (the 1.4 recipe).
  • Spellings are compared folded (A v1 Constants entry that is only a CJK full stop raises ValueError at the first parse: c.titles.add('。') then HumanName('john smith', c) #582's rule) in the moved test and in the modifier/style/phrase intersections, so king。 / wing。 read as king / wing do.

The family sweep

Every v1 set attribute and the capitalization_exceptions keys, compared word by word against the 2.6.0 wheel (PYTHONSAFEPATH=1, nameparser.__file__ asserted both sides): only titles lost words (the seven above). suffix_not_acronyms gained the seven agnomens and fils (phase 2h, release-logged). suffix_acronyms_ambiguous, the 2h sets and given_name_abbreviations have no v1 manager that lost a word.

Gap, accepted

v1 has one bit per word; a moved word now has three readings. Adding a moved word in v1 restores the default (phrase-only), not 2.6.0's title everywhere — that takes Lexicon.default().add(titles={'king'}). This also moves an unreleased 2.7dev reading: on master c.titles.add('king') / Constants(titles=['dr', 'king']) read King as a title everywhere; now phrase-only. Release-log limit sentence added to the phrase-only bullet.

Tests

tests/v2/test_config_shim.py, moved words derived from the compiled sets (TITLES_2_6_0 & TITLES_AMBIGUOUS), so a later batch is swept with no edit — #903 has since merged into this branch: sultan and sultana joined the rows with no edit and pass. Membership, iteration, len, set operators, remove/discard, re-adding, replaced list, pickle/deepcopy/copy, folded spellings. 37 of the first commit's 39 rows fail on master 6ba78d0d (the two passing are the non-empty guard and dean's recipe); the review round's wing。 row fails on the commit before it.

Measured

  • Default parse does not move: snapshot test, CLDR/GND/native agreement records, facade case rows unchanged.
  • uv run pytest (27,060 passed), -n0 -m serial (frames/benchmarks, 43 passed), --python 3.15, mypy, ruff, sphinx doctest.
  • Two review rounds: the first found two miscounts in decisions/H9 and the folded-spelling gap; the second found that folding the moved test alone lost wing。's modifier reading (Wing Commander Smith), fixed by folding the intersections.

Docs

decisions/H9: a Standing line and a dated 2026-10-26 Log entry. decisions/3-0-reevaluations: a (B) entry. AGENTS.md's shim roster. The release-log limit sentence.

🤖 Generated with Claude Code

derek73 and others added 3 commits October 26, 2026 21:43
Phase 2j moved titles that are also given names (king, mahdi, wing, ...)
out of TITLES into the phrase-only TITLES_AMBIGUOUS, and v1's default
titles, copied from TITLES, lost them: Constants().titles.remove('king')
raised KeyError where 2.6.0 accepted it.

Freeze 2.6.0's TITLES (config/_titles_2_6_0.py, generated from the wheel)
and add every 2.6.0 title now in TITLES_AMBIGUOUS back to v1's default.
The snapshot reads a kept one by the phrase, as Lexicon.default() does,
and a removed one as no title, phrase readings included. A word 2.6.0
never listed (dean) still becomes a title everywhere when added. Tests
derive the moved words from the compiled sets, so later batches are
swept with no edit. decisions/H9, 2026-10-26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#752)

A v1 entry Lexicon folds onto a moved title ('king。') skipped the split
and read as a title everywhere. Pin the replaced-list Standing sentence
too, and correct two counts in decisions/H9 (39 rows; seven agnomens).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The second review of the fold found it narrowed at the intersections:
'wing。' kept its phrase reading but lost its modifier one, so 'Wing
Commander Smith' read no title. Fold all three intersections, and sweep
the full-stop spelling over every moved word.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derek73 derek73 added bug vocabulary Per-word vocabulary model and language packs labels Oct 27, 2026
@derek73 derek73 self-assigned this Oct 27, 2026
@derek73 derek73 added this to the 2.7 milestone Oct 27, 2026
…e-only-words

# Conflicts:
#	docs/design/decisions/H9-title-phrase.md
#	docs/release_log.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug vocabulary Per-word vocabulary model and language packs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant