libpostal
| libpostal | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Author: | openvenues/libpostal/graphs/contributors GitHub | |||||||||||||||||||
| License: | MIT License (free of charge) | |||||||||||||||||||
| Platform: | Cross-platform | |||||||||||||||||||
| Status: | Active | |||||||||||||||||||
| Version: | 1.1 releases (2018-05-09) | |||||||||||||||||||
| Language: | multiple languages
| |||||||||||||||||||
| Source code: | openvenues/libpostal GitHub | |||||||||||||||||||
| Programming language: | C | |||||||||||||||||||
|
C library for parsing and normalizing street addresses worldwide | ||||||||||||||||||||
| ||||||||||||||||||||
libpostal is an open source C library for parsing and normalizing street addresses from around the world. It is trained on OpenStreetMap and OpenAddresses data. Several geocoders use it to split a query into components before searching, including Pelias.
libpostal does not geocode: it does not return coordinates or check that an address exists. Its stated non-goals are validating addresses, geocoding them, and extracting addresses from free text.
Features
- Address parsing – a conditional random field model labels the parts of an address (
house_number,road,unit,postcode,city,state,countryand others). It is trained on more than a billion addresses for every inhabited country, built from OSM and OpenAddresses records formatted with OpenCage's address-formatting templates. - Normalization (
expand_address) – expands abbreviations in more than 50 languages ("rd" → "road"), parses numeric expressions ("twenty first" → 21st), transliterates between scripts, and strips accents, producing candidate forms useful for matching and deduplication. - Language classification – trained on OSM ways,
addr:*tags and place names, with regional default languages taken from OSM boundaries.
The parser labels follow the field names of OpenCage's address-formatting project, plus a few of libpostal's own such as level, staircase, entrance and category.
An alternative model from Senzing, aimed at US, UK and Singapore addresses, can be selected at build time.
Using libpostal
The library and its data files take a few gigabytes (about 1.8 GB for the default model). It can be installed from source, Homebrew or MacPorts. Official bindings exist for Python (pypostal), Ruby, Go, Java, PHP, Node.js and R, and the README lists unofficial bindings, a PostgreSQL extension and REST servers.
The last tagged release is 1.1 (2018); development continues on the main branch.
Background
libpostal was created by Al Barrentine at openvenues. Its design is described in two articles, Statistical NLP on OpenStreetMap and part 2.