Skip to content

{first} {last}, {suffix} is incorrectly recognized as {first}, {title} #62

Closed

Description

@Darayavaush
>>> name = "John Smith, Dr."
>>> nameparser.HumanName(name)
<HumanName : [
        title: 'Dr.'
        first: 'John Smith'
        middle: ''
        last: ''
        suffix: ''
        nickname: ''
]>

But if I insert a comma, it is recognized as per documentation:

>>> name = "John, Smith, Dr."
>>> nameparser.HumanName(name)
<HumanName : [
        title: ''
        first: 'Smith'
        middle: ''
        last: 'John'
        suffix: 'Dr.'
        nickname: ''
]>

Activity

  1. derek73 commented on Aug 11, 2017

    @derek73
    Owner

    It turns out this is because "Dr" is not an expected suffix, yet. It works as expected with "MD". "Dr" is currently only expected as a prefix.

    It makes me wonder if maybe we should check through all the TITLES when they come after a comma (with more than 1 part before the comma) like this, but there's a lot in there. There's a few that could be names, so it could make some cases of "Lastname, Title Firstname" parse incorrectly.

    I'm thinking for now to just put "Dr" in with the suffixes too. Let me know if you have other thoughts.

  2. added this to the v1.0 milestone on Aug 11, 2017
  3. Darayavaush commented on Aug 11, 2017

    @Darayavaush
    Author

    Actually, I listed Dr. as an example - I have lots of very rare suffixes (I suspect some of them to be made up) to work with, which is unreasonable to recognize via a whitelist.

    I can't see why the addition of anything after the comma should turn the first part from being treated as a full name into just the first name. What I suggest you do instead is check whether the part before the (last) comma contains more than one word. If it does, then parse it as a name on its own and then mark the part after comma as a suffix.

  4. modified the milestones: v1.0, v0.5.4 on Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions