Expostal v0.2.0 Expostal View Source

Address parsing and expansion module for Openvenue’s Libpostal, which does parses addresses.

Link to this section Summary

Functions

Loads the large dataset from disk for libpostal and prepares it for future calls

Expand given address into a list of expansions

Parse given address into a map of address components

Link to this section Functions

Loads the large dataset from disk for libpostal and prepares it for future calls.

If you do not run this explicitly, then it will be run by parse_address/1 or expand_address/1 on their first run. This is a very slow process (it can take 10s of seconds), so if you value the responsiveness of your application, you can spawn a secondary thread to run this bootstrap in the background on your application startup:

spawn(fn -> Expostal.bootstrap end)

This will prevent you IEx shell from hanging during startup and will make the library much more likely to be ready for immediate usage for your first call.

Link to this function expand_address(address) View Source
expand_address(address :: String.t) :: [String.t]

Expand given address into a list of expansions

Examples

iex> Expostal.expand_address(“781 Franklin Ave Crown Hts Brooklyn NY”) [“781 franklin avenue crown heights brooklyn new york”, “781 franklin avenue crown heights brooklyn ny”]

Link to this function parse_address(address) View Source
parse_address(address :: String.t) :: map

Parse given address into a map of address components

Examples

iex> Expostal.parse_address("615 Rene Levesque Ouest, Montreal, QC, Canada")
%{city: "montreal", country: "canada", house_number: "615",
  road: "rene levesque ouest", state: "qc"}