taraskevizer 9.2.4 → 9.3.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 +2 -2
- package/dist/dict/alphabets/arabic.d.ts +1 -1
- package/dist/dict/alphabets/arabic.js +56 -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 +110 -112
- package/dist/dict/alphabets/types.d.ts +3 -3
- package/dist/dict/iawords.d.ts +1 -1
- package/dist/dict/iawords.js +4 -3
- package/dist/dict/lib.d.ts +7 -19
- package/dist/dict/lib.js +5 -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 +14 -13
- package/dist/dict/types.d.ts +5 -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 +2 -2
- package/dist/lib/index.js +2 -2
- package/dist/lib/mutating-step.d.ts +4 -4
- package/dist/lib/mutating-step.js +2 -2
- package/dist/lib/re.d.ts +2 -0
- package/dist/lib/re.js +2 -0
- package/dist/lib/soften.js +3 -4
- package/dist/pipelines.d.ts +1 -1
- package/dist/steps/apply-g.js +5 -9
- package/dist/steps/convert-alphabet.js +6 -3
- package/dist/steps/finalize.d.ts +2 -2
- package/dist/steps/i-to-j.js +3 -3
- package/dist/steps/iotacize-ji.js +7 -7
- package/dist/steps/phonetize.js +2 -3
- package/dist/steps/resolve-syntax.js +5 -5
- package/dist/steps/store-splitted-abc-converted-orig.js +2 -2
- package/dist/steps/taraskevize.js +2 -2
- package/dist/steps/types.d.ts +2 -2
- package/dist/tarask.js +3 -3
- package/package.json +1 -1
- package/dist/lib/replace-with-dict.d.ts +0 -2
- package/dist/lib/replace-with-dict.js +0 -5
- package/dist/lib/tools.debug.d.ts +0 -3
- package/dist/lib/tools.debug.js +0 -15
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.
|
|
9
|
+
printWithPrefix("9.3.1");
|
|
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,66 @@
|
|
|
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
|
|
|
5
6
|
export const arabic = {
|
|
6
|
-
lower:
|
|
7
|
-
[/
|
|
8
|
-
[
|
|
7
|
+
lower: callableDict([
|
|
8
|
+
[/ [Лл][АаЯя]/g, ' لا'],
|
|
9
|
+
[/[Лл][АаЯя]/g, 'ـلا'],
|
|
9
10
|
// падваеньне зычнага, шадда
|
|
10
|
-
[
|
|
11
|
+
[
|
|
12
|
+
/([БбВвГгДдЖжЗзЙйКкЛлМмНнПпРрСсТтФфХхЦцЧчШшЎў]|[Дд][ЗзЖж])\1/g,
|
|
13
|
+
'$1\u0651',
|
|
14
|
+
],
|
|
11
15
|
// няма галоснага, сукун
|
|
12
|
-
[/([
|
|
16
|
+
[/([БбВвГгДдЖжЗзЙйКкЛлМмНнПпРрСсТтФфХхЦцЧчШшЎў])/g, '$1\u0652'],
|
|
13
17
|
// а, аліф
|
|
14
|
-
[
|
|
18
|
+
[/[Аа]/g, '\u0627а'],
|
|
15
19
|
// першая галосная, аліф
|
|
16
|
-
[/ (?=[
|
|
17
|
-
['д\u0652з' + soft, 'ࢮ'],
|
|
18
|
-
['з' + soft, 'ز'],
|
|
19
|
-
['к' + soft, 'ك'],
|
|
20
|
-
['с' + soft, 'ث'],
|
|
21
|
-
['т' + soft, 'ت'],
|
|
22
|
-
[/([تزكث])
|
|
20
|
+
[/ (?=[ЕеЭэЫыУуОо])/g, ' \u0627'],
|
|
21
|
+
[re.gi('д\u0652з' + soft), 'ࢮ'],
|
|
22
|
+
[re.gi('з' + soft), 'ز'],
|
|
23
|
+
[re.gi('к' + soft), 'ك'],
|
|
24
|
+
[re.gi('с' + soft), 'ث'],
|
|
25
|
+
[re.gi('т' + soft), 'ت'],
|
|
26
|
+
[/([تزكث])[Іі]/g, 'ы'],
|
|
23
27
|
// $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
|
-
]
|
|
28
|
+
[re.gi(presoft + '[аяэе]'), '$1$2\u064E'],
|
|
29
|
+
[re.gi(presoft + '[іы]'), '$1$2\u0650'],
|
|
30
|
+
[/ [Iі] /g, ' \u0627\u0650 '],
|
|
31
|
+
[re.gi(presoft + '[оёую]'), '$1$2\u064F'],
|
|
32
|
+
[/[ʼ]/g, 'ع'],
|
|
33
|
+
[/[Ьь]/g, ''],
|
|
34
|
+
// [/[ьʼ]/g, ''],
|
|
35
|
+
[/[ЯяЕе]/g, 'ي\u064E'],
|
|
36
|
+
[/[Іі]/g, 'ي\u0650'],
|
|
37
|
+
[/[ЁёЮю]/g, 'ي\u064F'],
|
|
38
|
+
[/[АаЭэ]/g, '\u064E'],
|
|
39
|
+
[/[ЫыІі]/g, '\u0650'],
|
|
40
|
+
[/[ОоУу]/g, '\u064F'],
|
|
41
|
+
[/[Бб]/g, 'ب'],
|
|
42
|
+
[/[ВвЎў]/g, 'و'],
|
|
43
|
+
[/[Гг]/g, 'ه'],
|
|
44
|
+
[/[Ґґ]/g, 'غ'],
|
|
45
|
+
[/д\u0652ж/gi, 'ج'],
|
|
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
|
+
[/\?/g, '؟'],
|
|
65
|
+
]),
|
|
62
66
|
};
|
|
@@ -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,139 @@
|
|
|
1
1
|
import { iwords } from '../iwords.js';
|
|
2
|
-
import {
|
|
2
|
+
import { callableDict } from '../lib.js';
|
|
3
|
+
import { re } from '../../lib/index.js';
|
|
3
4
|
const common = {
|
|
4
5
|
lower: [
|
|
5
6
|
[
|
|
6
|
-
[/(?<=[аеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
7
|
-
[/(?<=[eаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
8
|
-
[/(?<=[eoаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
9
|
-
[/(?<=[eouаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)
|
|
7
|
+
[/(?<=[аеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)е/g, 'je'],
|
|
8
|
+
[/(?<=[eаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)ё/g, 'jo'],
|
|
9
|
+
[/(?<=[eoаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)ю/g, 'ju'],
|
|
10
|
+
[/(?<=[eouаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)я/g, 'ja'],
|
|
10
11
|
],
|
|
11
12
|
[
|
|
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
|
|
13
|
+
[/ʼ/g, ''],
|
|
14
|
+
[/ць/g, 'ć'],
|
|
15
|
+
[/зь/g, 'ź'],
|
|
16
|
+
[/сь/g, 'ś'],
|
|
17
|
+
[/нь/g, 'ń'],
|
|
18
|
+
[/ль/g, 'l'],
|
|
19
|
+
[/а/g, 'a'],
|
|
20
|
+
[/б/g, 'b'],
|
|
21
|
+
[/в/g, 'v'],
|
|
22
|
+
[/г/g, 'h'],
|
|
23
|
+
[/ґ/g, 'g'],
|
|
24
|
+
[/д/g, 'd'],
|
|
25
|
+
[/е/g, 'ie'],
|
|
26
|
+
[/ё/g, 'io'],
|
|
27
|
+
[/ж/g, 'ž'],
|
|
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p{Ll})/gu, ' Ja'],
|
|
60
61
|
],
|
|
61
62
|
[
|
|
62
|
-
[/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)
|
|
63
|
-
[/([EАЕЁІОУЎЫЭЮЯЬ| ]\(?)
|
|
64
|
-
[/([EOАЕЁІОУЎЫЭЮЯЬ| ]\(?)
|
|
65
|
-
[/([EOUАЕЁІОУЎЫЭЮЯЬ| ]\(?)
|
|
63
|
+
[/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)Е/g, '$1JE'],
|
|
64
|
+
[/([EАЕЁІОУЎЫЭЮЯЬ| ]\(?)Ё/g, '$1JO'],
|
|
65
|
+
[/([EOАЕЁІОУЎЫЭЮЯЬ| ]\(?)Ю/g, '$1JU'],
|
|
66
|
+
[/([EOUАЕЁІОУЎЫЭЮЯЬ| ]\(?)Я/g, '$1JA'],
|
|
66
67
|
],
|
|
67
68
|
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[/Ц[Ьь]
|
|
73
|
-
[/З[Ьь]
|
|
74
|
-
[/С[Ьь]
|
|
75
|
-
[/Н[Ьь]
|
|
76
|
-
[/Л[Ьь]
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[
|
|
92
|
-
[
|
|
93
|
-
[
|
|
94
|
-
[
|
|
95
|
-
[
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[/ Х(?=[\p{Ll} ])/
|
|
100
|
-
[
|
|
101
|
-
[
|
|
102
|
-
[
|
|
103
|
-
[
|
|
104
|
-
[
|
|
105
|
-
[
|
|
106
|
-
[/Ł[Ii](?=[AEOUaeou])
|
|
107
|
-
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g, 'L'],
|
|
108
109
|
],
|
|
109
|
-
]
|
|
110
|
+
],
|
|
110
111
|
};
|
|
111
112
|
export const latin = {
|
|
112
|
-
lower: [...common.lower[0], [/ʼі/g, 'ji'], ...common.lower[1]],
|
|
113
|
-
upper: common.upper.flat(),
|
|
113
|
+
lower: callableDict([...common.lower[0], [/ʼі/g, 'ji'], ...common.lower[1]]),
|
|
114
|
+
upper: callableDict(common.upper.flat()),
|
|
114
115
|
};
|
|
115
116
|
export const latinJi = {
|
|
116
|
-
lower:
|
|
117
|
-
|
|
118
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і
|
|
119
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і
|
|
120
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )
|
|
121
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І
|
|
122
|
-
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І
|
|
123
|
-
[
|
|
124
|
-
[`
|
|
125
|
-
[` І(?=${iwords})
|
|
126
|
-
[` І(?=${iwords.toUpperCase()})`, ' JI'],
|
|
127
|
-
])
|
|
128
|
-
.concat([
|
|
117
|
+
lower: callableDict([
|
|
118
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і Ў/g, '$1j U'],
|
|
119
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і ў/g, '$1j u'],
|
|
120
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і /g, '$1j '],
|
|
121
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І Ў/g, '$1J U'],
|
|
122
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І ў/g, '$1J u'],
|
|
123
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І /g, '$1J '],
|
|
124
|
+
[re.g(` і(?=${iwords})`), ' ji'],
|
|
125
|
+
[re.g(` І(?=${iwords})`), ' Ji'],
|
|
126
|
+
[re.g(` І(?=${iwords.toUpperCase()})`), ' JI'],
|
|
129
127
|
...common.lower[0],
|
|
130
128
|
[/([eouaаеёіоуыэюяʼАЕЁІОУЫЭЮЯЬ] *)і/g, '$1ji'],
|
|
131
129
|
...common.lower[1],
|
|
132
130
|
]),
|
|
133
|
-
upper: [
|
|
131
|
+
upper: callableDict([
|
|
134
132
|
...common.upper[0],
|
|
135
133
|
[/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, '$1Ji'],
|
|
136
134
|
...common.upper[1],
|
|
137
135
|
[/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, '$1JI'],
|
|
138
136
|
...common.upper[2],
|
|
139
137
|
[/ JIŁ -/g, ' IŁ -'],
|
|
140
|
-
],
|
|
138
|
+
]),
|
|
141
139
|
};
|
|
@@ -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,8 @@
|
|
|
1
1
|
import { iwords } from './iwords.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
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})))`);
|
|
5
|
+
export const iaWords = callableDict([
|
|
5
6
|
|
|
6
7
|
[
|
|
7
8
|
ia('не', `(вы)?(бач[ауы]
|
package/dist/dict/lib.d.ts
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
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
|
-
*
|
|
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 = dictFrom.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
|
|
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
|
-
};
|
|
12
|
+
export declare const callableDict: (value: Dict) => CallableDict;
|
|
25
13
|
export declare const toOneLine: (str: string) => string;
|
package/dist/dict/lib.js
CHANGED
|
@@ -1,18 +1,8 @@
|
|
|
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 = (value) => {
|
|
4
|
+
const fn = (text) => fn.value.reduce((acc, item) => acc.replace(item[0], item[1]), text);
|
|
5
|
+
fn.value = value;
|
|
6
|
+
return fn;
|
|
17
7
|
};
|
|
18
8
|
export const toOneLine = (str) => str.replace(/\n/g, '|');
|
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,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { callableDict } from './lib.js';
|
|
2
|
+
import { re } from '../lib/index.js';
|
|
2
3
|
import { iwords } from './iwords.js';
|
|
3
|
-
export const noSoften =
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[/ ((?:[пн]|пе?р)?)
|
|
4
|
+
export const noSoften = callableDict([
|
|
5
|
+
[/масфільм/g, 'мас\ue0ffфільм'],
|
|
6
|
+
[/пэндзлік/g, 'пэндз\ue0ffлік'],
|
|
7
|
+
[/ ((?:[пн]|пе?р)?)аддз/g, ' $1ад\ue0ffдз'],
|
|
7
8
|
]);
|
|
8
|
-
export const softeners =
|
|
9
|
-
[/([лнц])\1(?=[еёіюяь])
|
|
10
|
-
[/(\S\S)дз?дз(?=[еёіюяь])
|
|
11
|
-
[/з(?=(?:[бвзлмнц]|дз)[еёіюяь])
|
|
12
|
-
[/с(?=[бвлмнпсфц][еёіюяь])
|
|
13
|
-
[/ц(?=[вм][еёіюяь])
|
|
9
|
+
export const softeners = callableDict([
|
|
10
|
+
[/([лнц])\1(?=[еёіюяь])/g, '$1ь$1'],
|
|
11
|
+
[/(\S\S)дз?дз(?=[еёіюяь])/g, '$1дзьдз'],
|
|
12
|
+
[/з(?=(?:[бвзлмнц]|дз)[еёіюяь])/g, 'зь'],
|
|
13
|
+
[/с(?=[бвлмнпсфц][еёіюяь])/g, 'сь'],
|
|
14
|
+
[/ц(?=[вм][еёіюяь])/g, 'ць'],
|
|
14
15
|
[
|
|
15
|
-
`( (?:б[ея]|пра|цера)?з) (?=\\(?)(?=[еёюяь]|([бвзйлмнпстфц]|дз)[еёіюяь]|імі? |іх(?:ні)?|і(?:${iwords}))
|
|
16
|
+
re.g(`( (?:б[ея]|пра|цера)?з) (?=\\(?)(?=[еёюяь]|([бвзйлмнпстфц]|дз)[еёіюяь]|імі? |іх(?:ні)?|і(?:${iwords}))`),
|
|
16
17
|
'$1ь ',
|
|
17
18
|
],
|
|
18
|
-
[/([сз])ʼ(?=[яюеё])
|
|
19
|
+
[/([сз])ʼ(?=[яюеё])/g, '$1ь'],
|
|
19
20
|
]);
|
package/dist/dict/types.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export type Dict<T = RegExp> = readonly (readonly [T, string])[];
|
|
2
|
+
export type CallableDict<T = RegExp> = {
|
|
3
|
+
(value: string): string;
|
|
4
|
+
value: Dict<T>;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* Useful if you want to modify the dictionary.
|
|
4
8
|
*
|
|
5
|
-
* Consider converting it to the type {@link Dict}
|
|
9
|
+
* Consider converting it to the type {@link Dict} or {@link CallableDict}
|
|
6
10
|
* if you no longer need to modify it.
|
|
7
11
|
*/
|
|
8
12
|
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;
|