taraskevizer 9.3.0 → 9.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +1 -1
- package/dist/dict/alphabets/arabic.js +10 -9
- package/dist/dict/alphabets/latin.js +5 -4
- package/dist/dict/iawords.js +3 -2
- package/dist/dict/lib.d.ts +6 -14
- package/dist/dict/lib.js +2 -4
- package/dist/dict/softening.js +3 -2
- package/dist/dict/types.d.ts +4 -5
- package/dist/dict/wordlist.js +12 -12
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.js +2 -1
- package/dist/lib/mutating-step.d.ts +1 -1
- package/dist/lib/re.d.ts +2 -0
- package/dist/lib/re.js +2 -0
- package/dist/pipelines.d.ts +1 -12
- package/dist/pipelines.js +3 -7
- package/dist/steps/convert-alphabet.js +1 -2
- package/dist/steps/iotacize-ji.js +3 -4
- package/dist/steps/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -6,7 +6,7 @@ const printWithPrefix = (msg) => {
|
|
|
6
6
|
process.argv.splice(0, 2);
|
|
7
7
|
const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
|
|
8
8
|
if (checkForOptions(['-v', '--version'])) {
|
|
9
|
-
printWithPrefix("9.3.
|
|
9
|
+
printWithPrefix("9.3.2");
|
|
10
10
|
process.exit(0);
|
|
11
11
|
}
|
|
12
12
|
if (checkForOptions(['-h', '--help'])) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { re } from '../../lib/index.js';
|
|
2
|
+
import { callableDict } from '../lib.js';
|
|
2
3
|
const soft = '\u0652(?=[еёіюяь])';
|
|
3
4
|
const presoft = '([تزكثࢮбвгджзйклмнпрстфхцчшў])\u0652?(\u0651?)';
|
|
4
5
|
|
|
@@ -17,17 +18,17 @@ export const arabic = {
|
|
|
17
18
|
[/[Аа]/g, '\u0627а'],
|
|
18
19
|
// першая галосная, аліф
|
|
19
20
|
[/ (?=[ЕеЭэЫыУуОо])/g, ' \u0627'],
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
21
|
+
[re.gi('д\u0652з' + soft), 'ࢮ'],
|
|
22
|
+
[re.gi('з' + soft), 'ز'],
|
|
23
|
+
[re.gi('к' + soft), 'ك'],
|
|
24
|
+
[re.gi('с' + soft), 'ث'],
|
|
25
|
+
[re.gi('т' + soft), 'ت'],
|
|
25
26
|
[/([تزكث])[Іі]/g, 'ы'],
|
|
26
27
|
// $2 - шадда
|
|
27
|
-
[
|
|
28
|
-
[
|
|
28
|
+
[re.gi(presoft + '[аяэе]'), '$1$2\u064E'],
|
|
29
|
+
[re.gi(presoft + '[іы]'), '$1$2\u0650'],
|
|
29
30
|
[/ [Iі] /g, ' \u0627\u0650 '],
|
|
30
|
-
[
|
|
31
|
+
[re.gi(presoft + '[оёую]'), '$1$2\u064F'],
|
|
31
32
|
[/[ʼ]/g, 'ع'],
|
|
32
33
|
[/[Ьь]/g, ''],
|
|
33
34
|
// [/[ьʼ]/g, ''],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { iwords } from '../iwords.js';
|
|
2
|
-
import { callableDict
|
|
2
|
+
import { callableDict } from '../lib.js';
|
|
3
|
+
import { re } from '../../lib/index.js';
|
|
3
4
|
const common = {
|
|
4
5
|
lower: [
|
|
5
6
|
[
|
|
@@ -120,9 +121,9 @@ export const latinJi = {
|
|
|
120
121
|
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І Ў/g, '$1J U'],
|
|
121
122
|
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І ў/g, '$1J u'],
|
|
122
123
|
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І /g, '$1J '],
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
124
|
+
[re.g(` і(?=${iwords})`), ' ji'],
|
|
125
|
+
[re.g(` І(?=${iwords})`), ' Ji'],
|
|
126
|
+
[re.g(` І(?=${iwords.toUpperCase()})`), ' JI'],
|
|
126
127
|
...common.lower[0],
|
|
127
128
|
[/([eouaаеёіоуыэюяʼАЕЁІОУЫЭЮЯЬ] *)і/g, '$1ji'],
|
|
128
129
|
...common.lower[1],
|
package/dist/dict/iawords.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { iwords } from './iwords.js';
|
|
2
|
-
import { callableDict,
|
|
3
|
-
|
|
2
|
+
import { callableDict, toOneLine } from './lib.js';
|
|
3
|
+
import { re } from '../lib/index.js';
|
|
4
|
+
const ia = (word, words) => re.g(` ${word}(?= \\(?(?:[бвгджзйклмнпрстфхцчшўьʼ]*[оё]|${toOneLine(words).replace(/\(/g, '(?:')}|i(?:${iwords})))`);
|
|
4
5
|
export const iaWords = callableDict([
|
|
5
6
|
|
|
6
7
|
[
|
package/dist/dict/lib.d.ts
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import type { CallableDict, Dict } from './types';
|
|
2
2
|
export declare const copyDict: <T extends [any, any][]>(dict: T) => T;
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* @returns function with property `value` that references the dictionary
|
|
5
|
+
* passed as an argument.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* It is possible to change the dictionary after initialization by modifying
|
|
8
|
+
* the `value` property.
|
|
9
9
|
*
|
|
10
|
-
* @
|
|
11
|
-
* const rawDict = [
|
|
12
|
-
* ["pattern", "result"],
|
|
13
|
-
* ];
|
|
14
|
-
*
|
|
15
|
-
* const dict = dict.raw(copyDict(rawDict));
|
|
16
|
-
* // [ [ /pattern/g, "result" ] ]
|
|
10
|
+
* You can use {@link copyDict} before passing the dictionary to this function
|
|
17
11
|
*/
|
|
18
|
-
export declare const callableDict: (
|
|
12
|
+
export declare const callableDict: (value: Dict) => CallableDict;
|
|
19
13
|
export declare const toOneLine: (str: string) => string;
|
|
20
|
-
export declare const regexG: (pattern: string) => RegExp;
|
|
21
|
-
export declare const regexGI: (pattern: string) => RegExp;
|
package/dist/dict/lib.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export const copyDict = (dict) => dict.map(({ 0: pattern, 1: result }) => [pattern, result]);
|
|
2
2
|
|
|
3
|
-
export const callableDict = (
|
|
3
|
+
export const callableDict = (value) => {
|
|
4
4
|
const fn = (text) => fn.value.reduce((acc, item) => acc.replace(item[0], item[1]), text);
|
|
5
|
-
fn.value =
|
|
5
|
+
fn.value = value;
|
|
6
6
|
return fn;
|
|
7
7
|
};
|
|
8
8
|
export const toOneLine = (str) => str.replace(/\n/g, '|');
|
|
9
|
-
export const regexG = (pattern) => new RegExp(pattern, 'g');
|
|
10
|
-
export const regexGI = (pattern) => new RegExp(pattern, 'gi');
|
package/dist/dict/softening.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { callableDict
|
|
1
|
+
import { callableDict } from './lib.js';
|
|
2
|
+
import { re } from '../lib/index.js';
|
|
2
3
|
import { iwords } from './iwords.js';
|
|
3
4
|
export const noSoften = callableDict([
|
|
4
5
|
[/масфільм/g, 'мас\ue0ffфільм'],
|
|
@@ -12,7 +13,7 @@ export const softeners = callableDict([
|
|
|
12
13
|
[/с(?=[бвлмнпсфц][еёіюяь])/g, 'сь'],
|
|
13
14
|
[/ц(?=[вм][еёіюяь])/g, 'ць'],
|
|
14
15
|
[
|
|
15
|
-
|
|
16
|
+
re.g(`( (?:б[ея]|пра|цера)?з) (?=\\(?)(?=[еёюяь]|([бвзйлмнпстфц]|дз)[еёіюяь]|імі? |іх(?:ні)?|і(?:${iwords}))`),
|
|
16
17
|
'$1ь ',
|
|
17
18
|
],
|
|
18
19
|
[/([сз])ʼ(?=[яюеё])/g, '$1ь'],
|
package/dist/dict/types.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Dict<T = RegExp> = readonly (readonly [T, string])[];
|
|
2
|
+
export type CallableDict<T = RegExp> = {
|
|
2
3
|
(value: string): string;
|
|
3
|
-
value:
|
|
4
|
+
value: Dict<T>;
|
|
4
5
|
};
|
|
5
|
-
export type Dict<T = RegExp> = readonly (readonly [T, string])[];
|
|
6
|
-
export type CallableDict<T = RegExp> = Callable<Dict<T>>;
|
|
7
6
|
/**
|
|
8
7
|
* Useful if you want to modify the dictionary.
|
|
9
8
|
*
|
|
10
|
-
* Consider converting it to the type {@link CallableDict}
|
|
9
|
+
* Consider converting it to the type {@link Dict} or {@link CallableDict}
|
|
11
10
|
* if you no longer need to modify it.
|
|
12
11
|
*/
|
|
13
12
|
export type WritableDict<T = RegExp> = [T, string][];
|
package/dist/dict/wordlist.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { iaWords } from './iawords.js';
|
|
2
|
-
import { callableDict,
|
|
2
|
+
import { callableDict, re } from '../lib/index.js';
|
|
3
3
|
import { commonPhonetic } from "./phonetic.js";
|
|
4
4
|
const chemicalElements1 = [
|
|
5
5
|
'сканд|ванад|рубід|род|ірыд|рэзэрфорд',
|
|
@@ -1200,18 +1200,18 @@ export const wordlist = callableDict([
|
|
|
1200
1200
|
[/ гeлі(?=[юя] |е)/g, ' (гэ|г\ue0ffе)л'],
|
|
1201
1201
|
[/ гeліі /g, ' (гэ|г\ue0ffе)ле '],
|
|
1202
1202
|
[/ гелі/g, ' гэлі'],
|
|
1203
|
-
[
|
|
1204
|
-
[
|
|
1205
|
-
[
|
|
1206
|
-
[
|
|
1207
|
-
[
|
|
1208
|
-
[
|
|
1209
|
-
[
|
|
1210
|
-
[
|
|
1211
|
-
[
|
|
1203
|
+
[re.g(`(${chemicalElements1[0] + chemicalElements1[1]}|інд|франц|рад)ый `), '$1 '],
|
|
1204
|
+
[re.g(`(${chemicalElements1[3]})ы[ея]`), '$1а'],
|
|
1205
|
+
[re.g(`(${chemicalElements1[3]})ыю`), '$1у'],
|
|
1206
|
+
[re.g(`(${chemicalElements1[3]}|рад)ыі`), '$1зе'],
|
|
1207
|
+
[re.g(`(${chemicalElements1[2]})ыі`), '$1ы'],
|
|
1208
|
+
[re.g(`(${chemicalElements2[0]}|герман)ій`), '$1'],
|
|
1209
|
+
[re.g(`(${chemicalElements2[1]})і[ея]`), '$1а'],
|
|
1210
|
+
[re.g(`(${chemicalElements2[1]})ію`), '$1у'],
|
|
1211
|
+
[re.g(`(${chemicalElements3}| тал)ій `), '$1ь '],
|
|
1212
1212
|
[/ таліе/g, ' тале'],
|
|
1213
|
-
[
|
|
1214
|
-
[
|
|
1213
|
+
[re.g(`(${chemicalElements3})і(?=[юя] |е)`), '$1'],
|
|
1214
|
+
[re.g(`(${chemicalElements3})іі `), '$1е '],
|
|
1215
1215
|
|
|
1216
1216
|
[/(антрэпрэн|бакс|грав|грым|гіпнатыз|паз|партн|плян|прыз|рэжыс|рэзан|сап|сутэн|трас|фантаз)ёр/g, '$1эр'],
|
|
1217
1217
|
[/(біле|брэ|ман|мушке|(ім|рэ|транс|экс)пар|салі)цёр/g, '$1тэр'],
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
export * as re from './re';
|
|
1
2
|
export * from './after-tarask';
|
|
2
3
|
export * from './highlight-diff';
|
|
3
4
|
export * from './replace-g';
|
|
4
5
|
export * from './restore-case';
|
|
5
6
|
export * from './mutating-step';
|
|
6
7
|
export * from './soften';
|
|
7
|
-
export { callableDict
|
|
8
|
+
export { callableDict, copyDict } from '@/dict/lib';
|
|
8
9
|
export type * from './types';
|
package/dist/lib/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * as re from './re.js';
|
|
1
2
|
export * from './after-tarask.js';
|
|
2
3
|
export * from './highlight-diff.js';
|
|
3
4
|
export * from './replace-g.js';
|
|
4
5
|
export * from './restore-case.js';
|
|
5
6
|
export * from './mutating-step.js';
|
|
6
7
|
export * from './soften.js';
|
|
7
|
-
export { callableDict
|
|
8
|
+
export { callableDict, copyDict } from '../dict/lib.js';
|
package/dist/lib/re.d.ts
ADDED
package/dist/lib/re.js
ADDED
package/dist/pipelines.d.ts
CHANGED
|
@@ -15,12 +15,6 @@
|
|
|
15
15
|
* @module
|
|
16
16
|
*/
|
|
17
17
|
import { type TaraskStep } from './steps';
|
|
18
|
-
/**
|
|
19
|
-
* Storage for the pipeline {@link abc}.
|
|
20
|
-
*/
|
|
21
|
-
type AbcOnlyStorage = {
|
|
22
|
-
doEscapeCapitalized: boolean;
|
|
23
|
-
};
|
|
24
18
|
export type Pipeline = TaraskStep<any>[];
|
|
25
19
|
/**
|
|
26
20
|
* Pipeline for changing only the alphabet.
|
|
@@ -29,11 +23,7 @@ export type Pipeline = TaraskStep<any>[];
|
|
|
29
23
|
*
|
|
30
24
|
* To see the full list of steps, check the source code.
|
|
31
25
|
*/
|
|
32
|
-
export declare const abc: (TaraskStep<import("./steps").SpecialSyntaxStorage> | TaraskStep<import("./steps").WhiteSpaceStorage> | TaraskStep<import("./steps").TrimStorage>
|
|
33
|
-
text: string;
|
|
34
|
-
storage: AbcOnlyStorage;
|
|
35
|
-
cfg: import("./config").TaraskConfig;
|
|
36
|
-
}) => void))[];
|
|
26
|
+
export declare const abc: (TaraskStep<import("./steps").SpecialSyntaxStorage> | TaraskStep<import("./steps").WhiteSpaceStorage> | TaraskStep<import("./steps").TrimStorage>)[];
|
|
37
27
|
/**
|
|
38
28
|
* For better tree-shaking instead of `Array.prototype.flatMap`
|
|
39
29
|
*
|
|
@@ -51,4 +41,3 @@ export declare const tar: (TaraskStep<import("./steps").SplittedTextStorage> | T
|
|
|
51
41
|
* @alpha
|
|
52
42
|
*/
|
|
53
43
|
export declare const phonetic: (TaraskStep<import("./steps").SplittedTextStorage> | TaraskStep<import("./steps").SpecialSyntaxStorage> | TaraskStep<import("./steps").WhiteSpaceStorage> | TaraskStep<import("./steps").TrimStorage>)[];
|
|
54
|
-
export {};
|
package/dist/pipelines.js
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
import { highlightDiffStep, applyNoFix, convertAlphabet, convertAlphabetLowerCase, joinSplittedText, prepare, replaceIbyJ, resolveSpecialSyntax, restoreCaseStep, restoreWhitespaces, storeSplittedAbcConvertedOrig, storeSplittedText, taraskevize, phonetize, whitespacesToSpaces, trim, finalize, toLowerCase, iotacizeJi, untrim, applyG, applyVariations, } from './steps/index.js';
|
|
3
3
|
|
|
4
4
|
export const abc = [
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}),
|
|
5
|
+
(ctx) => {
|
|
6
|
+
ctx.cfg = { ...ctx.cfg, doEscapeCapitalized: false };
|
|
7
|
+
},
|
|
9
8
|
trim,
|
|
10
9
|
resolveSpecialSyntax,
|
|
11
10
|
prepare,
|
|
@@ -15,9 +14,6 @@ export const abc = [
|
|
|
15
14
|
applyNoFix,
|
|
16
15
|
finalize,
|
|
17
16
|
untrim,
|
|
18
|
-
(({ storage, cfg }) => {
|
|
19
|
-
cfg.doEscapeCapitalized = storage.doEscapeCapitalized;
|
|
20
|
-
}),
|
|
21
17
|
];
|
|
22
18
|
|
|
23
19
|
export const _createPipeline = (subPipeline) => [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { mutatingStep } from '../lib/index.js';
|
|
2
|
-
import * as debug from '../lib/debug.js';
|
|
3
2
|
export const convertAlphabet = mutatingStep(({ text, cfg: { abc: { upper, lower }, }, }) => {
|
|
4
3
|
text = lower(text);
|
|
5
|
-
return upper ?
|
|
4
|
+
return upper ? upper(text) : text;
|
|
6
5
|
});
|
|
7
6
|
export const convertAlphabetLowerCase = mutatingStep(({ text, cfg: { abc: { lower }, }, }) => lower(text));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { iwords } from '../dict/index.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const iDict = dict([
|
|
2
|
+
import { callableDict, mutatingStep, re } from '../lib/index.js';
|
|
3
|
+
const iDict = callableDict([
|
|
5
4
|
[/([аеёіоуыэюя\u0301] )і ў/g, '$1й у'],
|
|
6
5
|
[/([аеёіоуыэюя\u0301] )і /g, '$1й '],
|
|
7
6
|
[/([аеёіоуыэюя\u0301] ?)і/g, '$1йі'],
|
|
8
|
-
[
|
|
7
|
+
[re.g(` і(?=${iwords})`), ' йі'],
|
|
9
8
|
]);
|
|
10
9
|
export const iotacizeJi = mutatingStep(({ text }) => iDict(text));
|
package/dist/steps/types.d.ts
CHANGED