Skip to content

Support family-first name order via an order-spec config (name_order) #270

Description

@derek73

The parser's Western-order assumption is confined to the positional assignment loops in parse_full_name — the vocabulary layer (titles, prefixes, suffixes, conjunctions, nicknames, capitalization) is entirely order-agnostic, and the lastname-comma path already parses family-first when a comma provides the signal. That makes name order configurable without restructuring the parser.

Proposal: an opt-in Constants attribute specifying the positional order of name parts, e.g.:

C.name_order = ('last', 'first', 'middle')   # Chinese, Hungarian, Japanese rōmaji (#83)
C.name_order = ('last', 'middle', 'first')   # Vietnamese (#146)

A boolean family_name_first flag was considered and rejected: Vietnamese order is [family][middle][given] — the given name is the last token — so these issues need at least two non-Western orders. An order spec covers both and subsumes the Western default as ('first', 'middle', 'last').

Notes for design:

Would resolve the spaced-input cases of #83 and #146.

Activity

  1. added this to the v2.0 milestone on Jul 7, 2026
  2. derek73 commented on Jul 18, 2026

    @derek73
    OwnerAuthor

    A scoping note now that the 2.0 locale-pack layer has landed on the v2 branch (PR #288): this issue has two separable pieces.

    1. The delivery mechanism — opt-in locale packs (nameparser.locales, parser_for(locales.XX)), which can carry policy and lexicon fragments. This is the infrastructure any name-order support will ride on, and it has landed.
    2. The order-spec itself — Policy.name_order for positional family-first parsing (zh/ko/hu), with Unspaced Chinese/Korean names: surnames constants + longest-match segmentation #271/Japanese name segmentation via optional dependency (nameparser[ja]) #272 supplying the surname data. This is the remaining substance of this issue and is still open for 2.0.

    Where the 2.0 release-log draft says the locale-pack work closes "the pack half of #270", it means piece 1; this issue stays open for piece 2.

  3. derek73 commented on Jul 28, 2026

    @derek73
    OwnerAuthor

    Shipped in 2.0.0, both halves: Policy(name_order=...) with the three exported order constants, and the actual family-first parsing behavior ("Wang Xiu Ying" parses as written under FAMILY_FIRST; FAMILY_FIRST_GIVEN_LAST covers the Vietnamese order). Comma format still overrides the spec, and suffixes/titles behave normally under every order. The vocabulary follow-ons — zh/ko surnames and the [ja] extra — continue in #271/#272.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions