{"library":"pyap2","title":"Pyap2: Address Parser","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pyap2"],"cli":null},"imports":["from pyap2 import parse_address"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pyap2\n\naddress_text = \"\"\"\n6162 E. Mockingbird Ln\nDallas, TX 75214\n\"\"\"\n\n# parse_address returns a list of Address objects\naddresses = pyap2.parse_address(address_text, country='US')\n\nif addresses:\n    for addr in addresses:\n        print(f\"Parsed Address: {addr.full_address}\")\n        print(f\"  Street: {addr.street_number} {addr.street_name} {addr.street_type}\")\n        print(f\"  City: {addr.city}\")\n        print(f\"  Region: {addr.region1}\")\n        print(f\"  Postcode: {addr.postcode}\")\n        print(f\"  As Dictionary: {addr.as_dict()}\")\nelse:\n    print(\"No address found or parsed.\")","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}