Skip to main content

pypostalwin

pypostalwin is the Un-Official Python wrapper to libpostal only for Windows, a fast statistical parser/normalizer for street addresses anywhere in the world.

About libpostal

libpostal is a C library for parsing/normalizing street addresses around the world using statistical NLP and open data. The goal of this project is to understand location-based strings in every language, everywhere.

Installation

1. Build the libpostal in windows

  • Before usign the Python wrapper, you need to build the libpostal C library as a bundle which can be accessed by the python package. (still under development)

(OR)

  • Download and Install MSYS2
  • You can use the libpostal prebuilt zipped file Download here
  • Unpack the zip to C:\Workbench\libpostal\
  • If you dont have Workbench folder in C Drive, then create one.
  • Copy the zip inside the Workbench and unzip using 7zip

2 . Install the python wrapper

Install using pip . Offical Python Package Here!!

pip install pypostalwin

(OR)

Clone this Repository. Run this from the root directory to install

python setup.py install

Usage

Import Package

import pypostalwin

1. Initialize Address Parser Object

parser = pypostalwin.AddressParser()
parsedAddress = parser.runParser("The White House 1600 Pennsylvania Avenue NW, Washington, DC 20500, USA")
print(parsedAddress)

output

[
  {'house': 'the white house'}, 
  {'house_number': '1600'},
  {'road': 'pennsylvania avenue nw'}, 
  {'city': 'washington'}, 
  {'state': 'dc'}, 
  {'postcode': '20500'}, 
  {'country': 'usa'}
]

Note: In a single runtime, the first-time parser.runParser() will take a few seconds to run since it is loading the models from libpostal in the backend process. Once it is loaded, the recurrent runs will be faster as usual. You need to use the same object instance to get the results faster.

for eg:

parser = pypostalwin.AddressParser()
parsedAddress1 = parser.runParser("The White House 1600") #only first time will take few seconds to load
parsedAddress2 = parser.runParser("Washington, DC 20500, USA") #will be faster as usual
parsedAddress3 = parser.runParser(" 20500, USA") #will be faster as usual
parsedAddress4 = parser.runParser("Pennsylvania Avenue NW, Washington,") #will be faster as usual

2. Expand the Address

expandAddress = parser.expandTheAddress("District Science Cntr, Kokkirakulam Rd, Tirunelveli, TamilNadu 627009")
print(expandAddress)

output

['district science center kokkirakulam road tirunelveli tamilnadu 627009',
 'district science connector kokkirakulam road tirunelveli tamilnadu 627009']

3. Terminate Address Parser Object

parser.terminateParser()

Metadata

Release files for pypostalwin 0.0.3

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

Source distribution (sdist)

Source distribution for pypostalwin 0.0.3
File Size Uploaded
pypostalwin-0.0.3.tar.gz 5.0 kB Details

Built distribution (wheel)

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

Total release size: 9.8 kB

Release files / pypostalwin-0.0.3.tar.gz

Download URL pypostalwin-0.0.3.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4ba0b7b57051a3aeb8fe6a48e1cd68143cec551ec8ea90672036b4e7eb887d7f
BLAKE2b-256 checksum
How to use checksums
a0fbcdf3f97ec6a67874805e612e53036762cb426a8a2d7306dd623715789777
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release files / pypostalwin-0.0.3-py3-none-any.whl

Download URL pypostalwin-0.0.3-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97c61b00ef1547b1ce8e394ff7f90c6ad3d570aa93391411ab878a1ec52f4240
BLAKE2b-256 checksum
How to use checksums
2471d98e8b9cf8a54e7a701aecc0049e51d1aa40609503980281184f120c3b6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

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