GreenBuildingRegistry / usaddress-scourgify

Clean US addresses following USPS pub 28 and RESO guidelines
MIT License
206 stars 47 forks source link

Problem with address_constants.yaml #36

Open nickpalmer2012 opened 8 months ago

nickpalmer2012 commented 8 months ago

First of all, this library has been a godsend for a project I am working on at work.

I am having issues trying to set up an address_constants.yaml file to handle special cases I am running into.

I am running into special cases where the normalize_address_record(longhand=True) method returns a KeyError.

This is one such case: Address to be normalized: 3700 US Highway 51, La Place, LA 70068 Result from normalize_address_record(longhand=True): KeyError: 'US HIGHWAY' see full error message in attached .txt file key_error.txt

This is how my address_constants.yaml file looks right now:

insertion_method: update

STREET_TYPE_ABBREVIATIONS:
    'US Highway ': 'US-'

I just want the address_line_1 to show up as 3700 US-51

What am I doing wrong to handle this special case?

I am working in a jupyter notebook right now. I set the environment variable according to the readme. I used magic commands to set the ADDRESS_CONFIG_DIR environment variable with the magic command %env method. I can confirm that the variable with the file path successfully appear when I print the environment variables within the jupyter notebook.

For context, my project involves comparing street addresses for client facilities scraped from a webpage and comparing that address to the street address that we have on file. I was running into an issue where, for example Your library's longhand method fixes problem where addresses were being flagged when the only difference was street abbreviations.