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

Enable lastname remapping - fixes #11 #16

Merged
merged 2 commits into from Sep 16, 2018
Merged

Conversation

wyrfel
Copy link
Contributor

@wyrfel wyrfel commented Sep 16, 2018

Names like "SUJAN MASTER", "JAMES J MA", "PETER K MA" had the 'Master'
or 'Ma' parts as special parts (salutations, suffixes) where they
should be lastnames. In "PAUL M LEWIS MR", the lastname should be
'Lewis Mr'.

This change does three things to fix this:
Firstly, it prevents parsing for salutations beyond the first half of words in
the given string. It also introduces a setMaxSalutationIndex() method
to allow overriding this with a fixed maximum word index. E.g. setting
it to 2 will require salutations to appear in the first two words.

Secondly, if the lastname mapper does not derive a lastname, but has skipped
ignored parts like suffix, nickname or salutation, it will convert these into
lastname parts.

Thirdly, the lastname mapper will now map more than one lastname part if
the already mapped lastname parts are shorter than 3 characters and there
will be at least one part left after mapping. This effectively maps
'Lewis' in 'Paul M Lewis Mr' as lastname instead of previously as middlename.

Names like "SUJAN MASTER", "JAMES J MA", "PETER K MA" had the 'Master'
or 'Ma' parts as special parts (salutations, suffixes) where they
should be lastnames. In "PAUL M LEWIS MR", the lastname should be
'Lewis Mr'.

This change does three things to fix this:
Firstly, it prevents parsing for salutations beyond the first half of words in
the given string. It also introduces a `setMaxSalutationIndex()` method
to allow overriding this with a fixed maximum word index. E.g. setting
it to 2 will require salutations to appear in the first two words.

Secondly, if the lastname mapper does not derive a lastname, but has skipped
ignored parts like suffix, nickname or salutation, it will convert these into
lastname parts.

Thirdly, the lastname mapper will now map more than one lastname part if
the already mapped lastname parts are shorter than 3 characters and there
will be at least one part left after mapping. This effectively maps
'Lewis' in 'Paul M Lewis Mr' as lastname instead of previously as middlename.
@coveralls
Copy link

coveralls commented Sep 16, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling c850174 on feature/lastname-remapping into 725c5b4 on master.

@wyrfel wyrfel force-pushed the feature/lastname-remapping branch 3 times, most recently from 7173969 to a1d94da Compare September 16, 2018 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants