taraskevizer 9.2.3 → 9.3.0
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 +3 -3
- package/dist/dict/alphabets/arabic.d.ts +1 -1
- package/dist/dict/alphabets/arabic.js +55 -52
- package/dist/dict/alphabets/cyrillic.d.ts +2 -2
- package/dist/dict/alphabets/cyrillic.js +3 -2
- package/dist/dict/alphabets/latin.d.ts +4 -4
- package/dist/dict/alphabets/latin.js +109 -112
- package/dist/dict/alphabets/types.d.ts +3 -3
- package/dist/dict/iawords.d.ts +1 -1
- package/dist/dict/iawords.js +3 -3
- package/dist/dict/lib.d.ts +5 -9
- package/dist/dict/lib.js +7 -15
- package/dist/dict/phonetic.d.ts +1 -1
- package/dist/dict/phonetic.js +5 -4
- package/dist/dict/softening.d.ts +2 -2
- package/dist/dict/softening.js +13 -13
- package/dist/dict/types.d.ts +6 -8
- package/dist/dict/wordlist.d.ts +1 -2
- package/dist/dict/wordlist.js +1414 -1413
- package/dist/lib/after-tarask.d.ts +1 -2
- package/dist/lib/after-tarask.js +3 -2
- package/dist/lib/debug.d.ts +3 -0
- package/dist/lib/debug.js +16 -0
- package/dist/lib/index.d.ts +1 -2
- package/dist/lib/index.js +1 -2
- package/dist/lib/mutating-step.d.ts +4 -4
- package/dist/lib/mutating-step.js +2 -2
- package/dist/lib/replace-g.js +1 -1
- package/dist/lib/soften.js +3 -4
- package/dist/lib/types.d.ts +5 -0
- package/dist/pipelines.d.ts +1 -1
- package/dist/steps/apply-g.js +5 -9
- package/dist/steps/apply-variations.d.ts +1 -1
- package/dist/steps/convert-alphabet.d.ts +2 -2
- package/dist/steps/convert-alphabet.js +7 -3
- package/dist/steps/finalize.d.ts +3 -3
- package/dist/steps/i-to-j.js +3 -3
- package/dist/steps/iotacize-ji.d.ts +1 -1
- package/dist/steps/iotacize-ji.js +8 -7
- package/dist/steps/phonetize.d.ts +1 -1
- package/dist/steps/phonetize.js +2 -3
- package/dist/steps/prepare.d.ts +1 -1
- package/dist/steps/resolve-syntax.js +5 -5
- package/dist/steps/store-splitted-abc-converted-orig.js +2 -2
- package/dist/steps/taraskevize.d.ts +1 -1
- package/dist/steps/taraskevize.js +2 -2
- package/dist/steps/to-lower-case.d.ts +1 -1
- package/dist/steps/types.d.ts +1 -1
- package/dist/tarask.js +3 -3
- package/package.json +10 -5
- package/dist/lib/replace-with-dict.d.ts +0 -2
- package/dist/lib/replace-with-dict.js +0 -7
- package/dist/lib/tools.debug.d.ts +0 -3
- package/dist/lib/tools.debug.js +0 -17
package/dist/bin.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { dicts, TaraskConfig, tarask, pipelines, htmlConfigOptions, wrappers, } from './index.js';
|
|
3
3
|
const printWithPrefix = (msg) => {
|
|
4
|
-
process.stdout.write("[34m[taraskevizer][0m" + msg + '\n');
|
|
4
|
+
process.stdout.write("[34m[taraskevizer][0m" + ' ' + msg + '\n');
|
|
5
5
|
};
|
|
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.
|
|
9
|
+
printWithPrefix("9.3.0");
|
|
10
10
|
process.exit(0);
|
|
11
11
|
}
|
|
12
12
|
if (checkForOptions(['-h', '--help'])) {
|
|
@@ -66,7 +66,7 @@ let cfg = {
|
|
|
66
66
|
let mode = 'tar';
|
|
67
67
|
const toHashTable = (dict) => {
|
|
68
68
|
const result = {};
|
|
69
|
-
for (const
|
|
69
|
+
for (const { 0: options, 1: callback } of dict)
|
|
70
70
|
for (const option of options)
|
|
71
71
|
result[option] = callback;
|
|
72
72
|
return result;
|
|
@@ -1,62 +1,65 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { callableDict, regexGI } from '../lib.js';
|
|
2
2
|
const soft = '\u0652(?=[еёіюяь])';
|
|
3
3
|
const presoft = '([تزكثࢮбвгджзйклмнпрстфхцчшў])\u0652?(\u0651?)';
|
|
4
4
|
|
|
5
5
|
export const arabic = {
|
|
6
|
-
lower:
|
|
7
|
-
[/
|
|
8
|
-
[
|
|
6
|
+
lower: callableDict([
|
|
7
|
+
[/ [Лл][АаЯя]/g, ' لا'],
|
|
8
|
+
[/[Лл][АаЯя]/g, 'ـلا'],
|
|
9
9
|
// падваеньне зычнага, шадда
|
|
10
|
-
[
|
|
10
|
+
[
|
|
11
|
+
/([БбВвГгДдЖжЗзЙйКкЛлМмНнПпРрСсТтФфХхЦцЧчШшЎў]|[Дд][ЗзЖж])\1/g,
|
|
12
|
+
'$1\u0651',
|
|
13
|
+
],
|
|
11
14
|
// няма галоснага, сукун
|
|
12
|
-
[/([
|
|
15
|
+
[/([БбВвГгДдЖжЗзЙйКкЛлМмНнПпРрСсТтФфХхЦцЧчШшЎў])/g, '$1\u0652'],
|
|
13
16
|
// а, аліф
|
|
14
|
-
[
|
|
17
|
+
[/[Аа]/g, '\u0627а'],
|
|
15
18
|
// першая галосная, аліф
|
|
16
|
-
[/ (?=[
|
|
17
|
-
['д\u0652з' + soft, 'ࢮ'],
|
|
18
|
-
['з' + soft, 'ز'],
|
|
19
|
-
['к' + soft, 'ك'],
|
|
20
|
-
['с' + soft, 'ث'],
|
|
21
|
-
['т' + soft, 'ت'],
|
|
22
|
-
[/([تزكث])
|
|
19
|
+
[/ (?=[ЕеЭэЫыУуОо])/g, ' \u0627'],
|
|
20
|
+
[regexGI('д\u0652з' + soft), 'ࢮ'],
|
|
21
|
+
[regexGI('з' + soft), 'ز'],
|
|
22
|
+
[regexGI('к' + soft), 'ك'],
|
|
23
|
+
[regexGI('с' + soft), 'ث'],
|
|
24
|
+
[regexGI('т' + soft), 'ت'],
|
|
25
|
+
[/([تزكث])[Іі]/g, 'ы'],
|
|
23
26
|
// $2 - шадда
|
|
24
|
-
[presoft + '[аяэе]', '$1$2\u064E'],
|
|
25
|
-
[presoft + '[іы]', '$1$2\u0650'],
|
|
26
|
-
[/ і
|
|
27
|
-
[presoft + '[оёую]', '$1$2\u064F'],
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
// [/[ьʼ]
|
|
31
|
-
[/[
|
|
32
|
-
[
|
|
33
|
-
[/[
|
|
34
|
-
[/[
|
|
35
|
-
[/[
|
|
36
|
-
[/[
|
|
37
|
-
[
|
|
38
|
-
[/[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[/д\u0652
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
]
|
|
27
|
+
[regexGI(presoft + '[аяэе]'), '$1$2\u064E'],
|
|
28
|
+
[regexGI(presoft + '[іы]'), '$1$2\u0650'],
|
|
29
|
+
[/ [Iі] /g, ' \u0627\u0650 '],
|
|
30
|
+
[regexGI(presoft + '[оёую]'), '$1$2\u064F'],
|
|
31
|
+
[/[ʼ]/g, 'ع'],
|
|
32
|
+
[/[Ьь]/g, ''],
|
|
33
|
+
// [/[ьʼ]/g, ''],
|
|
34
|
+
[/[ЯяЕе]/g, 'ي\u064E'],
|
|
35
|
+
[/[Іі]/g, 'ي\u0650'],
|
|
36
|
+
[/[ЁёЮю]/g, 'ي\u064F'],
|
|
37
|
+
[/[АаЭэ]/g, '\u064E'],
|
|
38
|
+
[/[ЫыІі]/g, '\u0650'],
|
|
39
|
+
[/[ОоУу]/g, '\u064F'],
|
|
40
|
+
[/[Бб]/g, 'ب'],
|
|
41
|
+
[/[ВвЎў]/g, 'و'],
|
|
42
|
+
[/[Гг]/g, 'ه'],
|
|
43
|
+
[/[Ґґ]/g, 'غ'],
|
|
44
|
+
[/д\u0652ж/gi, 'ج'],
|
|
45
|
+
[/[Дд]/g, 'د'],
|
|
46
|
+
[/[Жж]/g, 'ژ'],
|
|
47
|
+
[/[Зз]/g, 'ض'],
|
|
48
|
+
[/[Йй]/g, 'ي'],
|
|
49
|
+
[/[Кк]/g, 'ق'],
|
|
50
|
+
[/[Лл]/g, 'ل'],
|
|
51
|
+
[/[Мм]/g, 'م'],
|
|
52
|
+
[/[Нн]/g, 'ن'],
|
|
53
|
+
[/[Пп]/g, 'پ'],
|
|
54
|
+
[/[Рр]/g, 'ر'],
|
|
55
|
+
[/[Сс]/g, 'ص'],
|
|
56
|
+
[/[Тт]/g, 'ط'],
|
|
57
|
+
[/[Фф]/g, 'ف'],
|
|
58
|
+
[/[Хх]/g, 'ح'],
|
|
59
|
+
[/[Цц]/g, 'ࢯ'],
|
|
60
|
+
[/[Чч]/g, 'چ'],
|
|
61
|
+
[/[Шш]/g, 'ش'],
|
|
62
|
+
[/[,]/g, '،'],
|
|
63
|
+
[/\?/g, '؟'],
|
|
64
|
+
]),
|
|
62
65
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export declare const latin: {
|
|
2
|
-
lower: (
|
|
3
|
-
upper: (
|
|
2
|
+
lower: import("../types").CallableDict;
|
|
3
|
+
upper: import("../types").CallableDict;
|
|
4
4
|
};
|
|
5
5
|
export declare const latinJi: {
|
|
6
|
-
lower: (
|
|
7
|
-
upper: (
|
|
6
|
+
lower: import("../types").CallableDict;
|
|
7
|
+
upper: import("../types").CallableDict;
|
|
8
8
|
};
|
|
@@ -1,141 +1,138 @@
|
|
|
1
1
|
import { iwords } from '../iwords.js';
|
|
2
|
-
import {
|
|
2
|
+
import { callableDict, regexG } from '../lib.js';
|
|
3
3
|
const common = {
|
|
4
4
|
lower: [
|
|
5
5
|
[
|
|
6
|
-
[/(?<=[аеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
7
|
-
[/(?<=[eаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
8
|
-
[/(?<=[eoаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
9
|
-
[/(?<=[eouаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
6
|
+
[/(?<=[аеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)е/g, 'je'],
|
|
7
|
+
[/(?<=[eаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)ё/g, 'jo'],
|
|
8
|
+
[/(?<=[eoаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)ю/g, 'ju'],
|
|
9
|
+
[/(?<=[eouаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)я/g, 'ja'],
|
|
10
10
|
],
|
|
11
11
|
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[/łi(?=[eoua])
|
|
51
|
-
[/łi
|
|
12
|
+
[/ʼ/g, ''],
|
|
13
|
+
[/ць/g, 'ć'],
|
|
14
|
+
[/зь/g, 'ź'],
|
|
15
|
+
[/сь/g, 'ś'],
|
|
16
|
+
[/нь/g, 'ń'],
|
|
17
|
+
[/ль/g, 'l'],
|
|
18
|
+
[/а/g, 'a'],
|
|
19
|
+
[/б/g, 'b'],
|
|
20
|
+
[/в/g, 'v'],
|
|
21
|
+
[/г/g, 'h'],
|
|
22
|
+
[/ґ/g, 'g'],
|
|
23
|
+
[/д/g, 'd'],
|
|
24
|
+
[/е/g, 'ie'],
|
|
25
|
+
[/ё/g, 'io'],
|
|
26
|
+
[/ж/g, 'ž'],
|
|
27
|
+
[/з/g, 'z'],
|
|
28
|
+
[/і/g, 'i'],
|
|
29
|
+
[/й/g, 'j'],
|
|
30
|
+
[/к/g, 'k'],
|
|
31
|
+
[/л/g, 'ł'],
|
|
32
|
+
[/м/g, 'm'],
|
|
33
|
+
[/н/g, 'n'],
|
|
34
|
+
[/о/g, 'o'],
|
|
35
|
+
[/п/g, 'p'],
|
|
36
|
+
[/р/g, 'r'],
|
|
37
|
+
[/с/g, 's'],
|
|
38
|
+
[/т/g, 't'],
|
|
39
|
+
[/у/g, 'u'],
|
|
40
|
+
[/ў/g, 'ŭ'],
|
|
41
|
+
[/ф/g, 'f'],
|
|
42
|
+
[/х/g, 'ch'],
|
|
43
|
+
[/ц/g, 'c'],
|
|
44
|
+
[/ч/g, 'č'],
|
|
45
|
+
[/ш/g, 'š'],
|
|
46
|
+
[/ы/g, 'y'],
|
|
47
|
+
[/э/g, 'e'],
|
|
48
|
+
[/ю/g, 'iu'],
|
|
49
|
+
[/я/g, 'ia'],
|
|
50
|
+
[/łi(?=[eoua])/g, 'l'],
|
|
51
|
+
[/łi/g, 'li'],
|
|
52
52
|
],
|
|
53
|
-
]
|
|
53
|
+
],
|
|
54
54
|
upper: [
|
|
55
55
|
[
|
|
56
|
-
[/ Е(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/
|
|
57
|
-
[/ Ё(?=[ \p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|
|
96
|
+
[/У/g, 'U'],
|
|
97
|
+
[/Ў/g, 'Ŭ'],
|
|
98
|
+
[/Ф/g, 'F'],
|
|
99
|
+
[/ Х(?=[\p{Ll} ])/gu, ' Ch'],
|
|
100
|
+
[/Х/g, 'CH'],
|
|
101
|
+
[/Ц/g, 'C'],
|
|
102
|
+
[/Ч/g, 'Č'],
|
|
103
|
+
[/Ш/g, 'Š'],
|
|
104
|
+
[/Ы/g, 'Y'],
|
|
105
|
+
[/Э/g, 'E'],
|
|
106
|
+
[/Ł[Ii](?=[AEOUaeou])/g, 'L'],
|
|
107
|
+
[/Ł(?=[Ii])/g, 'L'],
|
|
108
108
|
],
|
|
109
|
-
]
|
|
109
|
+
],
|
|
110
110
|
};
|
|
111
111
|
export const latin = {
|
|
112
|
-
lower: [...common.lower[0], [/ʼі/g, 'ji'], ...common.lower[1]],
|
|
113
|
-
upper: common.upper.flat(),
|
|
112
|
+
lower: callableDict([...common.lower[0], [/ʼі/g, 'ji'], ...common.lower[1]]),
|
|
113
|
+
upper: callableDict(common.upper.flat()),
|
|
114
114
|
};
|
|
115
115
|
export const latinJi = {
|
|
116
|
-
lower:
|
|
117
|
-
|
|
118
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і
|
|
119
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і
|
|
120
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )
|
|
121
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І
|
|
122
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І
|
|
123
|
-
[
|
|
124
|
-
[`
|
|
125
|
-
[` І(?=${iwords})
|
|
126
|
-
[` І(?=${iwords.toUpperCase()})`, ' JI'],
|
|
127
|
-
])
|
|
128
|
-
.concat([
|
|
116
|
+
lower: callableDict([
|
|
117
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і Ў/g, '$1j U'],
|
|
118
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і ў/g, '$1j u'],
|
|
119
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і /g, '$1j '],
|
|
120
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І Ў/g, '$1J U'],
|
|
121
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І ў/g, '$1J u'],
|
|
122
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І /g, '$1J '],
|
|
123
|
+
[regexG(` і(?=${iwords})`), ' ji'],
|
|
124
|
+
[regexG(` І(?=${iwords})`), ' Ji'],
|
|
125
|
+
[regexG(` І(?=${iwords.toUpperCase()})`), ' JI'],
|
|
129
126
|
...common.lower[0],
|
|
130
127
|
[/([eouaаеёіоуыэюяʼАЕЁІОУЫЭЮЯЬ] *)і/g, '$1ji'],
|
|
131
128
|
...common.lower[1],
|
|
132
129
|
]),
|
|
133
|
-
upper: [
|
|
130
|
+
upper: callableDict([
|
|
134
131
|
...common.upper[0],
|
|
135
132
|
[/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, '$1Ji'],
|
|
136
133
|
...common.upper[1],
|
|
137
134
|
[/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, '$1JI'],
|
|
138
135
|
...common.upper[2],
|
|
139
136
|
[/ JIŁ -/g, ' IŁ -'],
|
|
140
|
-
],
|
|
137
|
+
]),
|
|
141
138
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CallableDict } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* If {@link Alphabet.upper} in not defined,
|
|
4
4
|
* it is assumed that the alphabet is case-insensitive,
|
|
@@ -6,6 +6,6 @@ import type { Dict } from '../types';
|
|
|
6
6
|
* upper and lower case letters.
|
|
7
7
|
*/
|
|
8
8
|
export type Alphabet = {
|
|
9
|
-
lower:
|
|
10
|
-
upper?:
|
|
9
|
+
lower: CallableDict;
|
|
10
|
+
upper?: CallableDict;
|
|
11
11
|
};
|
package/dist/dict/iawords.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const iaWords: import("./types").
|
|
1
|
+
export declare const iaWords: import("./types").CallableDict;
|
package/dist/dict/iawords.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { iwords } from './iwords.js';
|
|
2
|
-
import {
|
|
3
|
-
const ia = (word, words) => ` ${word}(?= \\(?(?:[бвгджзйклмнпрстфхцчшўьʼ]*[оё]|${toOneLine(words).replace(/\(/g, '(?:')}|i(?:${iwords})))
|
|
4
|
-
export const iaWords =
|
|
2
|
+
import { callableDict, regexG, toOneLine } from './lib.js';
|
|
3
|
+
const ia = (word, words) => regexG(` ${word}(?= \\(?(?:[бвгджзйклмнпрстфхцчшўьʼ]*[оё]|${toOneLine(words).replace(/\(/g, '(?:')}|i(?:${iwords})))`);
|
|
4
|
+
export const iaWords = callableDict([
|
|
5
5
|
|
|
6
6
|
[
|
|
7
7
|
ia('не', `(вы)?(бач[ауы]
|
package/dist/dict/lib.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CallableDict, Dict } from './types';
|
|
2
2
|
export declare const copyDict: <T extends [any, any][]>(dict: T) => T;
|
|
3
3
|
/**
|
|
4
4
|
* Collection of MUTATING functions
|
|
@@ -12,14 +12,10 @@ export declare const copyDict: <T extends [any, any][]>(dict: T) => T;
|
|
|
12
12
|
* ["pattern", "result"],
|
|
13
13
|
* ];
|
|
14
14
|
*
|
|
15
|
-
* const dict =
|
|
15
|
+
* const dict = dict.raw(copyDict(rawDict));
|
|
16
16
|
* // [ [ /pattern/g, "result" ] ]
|
|
17
17
|
*/
|
|
18
|
-
export declare const
|
|
19
|
-
raw: (dict: RawDict, additionalFlags?: string) => Dict;
|
|
20
|
-
/**
|
|
21
|
-
* Adds the global flag to all patterns in the dictionary.
|
|
22
|
-
*/
|
|
23
|
-
nonGlobal: (dict: WritableDict) => Dict;
|
|
24
|
-
};
|
|
18
|
+
export declare const callableDict: (dict: Dict) => CallableDict;
|
|
25
19
|
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,18 +1,10 @@
|
|
|
1
|
-
export const copyDict = (dict) => dict.map((
|
|
1
|
+
export const copyDict = (dict) => dict.map(({ 0: pattern, 1: result }) => [pattern, result]);
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
? item[0].flags + additionalFlags
|
|
8
|
-
: additionalFlags);
|
|
9
|
-
return dict;
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
nonGlobal: (dict) => {
|
|
13
|
-
for (const item of dict)
|
|
14
|
-
item[0] = RegExp(item[0], 'g' + item[0].flags);
|
|
15
|
-
return dict;
|
|
16
|
-
},
|
|
3
|
+
export const callableDict = (dict) => {
|
|
4
|
+
const fn = (text) => fn.value.reduce((acc, item) => acc.replace(item[0], item[1]), text);
|
|
5
|
+
fn.value = dict;
|
|
6
|
+
return fn;
|
|
17
7
|
};
|
|
18
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/phonetic.d.ts
CHANGED
package/dist/dict/phonetic.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { callableDict } from './lib.js';
|
|
1
2
|
export const commonPhonetic = [
|
|
2
3
|
[/шся /g, 'сься '],
|
|
3
4
|
[/здж/g, 'ждж'],
|
|
4
|
-
[/ ([бд]|кнд|нот)р
|
|
5
|
-
[/(\S\S[дт])р
|
|
5
|
+
[/ ([бд]|кнд|нот)р /g, ' $1\ue0ffр '],
|
|
6
|
+
[/(\S\S[дт])р /g, '$1ар '],
|
|
6
7
|
];
|
|
7
|
-
export const phonetic = [
|
|
8
|
+
export const phonetic = callableDict([
|
|
8
9
|
[/сш/g, 'шш'],
|
|
9
10
|
[/[зс]ч/g, 'шч'],
|
|
10
11
|
[/чц(?![ьіеюя])/g, 'цц'],
|
|
11
12
|
[/[жш]ц(?=ы )/g, 'сц'],
|
|
12
|
-
].concat(commonPhonetic);
|
|
13
|
+
].concat(commonPhonetic));
|
package/dist/dict/softening.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const noSoften: import("./types").
|
|
2
|
-
export declare const softeners: import("./types").
|
|
1
|
+
export declare const noSoften: import("./types").CallableDict;
|
|
2
|
+
export declare const softeners: import("./types").CallableDict;
|
package/dist/dict/softening.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { callableDict, regexG } from './lib.js';
|
|
2
2
|
import { iwords } from './iwords.js';
|
|
3
|
-
export const noSoften =
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[/ ((?:[пн]|пе?р)?)
|
|
3
|
+
export const noSoften = callableDict([
|
|
4
|
+
[/масфільм/g, 'мас\ue0ffфільм'],
|
|
5
|
+
[/пэндзлік/g, 'пэндз\ue0ffлік'],
|
|
6
|
+
[/ ((?:[пн]|пе?р)?)аддз/g, ' $1ад\ue0ffдз'],
|
|
7
7
|
]);
|
|
8
|
-
export const softeners =
|
|
9
|
-
[/([лнц])\1(?=[еёіюяь])
|
|
10
|
-
[/(\S\S)дз?дз(?=[еёіюяь])
|
|
11
|
-
[/з(?=(?:[бвзлмнц]|дз)[еёіюяь])
|
|
12
|
-
[/с(?=[бвлмнпсфц][еёіюяь])
|
|
13
|
-
[/ц(?=[вм][еёіюяь])
|
|
8
|
+
export const softeners = callableDict([
|
|
9
|
+
[/([лнц])\1(?=[еёіюяь])/g, '$1ь$1'],
|
|
10
|
+
[/(\S\S)дз?дз(?=[еёіюяь])/g, '$1дзьдз'],
|
|
11
|
+
[/з(?=(?:[бвзлмнц]|дз)[еёіюяь])/g, 'зь'],
|
|
12
|
+
[/с(?=[бвлмнпсфц][еёіюяь])/g, 'сь'],
|
|
13
|
+
[/ц(?=[вм][еёіюяь])/g, 'ць'],
|
|
14
14
|
[
|
|
15
|
-
`( (?:б[ея]|пра|цера)?з) (?=\\(?)(?=[еёюяь]|([бвзйлмнпстфц]|дз)[еёіюяь]|імі? |іх(?:ні)?|і(?:${iwords}))
|
|
15
|
+
regexG(`( (?:б[ея]|пра|цера)?з) (?=\\(?)(?=[еёюяь]|([бвзйлмнпстфц]|дз)[еёіюяь]|імі? |іх(?:ні)?|і(?:${iwords}))`),
|
|
16
16
|
'$1ь ',
|
|
17
17
|
],
|
|
18
|
-
[/([сз])ʼ(?=[яюеё])
|
|
18
|
+
[/([сз])ʼ(?=[яюеё])/g, '$1ь'],
|
|
19
19
|
]);
|
package/dist/dict/types.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
+
export type Callable<Value> = {
|
|
2
|
+
(value: string): string;
|
|
3
|
+
value: Value;
|
|
4
|
+
};
|
|
1
5
|
export type Dict<T = RegExp> = readonly (readonly [T, string])[];
|
|
6
|
+
export type CallableDict<T = RegExp> = Callable<Dict<T>>;
|
|
2
7
|
/**
|
|
3
8
|
* Useful if you want to modify the dictionary.
|
|
4
9
|
*
|
|
5
|
-
* Consider converting it to the type {@link
|
|
10
|
+
* Consider converting it to the type {@link CallableDict}
|
|
6
11
|
* if you no longer need to modify it.
|
|
7
12
|
*/
|
|
8
13
|
export type WritableDict<T = RegExp> = [T, string][];
|
|
9
|
-
/**
|
|
10
|
-
* useful if you use variables in patterns.
|
|
11
|
-
*
|
|
12
|
-
* Don't forget to convert it to the type {@link Dict},
|
|
13
|
-
* {@link lib.dictFrom} can help you with this.
|
|
14
|
-
*/
|
|
15
|
-
export type RawDict = WritableDict<string | RegExp>;
|
package/dist/dict/wordlist.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const wordlist: Dict;
|
|
1
|
+
export declare const wordlist: import("./types").CallableDict;
|