US Address Scourgify

0.6.0 · active · verified Sat Apr 11

usaddress-scourgify is a Python library (current version 0.6.0) for cleaning and normalizing US addresses, adhering to USPS Publication 28 and RESO guidelines. Released on December 14, 2023, it provides functions to standardize address strings into a consistent format. The library is built on top of the `usaddress` parsing library. While active, its release cadence appears infrequent.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `normalize_address_record` function to clean and standardize a US address string. It also shows how to request long-hand output and includes a commented-out example for `get_geocoder_normalized_addr` which requires a Google API key.

import os
from scourgify import normalize_address_record

address_str = '123 southwest Main street, Boring, OR 97009, UNIT 100'

# Normalize an address string
cleaned_address = normalize_address_record(address_str)
print(cleaned_address)

# To get long-hand output (e.g., 'Southwest' instead of 'SW')
long_hand_address = normalize_address_record(address_str, long_hand=True)
print(long_hand_address)

# Example with get_geocoder_normalized_addr (requires GOOGLE_API_KEY env var)
# from scourgify.normalize import get_geocoder_normalized_addr
# os.environ['GOOGLE_API_KEY'] = os.environ.get('GOOGLE_API_KEY', 'YOUR_GOOGLE_API_KEY')
# geocoded_address = get_geocoder_normalized_addr(address_str)
# print(geocoded_address)

view raw JSON →