taraskevizer 10.1.13 → 10.2.1
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/wordlist.js +7 -7
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/pipe.d.ts +11 -0
- package/dist/lib/pipe.js +16 -0
- package/dist/pipelines.d.ts +6 -16
- package/dist/pipelines.js +5 -20
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -7,7 +7,7 @@ process.argv.splice(0, 2);
|
|
|
7
7
|
const firstArg = process.argv[0];
|
|
8
8
|
if (firstArg) {
|
|
9
9
|
if (firstArg === '-v' || firstArg === '--version') {
|
|
10
|
-
printWithPrefix("10.1
|
|
10
|
+
printWithPrefix("10.2.1");
|
|
11
11
|
process.exit(0);
|
|
12
12
|
}
|
|
13
13
|
if (firstArg === '-h' || firstArg === '--help') {
|
package/dist/dict/wordlist.js
CHANGED
|
@@ -205,8 +205,8 @@ export const wordlist = callableDict([
|
|
|
205
205
|
[/ баторыяў /g, ' баторых '],
|
|
206
206
|
[/балгар/g, 'баўгар'],
|
|
207
207
|
[/брэст /g, '(брэст|берасьце) '],
|
|
208
|
+
[/брэстам/g, '(брэста|берасьце)м'],
|
|
208
209
|
[/брэста/g, '($&|берасьця)'],
|
|
209
|
-
[/\(брэста\|берасьця\)м/g, '(брэста|берасьце)м'],
|
|
210
210
|
[/брэсту/g, '($&|берасьцю)'],
|
|
211
211
|
[/брэсце/g, '($&|берасьці)'],
|
|
212
212
|
[/брэсцк/g, '($&|берасьцейск)'],
|
|
@@ -235,7 +235,7 @@ export const wordlist = callableDict([
|
|
|
235
235
|
[/белфас(?=[тц])/g, 'бэлфас'],
|
|
236
236
|
[/бельг/g, 'бэльґ'],
|
|
237
237
|
[/бенгал/g, 'бэнгал'],
|
|
238
|
-
[/бензін/g, '
|
|
238
|
+
[/бензін/g, 'бэнзын'],
|
|
239
239
|
[/бенін/g, 'бэнін'],
|
|
240
240
|
[/бенедыкт /g, 'бэнэдыкт '],
|
|
241
241
|
[/бэрге(?=лі|ля)/g, 'бер\ue0ffге'], // вёска
|
|
@@ -499,6 +499,7 @@ export const wordlist = callableDict([
|
|
|
499
499
|
[/ ([кс])інема/g, ' $1інэма'],
|
|
500
500
|
[/клаві/g, 'кляві'],
|
|
501
501
|
[/клас[ыі]/g, 'клясы'],
|
|
502
|
+
//???
|
|
502
503
|
[/ы клас /g, 'ая кляса '],
|
|
503
504
|
[/[іы]м класе /g, 'ай клясе '],
|
|
504
505
|
[/[іы]м класам /g, 'ай клясай '],
|
|
@@ -646,7 +647,7 @@ export const wordlist = callableDict([
|
|
|
646
647
|
[/ (арф|гайв|каліз|муз|спідв)ее/g, ' $1эі'],
|
|
647
648
|
[/ (арф|гайв|каліз|муз|спідв)е/g, ' $1э'],
|
|
648
649
|
[/маджахед/g, 'муджаг\ue0ffед'],
|
|
649
|
-
[/магамед/g, '
|
|
650
|
+
[/магамед/g, 'магамэд'],
|
|
650
651
|
[/медал/g, 'мэдал'],
|
|
651
652
|
[/мед(?=ы|уз|бра[тц]|с[ёя]с[тц]|інстыт)/g, 'мэд'],
|
|
652
653
|
[/ меза/g, ' мэза'],
|
|
@@ -876,10 +877,10 @@ export const wordlist = callableDict([
|
|
|
876
877
|
[/сіміл/g, 'сыміл'],
|
|
877
878
|
[/сімпат/g, 'сымпат'],
|
|
878
879
|
[/сімпозіум/g, 'сымпозіюм'],
|
|
879
|
-
[/сімпт([ао])
|
|
880
|
+
[/сімпт(?=[ао]м)/g, 'сымпт'],
|
|
880
881
|
[/трэнажор/g, 'сымулятар'],
|
|
881
882
|
[/сімуля(?=[внц])/g, 'сымуля'],
|
|
882
|
-
[/сімф([ао])
|
|
883
|
+
[/сімф(?=[ао]ні)/g, 'сымф'],
|
|
883
884
|
[/сінагог/g, 'сынагог'],
|
|
884
885
|
[/сінгапур/g, 'сынгапур'],
|
|
885
886
|
[/сіндром/g, 'сындром'],
|
|
@@ -1299,9 +1300,8 @@ export const wordlist = callableDict([
|
|
|
1299
1300
|
[/ каня(?=[мх])/g, ' к(аня|оня|анё)'],
|
|
1300
1301
|
[/ абласцей /g, ' (абласьцей|вобласьцяў) '],
|
|
1301
1302
|
[/ валасцей /g, ' (валасьцей|воласьцяў) '],
|
|
1302
|
-
[/ (най\S
|
|
1303
|
+
[/ (най\S+|пр|[чг])асцей/g, ' $1асьц\ue0ffей'],
|
|
1303
1304
|
[/сцей /g, 'сьц(ей|яў) '],
|
|
1304
|
-
[/ (г|(?:най)?ч)асьц\(ей\)\(яў\) /g, ' $1асьцей '],
|
|
1305
1305
|
|
|
1306
1306
|
[/(абед| дон|енск|[іы]зм|завод|інстытут| канал|крым|(?:кле|пола|слу)цк|лёндан|мадрыд| рым)а (?!-)/g, '$1у '],
|
|
1307
1307
|
[/(бэрлін|нясвіж|парыж)а /g, '$1(а|у) '],
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DeepPartialReadonly } from '../types';
|
|
2
|
+
import type { TaraskStep } from '../steps';
|
|
3
|
+
import { TaraskConfig } from '../config';
|
|
4
|
+
export type Pipeline = {
|
|
5
|
+
(text: string, cfg?: DeepPartialReadonly<TaraskConfig>): string;
|
|
6
|
+
steps: TaraskStep<any>[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Create a callable pipeline from steps.
|
|
10
|
+
*/
|
|
11
|
+
export declare const pipe: (steps: TaraskStep<any>[]) => Pipeline;
|
package/dist/lib/pipe.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TaraskConfig } from '../config.js';
|
|
2
|
+
|
|
3
|
+
export const pipe = (steps) => {
|
|
4
|
+
const fn = (text, cfg = new TaraskConfig()) => {
|
|
5
|
+
const ctx = {
|
|
6
|
+
text,
|
|
7
|
+
cfg: cfg instanceof TaraskConfig ? cfg : new TaraskConfig(cfg),
|
|
8
|
+
storage: {},
|
|
9
|
+
};
|
|
10
|
+
for (const step of fn.steps)
|
|
11
|
+
step(ctx);
|
|
12
|
+
return ctx.text;
|
|
13
|
+
};
|
|
14
|
+
fn.steps = steps;
|
|
15
|
+
return fn;
|
|
16
|
+
};
|
package/dist/pipelines.d.ts
CHANGED
|
@@ -6,27 +6,17 @@
|
|
|
6
6
|
* `pipeline.steps.map` if you need replacing only or
|
|
7
7
|
* `pipeline.steps.flatMap` if you also need to add or remove steps.
|
|
8
8
|
*
|
|
9
|
-
* Then pass the result to {@link
|
|
9
|
+
* Then pass the result to {@link pipe}.
|
|
10
10
|
*
|
|
11
11
|
* This way you will depend less on the
|
|
12
12
|
* internal order of the builtin pipeline steps.
|
|
13
13
|
*
|
|
14
14
|
* For cases when you need to replace only {@link steps.taraskevize} in {@link tarask}
|
|
15
|
-
* and have better tree-shaking, you can use {@link
|
|
15
|
+
* and have better tree-shaking, you can use {@link _pipe}.
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
19
|
-
import { TaraskConfig } from './config';
|
|
20
19
|
import { type TaraskStep } from './steps';
|
|
21
|
-
import type { DeepPartialReadonly } from './types';
|
|
22
|
-
export type Pipeline = {
|
|
23
|
-
(text: string, cfg?: DeepPartialReadonly<TaraskConfig>): string;
|
|
24
|
-
steps: TaraskStep<any>[];
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Create a callable pipeline from steps.
|
|
28
|
-
*/
|
|
29
|
-
export declare const createPipeline: (steps: TaraskStep<any>[]) => Pipeline;
|
|
30
20
|
/**
|
|
31
21
|
* Pipeline for changing only the alphabet.
|
|
32
22
|
*
|
|
@@ -34,7 +24,7 @@ export declare const createPipeline: (steps: TaraskStep<any>[]) => Pipeline;
|
|
|
34
24
|
*
|
|
35
25
|
* To see the full list of steps, check the source code.
|
|
36
26
|
*/
|
|
37
|
-
export declare const alphabetic: Pipeline;
|
|
27
|
+
export declare const alphabetic: import("./lib").Pipeline;
|
|
38
28
|
/**
|
|
39
29
|
* For better tree-shaking instead of `Array.prototype.flatMap`
|
|
40
30
|
*
|
|
@@ -42,13 +32,13 @@ export declare const alphabetic: Pipeline;
|
|
|
42
32
|
*
|
|
43
33
|
* @param subPipeline - Steps used instead of [{@link steps.taraskevize}].
|
|
44
34
|
*/
|
|
45
|
-
export declare const
|
|
35
|
+
export declare const _pipe: (subPipeline: TaraskStep<any>[]) => import("./lib").Pipeline;
|
|
46
36
|
/**
|
|
47
37
|
* Pipeline for taraskevizing.
|
|
48
38
|
*/
|
|
49
|
-
export declare const tarask: Pipeline;
|
|
39
|
+
export declare const tarask: import("./lib").Pipeline;
|
|
50
40
|
/**
|
|
51
41
|
* Pipeline for phonetizing.
|
|
52
42
|
* @alpha
|
|
53
43
|
*/
|
|
54
|
-
export declare const phonetic: Pipeline;
|
|
44
|
+
export declare const phonetic: import("./lib").Pipeline;
|
package/dist/pipelines.js
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { pipe } from './lib/index.js';
|
|
3
3
|
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';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
const fn = (text, cfg = new TaraskConfig()) => {
|
|
7
|
-
const ctx = {
|
|
8
|
-
text,
|
|
9
|
-
cfg: cfg instanceof TaraskConfig ? cfg : new TaraskConfig(cfg),
|
|
10
|
-
storage: {},
|
|
11
|
-
};
|
|
12
|
-
for (const step of fn.steps)
|
|
13
|
-
step(ctx);
|
|
14
|
-
return ctx.text;
|
|
15
|
-
};
|
|
16
|
-
fn.steps = steps;
|
|
17
|
-
return fn;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const alphabetic = createPipeline([
|
|
5
|
+
export const alphabetic = pipe([
|
|
21
6
|
(ctx) => {
|
|
22
7
|
ctx.cfg = { ...ctx.cfg, doEscapeCapitalized: false };
|
|
23
8
|
},
|
|
@@ -32,7 +17,7 @@ export const alphabetic = createPipeline([
|
|
|
32
17
|
untrim,
|
|
33
18
|
]);
|
|
34
19
|
|
|
35
|
-
export const
|
|
20
|
+
export const _pipe = (subPipeline) => pipe([
|
|
36
21
|
trim,
|
|
37
22
|
resolveSpecialSyntax,
|
|
38
23
|
prepare,
|
|
@@ -54,6 +39,6 @@ export const _createPipeline = (subPipeline) => createPipeline([
|
|
|
54
39
|
untrim,
|
|
55
40
|
]);
|
|
56
41
|
|
|
57
|
-
export const tarask =
|
|
42
|
+
export const tarask = _pipe([taraskevize]);
|
|
58
43
|
|
|
59
|
-
export const phonetic =
|
|
44
|
+
export const phonetic = _pipe([phonetize, iotacizeJi]);
|