<commit_before>"!{float:right}https://secure.travis-ci.org/floere/phony.png!":http://travis-ci.org/floere/phony

h1. Phony

Used in e.g.: "airbnb.com":http://airbnb.com, "restorm.com":http://restorm.com, "socialcam.com":http://socialcam.com, "zendesk.com":http://www.zendesk.com/ (and many, many others).

There's also a Rails wrapper: https://github.com/joost/phony_rails.

h2. Description

This gem can normalize, format and split E164 numbers.
"More about E164 numbers in this Wiki":http://en.wikipedia.org/wiki/E.164.

The (admittedly crazy) *goal* of this Gem is to be able to format/split all phone numbers in the world.

Currently handles Afghan, Algerian, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Croatian, Cuban, Czech, Danish, Dutch, Egyptian, French, German, Ghanan, Greek, Hungarian, Italian, Irish, Lithuanian, Malaysian, Mexican, New Zealand, Norwegian, Peruvian, Polish, Russian, Romanian, Singapore, Slovakian, South African, South Korean, Spanish, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, and Vietnamese numbers.
And to some extent, all others. Just try if it works for you.

If it doesn't, please "enter an issue":http://github.com/floere/phony/issues.

h2. Installation

<pre><code>gem install phony</code></pre>

h2(#examples). Some examples

h3(#plausibility). Plausibility

"Plausible" means "seems reasonable or probable", not implying 100% correctness on a @true@, but implying 100% correctness on a @false@ return value. So if this returns @true@, it might still be not a plausible number. If it returns @false@, it is definitely not an E164 conform number.

Use this method in combination with @normalize@ for saving it into the database. Also see https://github.com/floere/phony/issues/35 for a discussion on the topic.

Note that you can add constraints to the plausibility check like the country code, @cc@, and the national destination code, @ndc@. Use the options to further limit the plausibility range. For example, only allow a small number of countries.

@Phony.plausible?('0000000').should be_false@
<commit_msg>- Russia from README (thanks glebm for the hint!)<commit_after>"!{float:right}https://secure.travis-ci.org/floere/phony.png!":http://travis-ci.org/floere/phony

h1. Phony

Used in e.g.: "airbnb.com":http://airbnb.com, "restorm.com":http://restorm.com, "socialcam.com":http://socialcam.com, "zendesk.com":http://www.zendesk.com/ (and many, many others).

There's also a Rails wrapper: https://github.com/joost/phony_rails.

h2. Description

This gem can normalize, format and split E164 numbers.
"More about E164 numbers in this Wiki":http://en.wikipedia.org/wiki/E.164.

The (admittedly crazy) *goal* of this Gem is to be able to format/split all phone numbers in the world.

Currently handles Afghan, Algerian, Austrian, Australian, Belgian, Brazilian, Chilean, Chinese, Croatian, Cuban, Czech, Danish, Dutch, Egyptian, French, German, Ghanan, Greek, Hungarian, Italian, Irish, Lithuanian, Malaysian, Mexican, New Zealand, Norwegian, Peruvian, Polish, Romanian, Singapore, Slovakian, South African, South Korean, Spanish, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, and Vietnamese numbers.
And to some extent, all others. Just try if it works for you.

If it doesn't, please "enter an issue":http://github.com/floere/phony/issues.

h2. Installation

<pre><code>gem install phony</code></pre>

h2(#examples). Some examples

h3(#plausibility). Plausibility

"Plausible" means "seems reasonable or probable", not implying 100% correctness on a @true@, but implying 100% correctness on a @false@ return value. So if this returns @true@, it might still be not a plausible number. If it returns @false@, it is definitely not an E164 conform number.

Use this method in combination with @normalize@ for saving it into the database. Also see https://github.com/floere/phony/issues/35 for a discussion on the topic.

Note that you can add constraints to the plausibility check like the country code, @cc@, and the national destination code, @ndc@. Use the options to further limit the plausibility range. For example, only allow a small number of countries.

@Phony.plausible?('0000000').should be_false@

{'fraction_non_alphanumeric': 0.11158292050011795, 'fraction_numerical': 0.01509790044821892, 'mean_word_length': 4.963431786216597, 'pattern_counts': {'":': 14, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '6459746', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1247, 'n_words': 505}