Pyap2 is a maintained fork of pyap, a regex-based library for parsing US, CA, and UK addresses. It provides a robust way to extract structured address data from unstructured text. The fork adds typing support, handles more address formats and edge cases, and is actively developed. The current version is 0.2.12, with frequent minor releases addressing new formats and edge cases.
pip install pyap2Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `parse_address` with a sample US address. It's crucial to specify the `country` parameter for accurate parsing. The function returns a list of `Address` objects, from which you can extract various components or get a dictionary representation.
Ensure you install `pyap2` and update your import statements to `from pyap2 import parse_address`.
When processing text with multiple addresses, ensure each distinct address is on its own line or separated by newlines.
Always pass the appropriate `country` parameter (e.g., 'US', 'CA', 'UK') to `parse_address`.
Verify that the addresses you intend to parse are from one of the supported countries. For other regions, consider alternative libraries.
No dependency data recorded yet.