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

How to change or add new labels to parsed address #628

Open
THENHKHAN opened this issue May 17, 2023 · 1 comment
Open

How to change or add new labels to parsed address #628

THENHKHAN opened this issue May 17, 2023 · 1 comment

Comments

@THENHKHAN
Copy link

THENHKHAN commented May 17, 2023

Hi!

I was checking out libpostal, and saw something that could be improved.
Is anyone tried to add some more label or rename the existing label of parsed address?

Thanks in advance

@albarrentine
Copy link
Contributor

Renaming an existing label can be done as a post-processing step in any programming language with a mapping dictionary. To change "house_number" to "building_number" in Python:

parsed = parse_address('A-16 Sector-63 Noida, Uttar Pradesh, 201303 India')
mappings = {'house_number': 'building_number'}
parsed = [(mappings.get(label, label), value) for label, value in parsed]

As far as adding new labels/examples, etc. the entire training data is freely available. There's some information in the README about how to download it from the Internet Archive and there are several issues in the history where people have trained country-specific models, etc. It's a fairly large undertaking to retrain the parser on the global dataset but you can if you want.

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

2 participants