Skip to content

Strange parsing of name w lastname prefix and title before and after #100

Description

@kaspersorensen

The combination of having lastname prefixes and repeated titles before and after a name seems to break the parsers logic around middle name handling.

Here's a test that fails:

        hn = HumanName("dr Vincent van Gogh dr")
        self.assertEqual("Vincent", hn.first)
        self.assertEqual("van", hn.middle)
        self.assertEqual("Gogh", hn.last)

For some reason, the middle name comes out as dr Vincent van instead of the expected van.

Activity

derek73 commented on Dec 12, 2019

@derek73
Owner

Current master does this:

% python tests.py "dr Vincent van Gogh dr"
<HumanName : [
	title: 'dr' 
	first: 'Vincent' 
	middle: ' dr Vincent van' 
	last: 'Gogh' 
	suffix: 'dr'
	nickname: ''
]>

Actually this is what I would expect because "van" is a prefix and should attach itself to the following piece.

% python tests.py "dr Vincent van Gogh dr"
<HumanName : [
	title: 'dr' 
	first: 'Vincent' 
	middle: '' 
	last: 'van Gogh' 
	suffix: 'dr'
	nickname: ''
]>

I think this is a valid bug but I'm not sure what the issue is.

derek73 commented on Dec 12, 2019

@derek73
Owner

actually, "van" is not a prefix because it is sometimes a first name. So you're right, this should be the expected output:

% python tests.py "dr Vincent van Gogh dr"
<HumanName : [
	title: 'dr' 
	first: 'Vincent' 
	middle: 'van' 
	last: 'Gogh' 
	suffix: 'dr'
	nickname: ''
]>
added this to the v1.3.0 milestone on Jun 29, 2026
self-assigned this
on Jun 29, 2026

derek73 commented on Jun 29, 2026

@derek73
Owner

Fixed in #179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions