Giter Club home page Giter Club logo

node-postal's Introduction

node-postal

These are the NodeJS bindings to https://github.com/openvenues/libpostal, a fast, multilingual NLP library for parsing/normalizing physical addresses. libpostal is written in C because virtually every other language can bind to C.

We're supporting official NodeJS mostly because Pelias (https://github.com/pelias), Mapzen's geocoder, is written in Node, but also because it's an awesome, ubiquitous language that's immensely popular among folks in the geo world.

Installation

Before using the Node bindings, you must install libpostal first. Make sure you have the following prerequisites:

On Linux (Ubuntu)

sudo apt-get install libsnappy-dev autoconf automake libtool

On Mac OSX

sudo brew install snappy autoconf automake libtool

Installing libpostal

git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure --datadir=[...some dir with a few GB of space...]
make
sudo make install

# On Linux it's probably a good idea to run
sudo ldconfig

Installing node-gyp on Linux (Ubuntu)

First make sure you have:

  1. gcc, g++ and make (sudo apt-get install build-essential on Ubuntu)
  2. NodeJS with all the development headers (if using a package manager like apt-get, follow the instructions here: https://nodejs.org/en/download/package-manager/)
  3. python 2.7

Then install node-gyp system-wide:

sudo npm install -g node-gyp

Installing the Node bindings

npm install openvenues/node-postal

Usage

var postal = require('node-postal');

// Expansion API
postal.expand.expand_address('V XX Settembre, 20', {languages: ['it']})

// Parser API
postal.parser.parse_address('Mayfield 688 Franklin Ave, Crown Heights, Brooklyn, NY 11238')

Compatibility

The C++ bindings are written using Nan (https://github.com/nodejs/nan), which abstracts many of the API changes across versions of V8. That should keep node-postal compatible

If you're having trouble compiling, post a Github issue with your OS and Node versions along with the output of npm install / node-gyp rebuild.

Tests

To run the unit tests:

npm test

Special Thanks

Lucas Hrabovsky (https://github.com/imlucas) for information and examples of repos using Nan, node-gyp, etc.

node-postal's People

Contributors

albarrentine avatar

Watchers

 avatar

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.