Skip to content

Recognize Arabic and fullwidth CJK comma as name-part delimiters#281

Merged
derek73 merged 3 commits into
masterfrom
fix/265-arabic-comma
Jul 12, 2026
Merged

Recognize Arabic and fullwidth CJK comma as name-part delimiters#281
derek73 merged 3 commits into
masterfrom
fix/265-arabic-comma

Conversation

@derek73

@derek73 derek73 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • The lastname-comma split (parser.py) only matched the ASCII ,, so the Arabic comma ، (U+060C, standard in Arabic/Persian/Urdu text) never triggered "Last, First" detection and stuck to the last-name output.
  • Adds a shared commas regex ([,،,], also covering the fullwidth CJK comma U+FF0C) used both for splitting on commas and for stripping a trailing comma before parsing.

Test plan

  • New tests/test_comma_variants.py covers Arabic comma splitting, fullwidth comma splitting, no pollution in output, and trailing-comma stripping (written first, watched fail, then fixed — TDD)
  • Full suite: pytest tests/ — 1464 passed, 4 skipped, 22 xfailed, no regressions
  • mypy nameparser/ tests/ — clean

Fixes #265

The "Lastname, Firstname" split only matched the ASCII comma, so Arabic
(U+060C) and fullwidth (U+FF0C) commas failed to trigger the comma format
and leaked into the parsed output. Adds a shared "commas" regex used for
both the split and the trailing-comma strip.

Fixes #265.
@codecov-commenter

codecov-commenter commented Jul 12, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.69%. Comparing base (17d1946) to head (89a4635).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #281   +/-   ##
=======================================
  Coverage   97.69%   97.69%           
=======================================
  Files          13       13           
  Lines         912      913    +1     
=======================================
+ Hits          891      892    +1     
  Misses         21       21           

☔ 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.

RegexTupleManager falls back to EMPTY_REGEX for any key absent from a
custom regexes dict, and re.compile('').split() matches between every
character rather than not splitting -- so a Constants built with a
custom regexes set that omits "commas" shattered names into single
characters instead of just disabling the comma split. Also clarifies
the suffix_delimiter docstring to mention the comma variants.

Found in review of #281.
@derek73 derek73 added the bug label Jul 12, 2026
@derek73 derek73 self-assigned this Jul 12, 2026
@derek73 derek73 added this to the v1.4 milestone Jul 12, 2026
@derek73 derek73 merged commit 59fdabb into master Jul 12, 2026
8 checks passed
@derek73 derek73 deleted the fix/265-arabic-comma branch July 12, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arabic comma (U+060C) is not recognized as a comma

2 participants