<commit_before># ruby_postal

[![Build Status](https://travis-ci.org/openvenues/ruby_postal.svg?branch=master)](https://travis-ci.org/openvenues/ruby_postal) [![Gem version](https://img.shields.io/gem/v/ruby_postal.svg)](https://rubygems.org/gems/ruby_postal)

These are the Ruby bindings to [libpostal](https://github.com/openvenues/libpostal) for
fast street address parsing and normalization.

## Usage

To expand address strings into normalized forms suitable for geocoder queries:

```ruby
require 'ruby_postal/expand'
Postal::Expand.expand_address('Quatre-vingt-douze Ave des Ave des Champs-Élysées')
```

To parse addresses into components:

```ruby
require 'ruby_postal/parser'
Postal::Parser.parse_address('781 Franklin Ave Crown Heights Brooklyn NY 11216 USA')
```

## Prerequisites

Before using the Ruby bindings, you must install the libpostal C library. Make sure you have the following prerequisites:

**On Linux (Ubuntu)**
```
sudo apt-get install libsnappy-dev autoconf automake libtool pkg-config
```

**On Mac OSX**
```
sudo brew install snappy autoconf automake libtool pkg-config
```

**Installing libpostal**

```
git clone https://github.com/openvenues/libpostal<commit_msg>[docs][ci skip] README update<commit_after># ruby_postal

[![Build Status](https://travis-ci.org/openvenues/ruby_postal.svg?branch=master)](https://travis-ci.org/openvenues/ruby_postal) [![Gem version](https://img.shields.io/gem/v/ruby_postal.svg)](https://rubygems.org/gems/ruby_postal)

These are the Ruby bindings to [libpostal](https://github.com/openvenues/libpostal) for
fast street address parsing and normalization.

## Usage

To expand address strings into normalized forms suitable for geocoder queries:

```ruby
require 'ruby_postal/expand'
Postal::Expand.expand_address('Quatre-vingt-douze Ave des Ave des Champs-Élysées')
```

To parse addresses into components:

```ruby
require 'ruby_postal/parser'
Postal::Parser.parse_address('781 Franklin Ave Crown Heights Brooklyn NY 11216 USA')
```

## Prerequisites

Before using the Ruby bindings, you must install the libpostal C library. Make sure you have the following prerequisites:

**On Ubuntu/Debian**
```
sudo apt-get install curl libsnappy-dev autoconf automake libtool pkg-config
```

**On CentOS/RHEL**
```
sudo yum install snappy snappy-devel autoconf automake libtool pkgconfig
```

**On Mac OSX**
```
sudo brew install snappy autoconf automake libtool pkg-config
```

**Installing libpostal**

```
git clone https://github.com/openvenues/libpostal
{'fraction_non_alphanumeric': 0.12365805168986084, 'fraction_numerical': 0.006361829025844931, 'mean_word_length': 5.781671159029649, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4751543', 'n_tokens_mistral': 888, 'n_tokens_neox': 789, 'n_words': 223}