Name: pypostal
Owner: datamade
Description: Python bindings to libpostal for fast international address parsing/normalization
Forked from: openvenues/pypostal
Created: 2017-05-07 19:25:45.0
Updated: 2018-01-05 16:17:18.0
Pushed: 2017-05-07 19:37:44.0
Homepage: null
Size: 28
Language: C
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
These are the official Python bindings to https://github.com/openvenues/libpostal, a fast statistical parser/normalizer for street addresses anywhere in the world.
postal.expand import expand_address
nd_address('Quatre vingt douze Ave des Champs-Élysées')
postal.parser import parse_address
e_address('The Book Club 100-106 Leonard St, Shoreditch, London, Greater London, EC2A 4RH, United Kingdom')
Before using the Python bindings, you must install the libpostal C library. Make sure you have the following prerequisites:
On Ubuntu/Debian
apt-get install curl autoconf automake libtool python-dev pkg-config
On CentOS/RHEL
yum install curl autoconf automake libtool python-devel pkgconfig
On Mac OSX
brew install curl autoconf automake libtool pkg-config
Installing libpostal
clone https://github.com/openvenues/libpostal
ibpostal
otstrap.sh
nfigure --datadir=[...some dir with a few GB of space...]
make install
Linux it's probably a good idea to run
ldconfig
To install the Python library, just run:
install postal
pypostal supports Python 2.7+ and Python 3.4+. These bindings are written using the Python C API and thus support CPython only. Since libpostal is a standalone C library, support for PyPy is still possible with a CFFI wrapper, but is not a goal for this repo.
Make sure you have nose installed, then run:
on setup.py build_ext --inplace
tests postal/tests
The `build_ext --inplace
` business is needed so the C extensions build in the source checkout directory and are accessible/importalbe by the Python modules.