Document FAMILY_FIRST_GIVEN_LAST, and fix the name-order example it exposed - #347
Merged
Conversation
The example used "Nguyen Van Minh", which could not distinguish FAMILY_FIRST from FAMILY_FIRST_GIVEN_LAST: "Van" collides with the Dutch particle "van", so the vocabulary layer joins it forward before the positional layer sees three tokens, and both orders return family='Nguyen' given='Van Minh' with an empty middle. The block was demonstrating particle-joining rather than name_order, and reported the Vietnamese given name as "Van Minh" rather than "Minh". It also contradicted modules.rst, which names Vietnamese as the exemplar for FAMILY_FIRST_GIVEN_LAST rather than for FAMILY_FIRST. Switch to a Hungarian name, which is what modules.rst claims for this constant and which has no ambiguous-particle collision, and show the middle field so the assignment order is visible. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The constant was exported and reference-documented in modules.rst, but nothing in the guide showed what it does to a name -- the only worked examples lived in the test suite. Since it is keyed to no script and has no locale pack, an explicit Policy is the only way to reach it, which makes the guide the one place a reader could have found it. Extend the existing name-order section rather than adding a sibling: the constant only means anything in contrast with FAMILY_FIRST, and a separate section would duplicate the comma-precedence paragraph. Also record the particle collision that made the old example inert, as prose plus a unit test rather than a second doctest block: "Nguyen Van Minh" parses identically under both family-first orders because "Van" is the ambiguous Dutch particle. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #347 +/- ##
=======================================
Coverage 98.48% 98.48%
=======================================
Files 41 41
Lines 2845 2845
=======================================
Hits 2802 2802
Misses 43 43 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FAMILY_FIRST_GIVEN_LASTappeared in the docs only as reference-table entries — the API entry inmodules.rst, one clause in the Policy field table, and a changelog bullet. Nothing showed what it does to a name. Since it is keyed to no script and has no locale pack, an explicitPolicyis the only way to reach it, so the guide was the one place a reader could have found it.Writing that up surfaced a problem in the example already there.
The old example was inert
customize.rstdemonstratedFAMILY_FIRSTwith "Nguyen Van Minh" — a Vietnamese name, whilemodules.rstnames Vietnamese as the exemplar forFAMILY_FIRST_GIVEN_LAST. The two pages disagreed on the same name.It also could not distinguish the two constants:
Vancollides with the Dutch particlevaninparticles_ambiguous, so the vocabulary layer joins it forward before the positional layer ever sees three tokens. The doctest passed, but it was exercising particle-joining rather thanname_order, and reported the Vietnamese given name as "Van Minh" rather than "Minh".Remove the collision and the constants separate:
Changes
FAMILY_FIRSTmoves to a Hungarian name — whatmodules.rstalready claims for the constant, and free of the collision. The middle field is now shown so the assignment order is visible.FAMILY_FIRST_GIVEN_LASTgets the Vietnamese name, contrasted againstFAMILY_FIRSTon that single name, with a sentence of naming background first and a note that the order is keyed to no script (Latin carries none) and has novnpack yet (Wrong parsing of vietnamese names #146).It extends the existing name-order section rather than adding a sibling — the constant only means anything in contrast with
FAMILY_FIRST, and a separate section would duplicate the comma-precedence paragraph that follows.Verification
uv run pytest— 3066 passed, 20 skipped, 11 xfaileduv run sphinx-build -b doctest docs— 223 tests, 0 failures (up from 218; +5 matches the new block's 5 statements)uv run sphinx-build -b html -W --keep-going docs— build succeeded, so the internal section link resolves🤖 Generated with Claude Code