6.1.0 • Published 4 days ago

taraskevizer v6.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

Install

With npm:

npm install taraskevizer

With yarn:

yarn add taraskevizer

With bun:

bun add taraskevizer

Usage

import { Taraskevizer, ALPHABET, J, VARIATION } from 'taraskevizer';

const taraskevizer = new Taraskevizer();
taraskevizer.convert('планета');
// "плянэта"

const taraskevizer = new Taraskevizer({
	general: {
		abc: ALPHABET.CYRILLIC,
		j: J.ALWAYS,
	},
	nonHtml: {
		ansiColors: true,
		variations: VARIATION.FIRST,
		h: false,
	},
});
taraskevizer.convert('планета і Гродна');
// "пл\x1b[32mя\x1b[0mн\x1b[32mэ\x1b[0mта \x1b[32mй\x1b[0m \x1b[35mГорадня\x1b[0m"

const taraskevizer = new Taraskevizer({
	general: {
		abc: ALPHABET.LATIN,
	},
	html: {
		g: false, // ignored, because alphabet is set to latin
	},
});
taraskevizer.convertToHtml('энергія планеты');
// "en<tarF>erg</tarF>ija p<tarF>lan</tarF>ety"

// properties can be rewritten after creating an object
taraskevizer.general.abc = ALPHABET.ARABIC;
taraskevizer.html.g = true;

const latinizerWithJi = new Taraskevizer({
	general: { abc: ALPHABET.LATIN_JI },
});

latinizerWithJi.convertAlphabetOnly('яна і іншыя');
// "jana j jinšyja"

Options

general

Type: object

abc

Type: number

Default value: 0

ValueAlphabet of output text
0cyrillic
1latin
2arabic
3latin with ji

j

Type: number

Default value: 0

ValueWhen to replace і(i) by й(j) after vowelsExample
яна і ён
0neverяна і ён
1randomяна і ён or яна й ён
2alwaysяна й ён

Has no effect with LATIN_JI alphabet.

doEscapeCapitalized

Type: boolean

Default true

If set to false, may cause unwanted changes in acronyms.

Is always true in convertAlphabetOnly.

taraskevize

Type: (text: string) => string

Default value: internal function taraskevize

Overriddes internal function in order to change behaviour of taraskevization. This function usually uses private api via __tarask__

html

g

Type: boolean

Default value: false

Do replace г(h) by ґ(g) in cyrillic alphabet?

ValueExample
true<tarH>г</tarH>валт <tarH>Г</tarH>валт
false<tarH>ґ</tarH>валт <tarH>Ґ</tarH>валт

nonHtml

ansiColors

Type: boolean

Default value: false

h

Type: boolean

Default value: false

Do replace ґ(g) by г(h) in cyrillic alphabet?

ValueExample
trueҐвалт ґвалт
falseГвалт гвалт

variations

Type: number

Default value: 0

ValueWhich variation is used if a part of word is variableExample
Гродна
0mainГродна
1firstГорадня
2all(Гродна|Горадня)

HTML tags

tarF

Difference between an input and an output word.

<tarF>this_part_of_word_is_fixed</tarF>

пл<tarF>я</tarF>н

tarL

A part of a word wrapped in this tag is variable, variations are mentioned in a data-l attribute and are separated by commas

<tarL data-l="variation2,variation3">variation1</tarL>

<tarL data-l="Горадня">Гродна</tarL>

tarH

Can be replaced by ґ(g) letter. appears only if alphabet is cyrillic

<tarH>г</tarH>

<tarH>Г</tarH>валт

Special Syntax

fixno fixchange only alphabet
brackets<,Планета><Планета><*Планета>
no bracketsПланета<.Планета><*.Планета>

CLI

Install

With npm:

npm install -g taraskevizer

With yarn:

yarn global add taraskevizer

With bun:

bun add -g taraskevizer

Usage

tarask [options] text

For usage examples and options use --help option (in source, content of --help is in this file)

"Without installation"

With npm:

npx taraskevizer [options] text

With bun:

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.

6.1.0

4 days ago

6.0.10

4 days ago

6.0.9

5 days ago

6.0.8

5 days ago

6.0.7

7 days ago

6.0.6

7 days ago

6.0.3

8 days ago

6.0.5

8 days ago

6.0.4

8 days ago

6.0.1

12 days ago

6.0.0

12 days ago

6.0.2

12 days ago

5.3.3

13 days ago

5.3.2

13 days ago

5.3.1

14 days ago

5.3.0

14 days ago

5.2.6

15 days ago

5.2.5

15 days ago

5.2.4

15 days ago

5.2.3

15 days ago

5.2.2

15 days ago

5.2.1

17 days ago

5.2.0

17 days ago

5.1.10

17 days ago

5.1.9

17 days ago

5.1.5

22 days ago

5.1.4

22 days ago

5.1.3

22 days ago

5.1.8

22 days ago

5.1.7

22 days ago

5.1.6

22 days ago

5.1.2

1 month ago

5.1.1

2 months ago

5.1.0

2 months ago

5.0.4

2 months ago

5.0.3

2 months ago

5.0.2

2 months ago

5.0.1

2 months ago

5.0.0

2 months ago

4.1.0

2 months ago

4.1.1

2 months ago

4.0.0

3 months ago

3.1.3

3 months ago

3.1.2

3 months ago

3.1.1

3 months ago

3.1.0

3 months ago

3.0.0

4 months ago

3.0.0-alpha.1

4 months ago

3.0.0-alpha.2

4 months ago

2.1.2

5 months ago

2.1.1

5 months ago

2.1.0

5 months ago

2.0.3

6 months ago

2.0.2

6 months ago

2.0.4

5 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.7.5

6 months ago

1.7.4

6 months ago

1.7.3

6 months ago

1.7.2

6 months ago

1.6.3

7 months ago

1.7.1

6 months ago

1.6.2

7 months ago

1.7.0

6 months ago

1.6.1

7 months ago

1.6.0

7 months ago

1.5.3

8 months ago

1.5.2

8 months ago

1.5.1

8 months ago

1.5.0

9 months ago

1.4.5

9 months ago

1.4.4

9 months ago

1.4.3

9 months ago

1.4.2

9 months ago

1.4.1

9 months ago

1.4.0

9 months ago

1.3.4

9 months ago

1.3.3

9 months ago

1.3.2

9 months ago

1.3.1

9 months ago

1.3.0

9 months ago

1.2.3

9 months ago

1.2.2

9 months ago

1.2.1

9 months ago

1.2.0

9 months ago

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago