Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/timursaurus/sandar
Kyrgyz / Kazakh numbers-to-words converter
https://github.com/timursaurus/sandar
converter kazakh kyrgyz latin words-to-numbers
Last synced: 2 months ago
JSON representation
Kyrgyz / Kazakh numbers-to-words converter
- Host: GitHub
- URL: https://github.com/timursaurus/sandar
- Owner: timursaurus
- License: mit
- Created: 2022-02-18T18:29:47.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T04:13:29.000Z (about 2 years ago)
- Last Synced: 2024-10-02T02:59:58.815Z (3 months ago)
- Topics: converter, kazakh, kyrgyz, latin, words-to-numbers
- Language: TypeScript
- Homepage:
- Size: 177 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kyrgyz-nlp - Number-to-words conversion
README
## Install
```bash
npm i sandar
```import:
```js
//CommonJS
const { toWord, ... } = require('sandar')//ESM
import { toOrdinal, ... } from 'sandar'
```## Usage
- Passing number as `string` is recommended.
### `toWord`
Returns the textual representation of a given number.
```js
toWord(123) //=> 'жүз жыйырма үч'toWord(456, { lang: 'ky' }) //=> 'төрт жүз элүү алты'
toWord('789', 'kk-latin') //=> 'jetı jüz seksen toğyz'
toWord('123456789101112131415') //=> 'жүз жыйырма үч секстиллион төрт жүз элүү алты квадриллион жети жүз сексен тогуз триллион жүз бир миллиард жүз он эки миллион жүз отуз бир миң төрт жүз он беш'
```
### `toOrdinal`
Returns the textual ordinal representation of a given number.
```js
toOrdinal(123) //=> 'жүз жыйырма үчүнчү'
toOrdinal(456, { lang: 'kk' }) //=> 'төрт жүз елу алтыншы'
toOrdinal('789', 'kk-latin') //=> 'jetı jüz seksen toğyzınşı'toOrdinal('123456789101112131415') //=> 'жүз жыйырма үч секстиллион төрт жүз элүү алты квадриллион жети жүз сексен тогуз триллион жүз бир миллиард жүз он эки миллион жүз отуз бир миң төрт жүз он бешинчи'
```### `Sandar` class
By invoking `Sandar` class, further specifying of the language is not needed
```js
import { Sandar } from 'sandar'// const san = new Sandar() Kyrgyz language `ky` is set by default, if language is not specified
const san = new Sandar('kk-latin')// from now on instance of class will always return the output in the speficied language
san.toWord(123) //=> 'jüz jiyrma üş'san.lang = 'kk' // `.lang` is a setter and a getter.п
san.toOrdinal(456) //=> 'төрт жүз елу алтыншы'
```
## Licence
[MIT](./LICENSE)