Coder Social home page Coder Social logo

Comments (3)

bogdanRada avatar bogdanRada commented on August 18, 2024

maybe this number should not be considered plausible or this is a issue with normalization. I am not exactly sure so please let me know what should it be and how can be fixed if there is any solution. Thank you very much.

from phony.

floere avatar floere commented on August 18, 2024

Hi Bogdan,

That is one strange number – looking at http://en.wikipedia.org/wiki/Telephone_numbers_in_Egypt I can tell it does not really exist. Would you agree?

Plausible only tells you with 100% certainty that a number is wrong (https://github.com/floere/phony#plausibility). As an FYI. Here, it probably should return false, you're right.

Regarding normalize:
In all (I've seen) countries, zeroes after the country code indicate a trunk prefix (http://en.wikipedia.org/wiki/Trunk_prefix), with the exception of North American Codes. And there is usually the one zero. Followed by something that is not a trunk code number (most times not zero). People sometimes accidentally type in another zero, which normalize conveniently cleans up for them. This is what happened in your case. I decided to err on the side of convenience.

Btw, the latest code uses country specific trunk codes: https://github.com/floere/phony/blob/master/lib/phony/national_code.rb#L33 (Documentation not yet updated).

To sum up:

  • We should check for too many trunk code numbers and return plausible false if there is more than one.
  • Phony.plausible? can do only so much, sometimes numbers are just incorrect. Not often so, but how would it know that some number does not exist.

Cheers & thanks,
Florian

from phony.

bogdanRada avatar bogdanRada commented on August 18, 2024

thanks for the quick response. I agree that number might not exist but is just an example .
I do understand now the use of the trunk codes and you are probably right.
Thanks for the update.

from phony.

Related Issues (20)

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.