1.0.9 • Published 2 years ago

word2number_turkish v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

word2number_turkish

NPM version

It is a Javascript library that converts numbers written with words to digits.

Installation

npm install --save word2number_turkish

Usage in Backend

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 } ]

Usage in Frontend

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.

Test

https://endrcn.github.io/word2number_turkish/

To Do

  • 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.

Unit Test Status

Total: 51

51 success

100%

Author

Ender CAN

License

Open sourced under the MIT license.

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago