Skip to main content

A parser for Canadian postal addresses

Project description

logo

ez-address-parser

pytest coding_style PyPI - License PyPI - Python Version PyPI - Wheel Downloads GitHub Pages

A parser for Canadian postal addresses

Install

From PyPi

pip install ez-address-parser

From GitHub

pip install git+https://github.com/zehengl/ez-address-parser.git

Usage

Command Line

python -m ez_address_parser --address <some-address>

Code (with pretrained model)

from ez_address_parser import AddressParser

ap = AddressParser()

address = input("Address: ")
result = ap.parse(address)
for token, label in result:
    print(f"{token:20s} -> {label}")

Code (without pretrained model)

from ez_address_parser import AddressParser

ap = AddressParser(use_pretrained=False)

data = [
    [
        ('123', 'StreetNumber'),
        ('Main', 'StreetName'),
        ('St', 'StreetType'),
        ('E', 'StreetDirection')
    ],
    ...
] # list of list of (<token>, <label>) tuple

ap.train(data)

address = input("Address: ")
result = ap.parse(address)
for token, label in result:
    print(f"{token:20s} -> {label}")

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ez-address-parser-0.2.5.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

ez_address_parser-0.2.5-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file ez-address-parser-0.2.5.tar.gz.

File metadata

  • Download URL: ez-address-parser-0.2.5.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for ez-address-parser-0.2.5.tar.gz
Algorithm Hash digest
SHA256 ddd2bf780615ef788dd3ed3560c6f75dfab2c930efa48076b13b1fca3d9943cc
MD5 65cfa8516215c33a3b904a6c7092d78b
BLAKE2b-256 156616892aca8c8a1e5125791be1bd3ce5e328bab7d3e6ac494008b07435b183

See more details on using hashes here.

File details

Details for the file ez_address_parser-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ez_address_parser-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f1a5c958971276e6046da530d6c10cbdaddb704ca8a2f818fbb50b76d5842333
MD5 61919bb0fafe9066e9915d368ce1ed25
BLAKE2b-256 770f4a5cf69747c27faf64963f46800edd1ae28999df8171980c4a6aa803047d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page