Skip to main content

An address parser for Canadian postal addresses

Project description

ez-address-parser

Build Status coding_style PyPI - License PyPI - Python Version PyPI PyPI - Wheel Downloads GitHub commits since latest release time tracker

An address 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}")

Test

python setup.py test

Develop

pip install -r requirements-dev.txt

Annotation

python ez_address_annotator/data/convert.py
python ez_address_annotator/data/create_seed.py
label-studio start ez_address_annotator

label-studio provides an ease of use interface for name entity recognition. See the below example.

labeling-exmaple

Pretrained Model

python ez_address_annotator/data/export.py
python create_pretrained_model.py

130 annotated addresses are used to train a default model that comes with this package.

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.1.tar.gz (1.9 MB view hashes)

Uploaded Source

Built Distribution

ez_address_parser-0.2.1-py3-none-any.whl (28.4 kB view hashes)

Uploaded Python 3

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