GithubHelp home page GithubHelp logo

words2number's Introduction

Words to number converter

This program converts words into a number for any Indo-European language.

It works for any language that follows decimal rules and grouping by tens, hundreds, thousands, millions and so on. See https://www.languagesandnumbers.com/numbering-systems/en/ and http://villemin.gerard.free.fr/Wwwgvmm/Numerati/Langue.htm for a lot more.

For instance,

  • thirteen million, seven hundred and eighty-four thousand, three hundred and sixty-three,
  • treize millions sept cent quatre-vingt-quatre mille trois cent soixante-trois (in french),
  • tredici milioni settecentottantaquattromila trecentosessantatré (in italian),
  • dreizehn Millionen siebenhundertvierundachtzigtausenddreihundertdreiundsechzig (in german),
  • trece millones setecientos ochenta y cuatro mil trescientos sesenta y tres (in spanish),
  • treze milhões setecentos e oitenta e quatro mil trezentos e sessenta e três (in portuguese)
  • тринадцать миллион, семьсот восемьдесят четыре тысячи, триста шестьдесят три (in russian)
  • trzynaście miliony siedemset osiemdziesiąt cztery tysiące trzysta sześćdziesiąt trzy (in polish)

will all be converted to 13,784,363.

Type make to see those examples in action.

Then, try:

> LANGUAGE=fr_FR ./l2d_i18n cent quatre-vingt trois
> LANGUAGE=it_IT ./l2d_i18n centottantatré
> LANGUAGE=de_DE ./l2d_i18n hundertdreiundachtzig

To support a specific language, just fill in a .po file containing the wording for this language (gettext is used behind the scene) following these steps:

  1. add a unit tests block TU_ll_CC in Makefile (where ll is a language code and CC is a country code, as listed by locale -a),
  2. run make (this will result in an error),
  3. fill in the newly created file po/ll_CC.po as needed with the specific words for numbers (in various forms) for the given language, and
  4. rerun make (this will be successful if step 3 has been completed correctly).

Look at examples in Makefile and po for steps 1 and 3.

The coding is simple and straight forward (the C language helps for that).

It converts correctly any syntactically correct number.

But it should be noticed that it would also convert uncorrect wording for numbers (following implementation defined specific rules).

Have fun and just let me know of any irrelevant results.

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.