It is a Javascript library that converts numbers written with words to digits.
npm install --save word2number_turkish
const word2Number = require("word2number_turkish");
console.log(word2Number.convert("yüzaltmışyedi"));
You can extract numbers' indexes from sentences.
const word2Number = require("word2number_turkish");
let words = word2Number.splitSentenceToWords("sekizyüz on iki milyar üç yüz kırk dört milyon beşyüz yetmişikibin dörtyüz bir lira otuz iki kuruş");
console.log(word2Number.findNumbersIndexes(words));
// Output: [ { startIndex: 0, endIndex: 17 }, { startIndex: 19, endIndex: 20 } ]
Put the script(client/word2number_turkish.js) between the head tags in your website. After that you can use the library.
<script src="./client/word2number_turkish.js"></script>
<script>
const word2Number = new Word2Number();
console.log(word2Number.convert("yüzyetmişiki lira on iki nokta üç kuruş"));
</script>
The word2number_turkish library was developed using ES6 classes.
https://endrcn.github.io/word2number_turkish/
- Handling all written numbers.
- Handling phone numbers.
- Handling zero number.
- Handling numbers that next to each other.
- Handling both numeric and written numbers.
- Handling Dates.
- Handling Decimal numbers.
- Fuzzy matching.
- Handling half numbers.
Total: 54
52 success, 2 fail
- "26FZ6A" is changed to "0 26fz 6 a"
- "2bin60" is changed to "2 bin60"
Ender CAN
Open sourced under the MIT license.