GreenBuildingRegistry / usaddress-scourgify

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

Cities with Saint (i.e. St.) in their Name and Occupany Identifier #18

Closed msmall-amfam closed 11 months ago

msmall-amfam commented 3 years ago

Take the address:

9405 Green Park Gardens Dr APT E, St. Louis, MO 63123, USA

Passing to normalize_address_record causes:

        if ((occupancy_id and not occupancy_id.startswith('#'))
                and not occupancy_type_abbr):
            occupancy_type_abbr = default
        if occupancy_type_abbr:
            parsed_list = list(parsed_addr.items())
>           index = parsed_list.index(('OccupancyIdentifier', occupancy_id))
E           ValueError: ('OccupancyIdentifier', None) is not in list

I'm assuming a regex is confusing 'St.' in 'St. Louis' with the abbreviation for Street. Remove 'St.' from 'St. Louis', the normalization works as expected.

fablet commented 11 months ago

Version 0.5.1 should resolve this issue