Node application for a localized written number parsing, thought for being easily translated.
You can check out a demonstration of the component on its webpage.
Using NPM (Node Packaged Modules)
npm install readint
npm install component component install nmussy/readint
Here's a list of the supported locales:
Translation files structure
All fields are mandatory, even if empty.
split(string, regex) – Used to
.split()the input string into number tokens.
replace(array) – Contains arrays used as parameters by the
- (string, regex) – Value that will be replaced.
- (string) – Value that will replace the searched value.
LTRlevels(array) – Contains the levels that have to be read from left to right (for an explanation of what a level is, see the next field.) e.g., in English, the Level 1 is read from left to right (seventeen:
7 + 10), unlike French (dix-sept:
10 + 7)
values(array) – Contains the written numbers of the language, ordered by ascending level. To simplify the translation and the execution, the given string number is tokenized, and each token is assigned its numbered value, and the level in which it is contained. Each level contains the level beneath it. The level 0 is used for digits and exceptions.
- (object) –
- (object) –