镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Support smart quotes (“Jack”), guillemets («Petit»), and CJK brackets as nickname delimiters #273

Description

@derek73

The three built-in nickname delimiters (quoted_word, double_quotes, parenthesis) are ASCII-only, so nicknames wrapped in any typographic or non-Latin quote convention leak into the name pieces as garbage middle names (v1.3.0):

>>> HumanName('John "Jack" Kennedy').nickname   # ASCII: works
'Jack'
>>> HumanName('John “Jack” Kennedy').middle     # smart quotes: leaks
'“Jack”'
>>> HumanName('Jean «Petit» Dupont').middle     # guillemets (French, Russian, ...)
'«Petit»'
>>> HumanName('Hans „Hansi“ Müller').middle     # low-high (German, Polish, Czech, ...)
'„Hansi“'
>>> HumanName('山田「タロ」太郎').first            # CJK corner brackets: unsplit blob
'山田「タロ」太郎'

The smart-quote case is effectively English input: “…” (U+201C/201D) is what word processors and phone keyboards autocorrect plain quotes to, so real-world copy-paste text hits this constantly — same input-normalization class as #266.

Proposed additions to the built-in delimiter inventory, one ordered open/close pair each (the conventions can't be merged into a single character class — German's closing “ is English's opening quote, so each pair needs its own regex, exactly like the three existing ones):

Pair Convention
“…” smart-quotes English; also Chinese
«…» French, Russian, Italian, Greek — allow inner spaces (« Petit »)
„…“ German, Polish, Czech, Hungarian
»…« German alternative
”…” Swedish, Finnish
「…」, 『…』 Japanese corner brackets
(…) fullwidth parentheses (CJK)

All of these are safe as defaults: unlike the apostrophe, none can legitimately appear inside a name. Explicitly excluded: curly single quotes ‘…’ — U+2019 is also the preferred typographic apostrophe (O’Connor), so it would need the same whitespace-border rules as the ASCII quoted_word regex and deserves separate, careful treatment if ever.

The nickname_delimiters dict already accepts additional compiled patterns at runtime, so this is purely an expansion of the built-in inventory. Related: #266, #269.

Activity

  1. changed the title [-]Nicknames in smart quotes (“Jack”), guillemets («Petit»), or CJK brackets are not extracted[/-] [+]Support smart quotes (“Jack”), guillemets («Petit»), and CJK brackets as nickname delimiters[/+] on Jul 7, 2026
  2. added this to the v2.0 milestone on Jul 12, 2026
  3. added a commit that references this issue on Jul 18, 2026
    7ee6e3a
  4. derek73 commented on Jul 18, 2026

    @derek73
    OwnerAuthor

    Implemented on the 2.0 branch (PR #288, commit 7ee6e3a): all eight proposed pairs ship in DEFAULT_NICKNAME_DELIMITERS and as named sentinels in the v1 CONSTANTS API (smart_double_quotes, guillemets, ...), with curly single quotes excluded as proposed (U+2019 stays the apostrophe in "O'Connor"). The issue's five repro examples are pinned as test rows, « Petit » inner spacing is tolerated, and a delimiter character consumed by another pair's extraction (the shared-character overlap: German's closing “ is English's opening quote) no longer emits a spurious unbalanced-delimiter ambiguity. Closes with the 2.0.0 merge.

  5. self-assigned this
    on Jul 18, 2026
  6. added a commit that references this issue on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions