1.0.6 • Published 3 years ago
kurdish-numbers-to-words v1.0.6
Kurdish Numbers to Words
A NPM package converts the numbers to Kurdish (Kurmanji - Sorani) words. https://www.npmjs.com/package/kurdish-numbers-to-words Example:
187262 ==> `sed û heştê û heft hezar û dused û şêst û du` //Kurmanji
187262 ==> `سەد و هەشتا و حەوت هەزار و دووسەد و شەست و دوو` //Sorani
Installation:
- With
npm
:
npm i kurdish-numbers-to-words
- With
yarn
:
yarn add kurdish-numbers-to-words
Usage:
- Import the package:
import KurdishKurmanjiNumbersToWords from 'kurdish-numbers-to-words/Kurmanji.js'
import KurdishSoraniNumbersToWords from 'kurdish-numbers-to-words/Sorani.js'
- Use it:
let numberWords = KurdishKurmanjiNumbersToWords.convert(9876)
let numberWordsSorani = KurdishSoraniNumbersToWords.convert(9876)
console.log(numberWords)
console.log(numberWordsSorani)
Result:
neh hezar û heştsed û heftê û şeş
نۆ هەزار و هەشتسەد و حەفتا و شەش
Test:
You can test it using Mocha
:
npm test
How does it work?
It depends on the following rules:
- Digits from zero to nine are specific words, namely sifir 0, yek 1, du/didu 2, sê/sisê 3, çar 4, pênc 5, şeş 6, heft 7, heşt 8, and neh 9.
- Numbers from eleven to nineteen are made by setting the unit digit root before the word for ten (deh), with no space: yanzdeh/yazde(h) 11, dwanzdeh 12, sêzdeh 13, çardeh 14, panzdeh/pazdeh 15, şanzdeh/şazdeh 16, hivdeh 17, hijdeh 18, and nozdeh 19.
- The tens have specific names based on the multipliers digits roots, except for ten and twenty: deh 10, bîst 20, sî 30, çil 40, pêncî 50, şêst 60, heftê 70, heştê 80, and nod 90.
- The hundreds are built by telling the multiplier digit, then the word for hundred (sed), with no space (e.g.: pêncsed 500, şeşsed 600).
- The thousands are built by telling the multiplier digit, then the word for thousand (hezar), with an exception for five thousand (e.g.: çar hezar 4,000, pênj hezar 5,000, şeş hezar 6,000).
- Compound numbers are built by spelling out the ten, then the digit, united with the word û (e.g.: sî û du 32, heftê û yek 71). The rule is the same between hundred and ten or unit, and between thousand and hundred (e.g.: sed û yek 101, hezar û dused 1,200).
- There are also specific words for one hundred thousand (lek 100,000), and five hundred thousands (kirûr 500,000).
- One million is milyon.
- From one milyon to less than one billion works the same way as thousands (the 5's rule included)
- One billion is milyar
- More than 1 billion will be spelled a number by number
- The same rules applies for the Sorani version Most of these rules are from: Of Languages and Numbers