Git Product home page Git Product logo

postie's Introduction

Postie

A Libpostal NIF for Erlang & Elixir

Postman Pat

FAQ

What's Postie for?

Postie is a NIF for Erlang & Elixir that allows you to use libpostal's natural language processing algorithm to normalise and parse physical addresses. This is useful for matching or filtering addresses in your system.

What's a NIF?

NIFs (Native Implemented Functions) are one way of integrating external code into Erlang or Elixir. Postie uses the libpostal C bindings to provide an interface you can use in your projects just as if it was a regular Elixir library.

NIFs have some pretty hefty downsides though - if something goes wrong with them they can take down your entire erlang VM (!), and they can negatively effect the performance of your VM's scheduler. You can find out more about that in the bitwise project.

Installation

If available in Hex, the package can be installed as:

  1. Add postie to your list of dependencies in mix.exs:

    def deps do [{:postie, "~> 0.0.1"}] end

  2. Ensure postie is started before your application:

    def application do [applications: [:postie]] end

Usage

To parse an an address:

iex(1)> Postie.parse_address("The Book Club 100-106 Leonard St Shoreditch London EC2A 4RH, United Kingdom")
[house: "the book club", house_number: "100-106", road: "leonard st",
suburb: "shoreditch", city: "london", postcode: "ec2a 4rh",
country: "united kingdom"]

To expand an address:

iex(3)> Postie.expand_address("Quatre vingt douze R. de l'Église")
["92 rue de l'eglise", "92 r de l'eglise", "92 rue de l eglise",
"92 rue de 50 eglise", "92 r de l eglise", "92 r de 50 eglise"]

postie's People

Contributors

johnhamelink avatar

Stargazers

 avatar David.Gao avatar  avatar Patrick de Lanauze avatar Mike avatar Daniel Honig avatar

Watchers

 avatar James Cloos avatar

postie's Issues

doesn't compile on linux

hi @johnhamelink, thanks for this lib.

i was pretty happy about finding a nif for libpostal as my C abilities are pretty much nonexistent. in fact, they aren't even good enough to help me make this compile on linux. this is what i get when i try:

$ make all
Scanning dependencies of target postie.so
[ 50%] Building C object CMakeFiles/postie.so.dir/src/postie.c.o
cc: error: dynamic_lookup: No such file or directory
make[2]: *** [CMakeFiles/postie.so.dir/build.make:63: CMakeFiles/postie.so.dir/src/postie.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/postie.so.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

it would be great if you could help me out here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.