Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tooleks/shevchenko-js
JavaScript library for declension of Ukrainian anthroponyms
https://github.com/tooleks/shevchenko-js
ablative accusative anthroponym-declension dative declension family-name-declension first-name-declension genitive given-name-declension locative nominative patronymic-declension patronymic-name-declension personal-name-declension surname-declension ukrainian ukrainian-language vocative word-declension word-inflection
Last synced: 4 days ago
JSON representation
JavaScript library for declension of Ukrainian anthroponyms
- Host: GitHub
- URL: https://github.com/tooleks/shevchenko-js
- Owner: tooleks
- License: mit
- Created: 2017-08-04T17:41:41.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-04T17:28:24.000Z (9 months ago)
- Last Synced: 2024-04-14T04:48:02.189Z (8 months ago)
- Topics: ablative, accusative, anthroponym-declension, dative, declension, family-name-declension, first-name-declension, genitive, given-name-declension, locative, nominative, patronymic-declension, patronymic-name-declension, personal-name-declension, surname-declension, ukrainian, ukrainian-language, vocative, word-declension, word-inflection
- Language: TypeScript
- Homepage: https://shevchenko-js.tooleks.com/
- Size: 47.5 MB
- Stars: 69
- Watchers: 2
- Forks: 3
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# shevchenko.js
JavaScript library for declension of Ukrainian anthroponyms.
[![NPM Version](https://img.shields.io/npm/v/shevchenko?label=release)](https://github.com/tooleks/shevchenko-js/releases)
[![NPM Downloads](https://img.shields.io/npm/dm/shevchenko?label=npm%20downloads)](https://www.npmjs.com/package/shevchenko)
[![Docker Pulls](https://img.shields.io/docker/pulls/tooleks/shevchenko)](https://hub.docker.com/r/tooleks/shevchenko)## Links
* [Try it out](https://shevchenko-js.tooleks.com/en-US) / [Демонстрація](https://shevchenko-js.tooleks.com)
* [API Specification](https://shevchenko-js.tooleks.com/api-spec)
* [Source Code](https://github.com/tooleks/shevchenko-js)
* [License](https://github.com/tooleks/shevchenko-js/blob/main/LICENSE)
* [Migration Guide (v2 → v3)](https://github.com/tooleks/shevchenko-js/wiki/Migration-Guide)## Extensions
* [Military extension](https://github.com/tooleks/shevchenko-ext-military) - declension of Ukrainian military ranks and appointments
## User Guide
### Installation
#### npm
To install the library using [npm](https://docs.npmjs.com) package manager, use the following command:
```bash
npm install --save shevchenko
```### Import
The library comes in three formats: CommonJS module, ECMAScript module, and a minified UMD bundle. You can select the format that best suits your needs.
#### CommonJS
To import the library as a CommonJS module, use the following code:
```JavaScript
const shevchenko = require('shevchenko');
```#### ECMAScript
To import the library as an ECMAScript module, use the following code:
```JavaScript
import * as shevchenko from 'shevchenko';
```#### UMD
To import the library as a UMD bundle, include the following script tag in your HTML code:
```HTML
<script type="text/javascript" src="https://unpkg.com/shevchenko"></script>
```### Use Cases
#### Personal names declension
This example shows how to use the library to decline Ukrainian anthroponyms.
```JavaScript
const shevchenko = require('shevchenko');async function main() {
const input = {
gender: 'masculine',
givenName: 'Тарас',
patronymicName: 'Григорович',
familyName: 'Шевченко'
};const output = await shevchenko.inVocative(input);
console.log(output); // { givenName: "Тарасе", patronymicName: "Григоровичу", familyName: "Шевченку" }
}main().catch((error) => console.error(error));
```#### Automatic grammatical gender detection
This example shows how to use the library to automatically detect the grammatical gender of a Ukrainian anthroponym.
```JavaScript
const shevchenko = require('shevchenko');async function main() {
const anthroponym = {
givenName: 'Лариса',
patronymicName: 'Петрівна',
familyName: 'Косач-Квітка'
};const gender = await shevchenko.detectGender(anthroponym); // "feminine"
if (gender == null) {
throw new Error('Failed to detect grammatical gender.');
}const input = { ...anthroponym, gender };
const output = await shevchenko.inVocative(input);
console.log(output); // { givenName: "Ларисо", patronymicName: "Петрівно", familyName: "Косач-Квітко" }
}main().catch((error) => console.error(error));
```#### Usage via HTTP API
The library can be integrated into your project via HTTP API. Please refer to [shevchenko](https://hub.docker.com/r/tooleks/shevchenko) Docker image for the additional instructions.