Skip to content

Handle some more prefixes - #3

Closed
eileenmcnaughton wants to merge 1 commit into
iliaal:masterfrom
eileenmcnaughton:ups
Closed

Handle some more prefixes#3
eileenmcnaughton wants to merge 1 commit into
iliaal:masterfrom
eileenmcnaughton:ups

Conversation

@eileenmcnaughton

Copy link
Copy Markdown
Contributor

These lean a bit English but had been submitted to a previous fork

These lean a bit English but had been submitted to a previous fork
eileenmcnaughton added a commit to eileenmcnaughton/name-parser that referenced this pull request Jul 28, 2026
This aligns the English salutations with the ones in the fork after iliaal/nameparser#3 is merged to the fork
eileenmcnaughton added a commit to eileenmcnaughton/name-parser that referenced this pull request Jul 28, 2026
This aligns the English salutations with the ones in the fork after iliaal/nameparser#3 is merged to the fork
eileenmcnaughton added a commit to eileenmcnaughton/name-parser that referenced this pull request Jul 28, 2026
This aligns the English salutations with the ones in the fork after iliaal/nameparser#3 is merged to the fork
@iliaal

iliaal commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Thanks Eileen. Merged to master, with your commit kept as-is and a follow-up on top.

The new keys surfaced two ways a title can eat a name. Both were pre-existing in the mapper and only became reachable once these words were in the dictionary:

  • Lord, Jack and Pastor, Maria lost the surname outright. SalutationMapper consumed the comma form's surname segment, so getLastname() returned empty. The segment now keeps its last token when the title is also a real name; an unambiguous title still resolves whole (Dr., John).
  • John Lord Smith Jr lost the middle name. Honorifics are now a leading run, so a dictionary hit after a real name stays part of the name. The Rev. Mark Williams still works, and an explicit setMaxSalutationIndex() opts out.

The same fix picks up Master, John and Hon, John.

One edit to your dictionary: pastor renders as Pastor instead of Pr., which was the only value in the map that wouldn't parse back into a salutation.

Rt Hon also matches Rt. Hon. and The Rt Hon. Added tests/SalutationCollisionTest.php (68 cases) plus a CHANGELOG entry. The bundled 30k NPI corpus holds at 95.33%, with two rows improving.

@iliaal iliaal closed this Jul 28, 2026
@eileenmcnaughton
eileenmcnaughton deleted the ups branch July 28, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants