Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GooseOb/taraskevizer
Belarusian orthography converter - NPM package
https://github.com/GooseOb/taraskevizer
Last synced: about 1 hour ago
JSON representation
Belarusian orthography converter - NPM package
- Host: GitHub
- URL: https://github.com/GooseOb/taraskevizer
- Owner: GooseOb
- License: mit
- Created: 2023-08-02T17:33:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-18T16:22:32.000Z (6 months ago)
- Last Synced: 2024-05-22T23:33:07.870Z (6 months ago)
- Language: TypeScript
- Homepage: https://gooseob.github.io/taraskevizatar/
- Size: 1.69 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- Awesome-Belarusian - taraskevizer - Belarusian orthography converter - NPM package (<a name="repositories"></a> Рэпазыторыі з зыходным кодам ##)
README
[Go to full API documentation](https://gooseob.github.io/taraskevizer/)
# Install
With npm:
```bash
npm install taraskevizer
```With yarn:
```bash
yarn add taraskevizer
```With bun:
```bash
bun add taraskevizer
```# Usage
```js
import {
tarask,
pipelines,
TaraskConfig,
htmlConfigOptions,
ansiColorWrappers,
alphabets,
REPLACE_J,
VARIATION,
} from 'taraskevizer';tarask('планета', pipelines.tar);
// "плянэта"const cfg = new TaraskConfig({
abc: alphabets.cyrillic,
j: 'always',
variations: 'first',
wrapperDict: ansiColorWrappers,
g: true,
});
tarask('планета і Гродна', pipelines.tar, cfg);
// "пл\x1b[32mя\x1b[0mн\x1b[32mэ\x1b[0mта \x1b[32mй\x1b[0m \x1b[35mГорадня\x1b[0m"const htmlCfg = new TaraskConfig({
abc: alphabets.latin,
g: false,
...htmlConfigOptions,
});
tarask('энергія планеты', pipelines.tar, htmlCfg);
// "energija planety"const latinWithJiCfg = new TaraskConfig({
abc: alphabets.latinJi,
});tarask('яна і іншыя', pipelines.abcOnly, latinWithJiCfg);
// "jana j jinšyja"
```# HTML tags
## tarF
Difference between the input and the output word.
```html
this_part_of_word_is_fixedплян
```## tarL
A part of a word wrapped in this tag is variable,
variations are mentioned in a `data-l` attribute,
separated with commas.```html
variation1Гродна
```## tarH
May be toggled between `г`(`h`) and `ґ`(`g`).
Appears only if alphabet is cyrillic.```html
гГвалт
```# Special Syntax
| | fix | no fix | change only alphabet |
| ----------- | ------------ | ------------ | -------------------- |
| brackets | `<,Планета>` | `<Планета>` | `<*Планета>` |
| no brackets | `Планета` | `<.Планета>` | `<*.Планета>` |# CLI
## Install
With npm:
```bash
npm install -g taraskevizer
```With yarn:
```bash
yarn global add taraskevizer
```With bun:
```bash
bun add -g taraskevizer
```## Usage
```bash
tarask [options] text
```For usage examples and options use `--help` option
(in source, content of `--help` is in [this file](./cli-help.txt))### "Without installation"
With npm:
```bash
npx taraskevizer [options] text
```With bun:
```bash
bunx taraskevizer [options] text
```# Known bugs
## Replacing `не` with `ня`
`Ня` should appear before a word where the first syllabe is stressed.
At the moment, there is no way to check exactly if it is stressed.
Algorithm makes some heuristics, but that's not enough to cover all cases.