Skip to main content

ukaddresskit

CI PyPI version Downloads

UK address utility based on machine learning and optimised search to parse, standardise, and compare addresses.

Address NER tagger is trained using crfsuite with help of 2 million uk housing addresses.

Install - alpha stage

pip install ukaddresskit

Quick Start

Tagger

from ukaddresskit.parser import tag

print(tag("10 Downing Street SW1A 2AA"))

Output

{'BuildingNumber': '10', 'Locality': 'DOWNING', 'TownName': 'STREET', 'Postcode': 'SW1A 2AA'}

Postcode Helpers

from ukaddresskit.postcode import *

normalize_postcode("sw1a2aa")  # "SW1A 2AA"
get_town("SW1A 2AA")      # "LONDON"
get_county("SW1A 2AA")         # "Greater London" (if in mapping)
get_county("SW1A 2AA") 
get_locality(postcode: str)
get_streets(postcode: str)
get_property_mix(postcode: str) -> Dict[str, float]

---

from ukaddresskit.locality import *

get_town_by_locality("Ab Kettleby")                 -> "MELTON MOWBRAY"
get_town_by_locality("Abberton", ambiguity="all")   -> ["COLCHESTER", "PERSHORE"]
list_towns_for_locality("Abberton")                 -> ["COLCHESTER", "PERSHORE"]

Todo

  • Add outcode_to_county.csv into lookups
  • Fix bugs in library not loading on Colab
  • Create postcode fill utility
    • get_town(postcode)
    • get_county(postcode)
    • get_locality(postcode)
    • get_streets(postcode) → array of street names
    • get_property_mix(postcode)
    • add test cases
  • Create address populate utility (add missing address components - town, county, etc)
  • Create address linkage utility / comparing
  • Define test cases, organise code
  • Improve machine learning models
  • Create .parquet sqlite storage, indexes for optimal searches
  • Create online docs
  • Improve Address Parser

AddressParser (Pre & Post processing -- needs testing)

import pandas as pd
from ukaddresskit.pipeline import AddressParser

ap = AddressParser()
df = pd.DataFrame({"ADDRESS": [
    "Flat 2, 10 Queen Street, Bury BL8 1JG",
]})
out = ap.parse(df)
fields = [
    "SubBuildingName", "BuildingName", "BuildingNumber",
    "StreetName", "Locality", "TownName", "Postcode", "County",
    "PAOstartNumber", "PAOendNumber", "PAOstartSuffix", "PAOendSuffix",
    "SAOStartNumber", "SAOEndNumber", "SAOStartSuffix", "SAOEndSuffix",
]

for i, row in out.iterrows():
    print(f"\nAddress #{i}")
    for col in fields:
        val = row.get(col)
        if pd.notna(val) and str(val) != "":
            print(f"  {col:16} {val}")

Output

Address #0
  SubBuildingName  FLAT 2
  BuildingNumber   10
  StreetName       QUEEN STREET
  TownName         BURY
  Postcode         BL81JG
  PAOstartNumber   10.0
  SAOStartNumber   2

Metadata

Release files for ukaddresskit 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ukaddresskit 0.0.5
File Size Uploaded Provenance Actions
ukaddresskit-0.0.5.tar.gz 31.6 MB Without provenance Details for ukaddresskit-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ukaddresskit 0.0.5
File Interpreter ABI Platform Actions
ukaddresskit-0.0.5-py3-none-any.whl Python 3 none any Details for ukaddresskit-0.0.5-py3-none-any.whl

Total release size: 63.6 MB

Release files / ukaddresskit-0.0.5.tar.gz

Download URL ukaddresskit-0.0.5.tar.gz
Size 31.6 MB
Tags Source
SHA-256 checksum
How to use checksums
2e58e7891fe819a1c4deb6e28448a46325c0bd0bd7cc7e601941a7549224e2e8
BLAKE2b-256 checksum
How to use checksums
ffc5e666654e7edd534afbe846c59a31dcd292cd405d2c84b2ffb26be7ae31a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Release files / ukaddresskit-0.0.5-py3-none-any.whl

Download URL ukaddresskit-0.0.5-py3-none-any.whl
Size 32.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
bf9ea292d25b3da72aea144dcd994d0d24561225da252c020bed6454ba501ab7
BLAKE2b-256 checksum
How to use checksums
cabc654f93e9fe13dc0cda12596630b01493229532522796e1cc9d91c69f1d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.13

Security for ukaddresskit 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page