Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling " - " separators in suffix acronyms #156

Open
shartzog opened this issue Aug 28, 2024 · 1 comment
Open

Handling " - " separators in suffix acronyms #156

shartzog opened this issue Aug 28, 2024 · 1 comment

Comments

@shartzog
Copy link

I've come across some source data that uses " - " rather than ", " as a delimiter for healthcare providers with multiple credentials. Under these conditions, nameparser breaks down pretty badly. Adding "-" to CONSTANTS.suffix_acronyms corrects the bad behavior for the most part, although I'd still prefer to have the individual suffixes identified as shown in the final "MD, DO, DDS" example so that my name formatting remains consistent in both cases. Any thoughts on how this might be solved holistically?

Example:

>>> import nameparser
>>> from nameparser.config import CONSTANTS
>>> nameparser.HumanName("Steven Hardman, RN - CRNA")
<HumanName : [
        title: ''
        first: 'RN'
        middle: '-'
        last: 'Steven Hardman'
        suffix: 'CRNA'
        nickname: ''
]>
>>> nameparser.HumanName("Steven Hardman, MD - DO - DDS")
<HumanName : [
        title: 'MD'
        first: '-'
        middle: 'DO -'
        last: 'Steven Hardman'
        suffix: 'DDS'
        nickname: ''
]>
>>> _ = CONSTANTS.suffix_acronyms.add("-")
>>> nameparser.HumanName("Steven Hardman, MD - DO - DDS")
<HumanName : [
        title: ''
        first: 'Steven'
        middle: ''
        last: 'Hardman'
        suffix: 'MD - DO - DDS'
        nickname: ''
]>
>>> nameparser.HumanName("Steven Hardman, MD - DO - DDS").suffix_list
['MD - DO - DDS']
>>> nameparser.HumanName("Steven Hardman, MD, DO, DDS").suffix_list
['MD', 'DO', 'DDS']
@shartzog
Copy link
Author

shartzog commented Aug 28, 2024

(obviously, a simple replace of " - " with ", " prior to calling HumanName in the first place will also solve my issue, so this one may be more academic than practical 😆)

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

No branches or pull requests

1 participant