Skip to content

make the constants more easily configurable #1

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

Closed
derek73 opened this issue Apr 2, 2014 · 1 comment
Closed

make the constants more easily configurable #1

derek73 opened this issue Apr 2, 2014 · 1 comment
Assignees
Milestone

Comments

@derek73
Copy link
Owner

derek73 commented Apr 2, 2014

Make it easier to adjust the constants for your own purposes. We know we're never going to be perfect for everyone so it should be more easy and obvious how to customize handling. Something like:

HumanName.constants.titles.add('Dean')

Currently the regex for things like initials and nicknames are in constants.py and there's no easy way to change them. Should make the regex configurable too.

@derek73 derek73 added this to the v0.3 milestone Apr 2, 2014
@derek73 derek73 self-assigned this Apr 2, 2014
@derek73 derek73 changed the title make regex constants configurable make the constants more easily configurable May 14, 2014
derek73 added a commit that referenced this issue May 15, 2014
use unicode_literals for better python 2 & 3 support
can now adjust constants like so:

	from nameparser.constants import constants
	constants.titles.add('dean')
	hn = HumanName('dean name')
	hn
        <HumanName : [
            Title: 'dean'
            First: ''
            Middle: ''
            Last: 'name'
            Suffix: ''
            Nickname: ''
        ]>
derek73 added a commit that referenced this issue May 15, 2014
derek73 added a commit that referenced this issue May 16, 2014
Just noticed they are actually the same kind of thing, so create a dotdict to handle their config
@derek73
Copy link
Owner Author

derek73 commented May 17, 2014

I think this implementation works pretty good.

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

No branches or pull requests

1 participant