taraskevizer 8.0.8 → 8.0.10
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.d.ts +2 -0
- package/dist/bin.js +126 -173
- package/dist/config.d.ts +14 -0
- package/dist/config.js +35 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +10 -0
- package/dist/dict/alphabets/arabic.d.ts +3 -0
- package/dist/dict/alphabets/arabic.js +62 -0
- package/dist/dict/alphabets/cyrillic.d.ts +4 -0
- package/dist/dict/alphabets/cyrillic.js +4 -0
- package/dist/dict/alphabets/index.d.ts +4 -0
- package/dist/dict/alphabets/index.js +3 -0
- package/dist/dict/alphabets/latin.d.ts +8 -0
- package/dist/dict/alphabets/latin.js +141 -0
- package/dist/dict/alphabets/types.d.ts +11 -0
- package/dist/dict/alphabets/types.js +1 -0
- package/dist/dict/gobj.d.ts +6 -0
- package/dist/dict/gobj.js +6 -0
- package/dist/dict/index.d.ts +5 -0
- package/dist/dict/index.js +4 -0
- package/dist/dict/iwords.d.ts +4 -0
- package/dist/dict/iwords.js +61 -0
- package/dist/dict/lib.d.ts +12 -0
- package/dist/dict/lib.js +17 -0
- package/dist/dict/softening.d.ts +2 -0
- package/dist/dict/softening.js +21 -0
- package/dist/dict/types.d.ts +15 -0
- package/dist/dict/types.js +1 -0
- package/dist/dict/wordlist.d.ts +2 -0
- package/dist/dict/wordlist.js +1657 -0
- package/dist/index.d.ts +8 -457
- package/dist/index.js +7 -2579
- package/dist/lib/after-tarask.d.ts +2 -0
- package/dist/lib/after-tarask.js +9 -0
- package/dist/lib/highlight-diff.d.ts +1 -0
- package/dist/lib/highlight-diff.js +62 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/index.js +8 -0
- package/dist/lib/mutating-step.d.ts +8 -0
- package/dist/lib/mutating-step.js +4 -0
- package/dist/lib/replace-g.d.ts +1 -0
- package/dist/lib/replace-g.js +3 -0
- package/dist/lib/replace-with-dict.d.ts +2 -0
- package/dist/lib/replace-with-dict.js +7 -0
- package/dist/lib/restore-case.d.ts +1 -0
- package/dist/lib/restore-case.js +33 -0
- package/dist/lib/types.d.ts +4 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/wrappers.d.ts +8 -0
- package/dist/lib/wrappers.js +8 -0
- package/dist/pipelines.d.ts +48 -0
- package/dist/pipelines.js +58 -0
- package/dist/steps/apply-g.d.ts +3 -0
- package/dist/steps/apply-g.js +18 -0
- package/dist/steps/apply-variations.d.ts +24 -0
- package/dist/steps/apply-variations.js +18 -0
- package/dist/steps/convert-alphabet.d.ts +2 -0
- package/dist/steps/convert-alphabet.js +3 -0
- package/dist/steps/finalize.d.ts +14 -0
- package/dist/steps/finalize.js +8 -0
- package/dist/steps/highlight-diff.d.ts +9 -0
- package/dist/steps/highlight-diff.js +11 -0
- package/dist/steps/i-to-j.d.ts +2 -0
- package/dist/steps/i-to-j.js +10 -0
- package/dist/steps/index.d.ts +29 -0
- package/dist/steps/index.js +17 -0
- package/dist/steps/join-splitted.d.ts +2 -0
- package/dist/steps/join-splitted.js +2 -0
- package/dist/steps/prepare.d.ts +6 -0
- package/dist/steps/prepare.js +8 -0
- package/dist/steps/resolve-syntax.d.ts +24 -0
- package/dist/steps/resolve-syntax.js +73 -0
- package/dist/steps/restore-case.d.ts +2 -0
- package/dist/steps/restore-case.js +12 -0
- package/dist/steps/store-splitted-abc-converted-orig.d.ts +2 -0
- package/dist/steps/store-splitted-abc-converted-orig.js +4 -0
- package/dist/steps/store-splitted-text.d.ts +2 -0
- package/dist/steps/store-splitted-text.js +3 -0
- package/dist/steps/taraskevize.d.ts +1 -0
- package/dist/steps/taraskevize.js +14 -0
- package/dist/steps/to-lower-case.d.ts +1 -0
- package/dist/steps/to-lower-case.js +2 -0
- package/dist/steps/trim.d.ts +1 -0
- package/dist/steps/trim.js +2 -0
- package/dist/steps/types.d.ts +10 -0
- package/dist/steps/types.js +1 -0
- package/dist/steps/whitespaces.d.ts +20 -0
- package/dist/steps/whitespaces.js +14 -0
- package/dist/tarask.d.ts +10 -0
- package/dist/tarask.js +8 -0
- package/dist/types.d.ts +73 -0
- package/dist/types.js +1 -0
- package/package.json +3 -8
- package/dist/index.cjs +0 -2588
package/dist/bin.d.ts
ADDED
package/dist/bin.js
CHANGED
|
@@ -1,195 +1,148 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
REPLACE_J,
|
|
5
|
-
VARIATION,
|
|
6
|
-
TaraskConfig,
|
|
7
|
-
tarask,
|
|
8
|
-
pipelines
|
|
9
|
-
} from "./index.js";
|
|
10
|
-
const prefix = "\x1B[34m[taraskevizer]\x1B[0m ";
|
|
2
|
+
import { dicts, REPLACE_J, VARIATION, TaraskConfig, tarask, pipelines, } from './index.js';
|
|
3
|
+
const prefix = '\x1b[34m[taraskevizer]\x1b[0m ';
|
|
11
4
|
const printWithPrefix = (msg) => {
|
|
12
|
-
|
|
5
|
+
process.stdout.write(prefix + msg + '\n');
|
|
13
6
|
};
|
|
14
7
|
process.argv.splice(0, 2);
|
|
15
8
|
const checkForOptions = (options) => process.argv[0] && options.includes(process.argv[0].toLowerCase());
|
|
16
|
-
if (checkForOptions([
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
if (checkForOptions(['-v', '--version'])) {
|
|
10
|
+
printWithPrefix(__VERSION__);
|
|
11
|
+
process.exit(0);
|
|
19
12
|
}
|
|
20
|
-
if (checkForOptions([
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
EXAMPLES
|
|
25
|
-
|
|
26
|
-
Convert and latinize a word
|
|
27
|
-
tarask --latin 'планета'
|
|
28
|
-
Will print "p\x1B[32ml\x1B[0ma\x1B[32mne\x1B[0mta"
|
|
29
|
-
|
|
30
|
-
Read from one file and write converted text to another
|
|
31
|
-
tarask < ./cyr-text.txt > ./lat-text.txt
|
|
32
|
-
|
|
33
|
-
Enter interactive mode
|
|
34
|
-
tarask
|
|
35
|
-
Will print "\x1B[34m[taraskevizer]\x1B[0m Enter the text:" and wait until you press Enter
|
|
36
|
-
|
|
37
|
-
OPTIONS
|
|
38
|
-
|
|
39
|
-
General:
|
|
40
|
-
-h --help
|
|
41
|
-
-v --version
|
|
42
|
-
|
|
43
|
-
Alphabet:
|
|
44
|
-
-l --latin
|
|
45
|
-
-lj --latin-ji
|
|
46
|
-
-a --arabic
|
|
47
|
-
|
|
48
|
-
When to replace і(i) by й(j) after vowels:
|
|
49
|
-
-jr --jrandom
|
|
50
|
-
-ja --jalways
|
|
51
|
-
|
|
52
|
-
Replace ґ(g) by г(h) in cyrillic alphabet:
|
|
53
|
-
--h
|
|
54
|
-
|
|
55
|
-
Variations:
|
|
56
|
-
-nv --no-variations
|
|
57
|
-
-fvo --first-variation-only
|
|
58
|
-
|
|
59
|
-
Mode (only one can be used):
|
|
60
|
-
-html --html
|
|
61
|
-
-abc --alphabet-only
|
|
62
|
-
|
|
63
|
-
Other:
|
|
64
|
-
-nec --not-escape-caps
|
|
65
|
-
-nc --no-color
|
|
66
|
-
`);
|
|
67
|
-
process.exit(0);
|
|
13
|
+
if (checkForOptions(['-h', '--help'])) {
|
|
14
|
+
printWithPrefix(__CLI_HELP__);
|
|
15
|
+
process.exit(0);
|
|
68
16
|
}
|
|
69
17
|
const cfg = new TaraskConfig({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
18
|
+
general: {},
|
|
19
|
+
html: { g: true },
|
|
20
|
+
nonHtml: { variations: VARIATION.ALL, ansiColors: true },
|
|
73
21
|
});
|
|
74
|
-
let mode =
|
|
22
|
+
let mode = 'plainText';
|
|
75
23
|
const toHashTable = (dict) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
24
|
+
const result = {};
|
|
25
|
+
for (const [options, callback] of dict)
|
|
26
|
+
for (const option of options)
|
|
27
|
+
result[option] = callback;
|
|
28
|
+
return result;
|
|
80
29
|
};
|
|
81
30
|
const optionDict = toHashTable([
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
]
|
|
31
|
+
[['--help', '-h'], () => { }],
|
|
32
|
+
[
|
|
33
|
+
['--latin', '-l'],
|
|
34
|
+
() => {
|
|
35
|
+
cfg.general.abc = dicts.alphabets.latin;
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
['--latin-ji', '-lj'],
|
|
40
|
+
() => {
|
|
41
|
+
cfg.general.abc = dicts.alphabets.latinJi;
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
[
|
|
45
|
+
['--arabic', '-a'],
|
|
46
|
+
() => {
|
|
47
|
+
cfg.general.abc = dicts.alphabets.arabic;
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
['--jrandom', '-jr'],
|
|
52
|
+
() => {
|
|
53
|
+
cfg.general.j = REPLACE_J.RANDOM;
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
['--jalways', '-ja'],
|
|
58
|
+
() => {
|
|
59
|
+
cfg.general.j = REPLACE_J.ALWAYS;
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
[
|
|
63
|
+
['--no-escape-caps', '-nec'],
|
|
64
|
+
() => {
|
|
65
|
+
cfg.general.doEscapeCapitalized = false;
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
['--h'],
|
|
70
|
+
() => {
|
|
71
|
+
cfg.nonHtml.h = true;
|
|
72
|
+
cfg.html.g = false;
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
['--no-variations', '-nv'],
|
|
77
|
+
() => {
|
|
78
|
+
cfg.nonHtml.variations = VARIATION.NO;
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
['--first-variation-only', '-fvo'],
|
|
83
|
+
() => {
|
|
84
|
+
cfg.nonHtml.variations = VARIATION.FIRST;
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
['--no-color', '-nc'],
|
|
89
|
+
() => {
|
|
90
|
+
cfg.nonHtml.ansiColors = false;
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
[
|
|
94
|
+
['--html', '-html'],
|
|
95
|
+
() => {
|
|
96
|
+
mode = 'html';
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
['--alphabet-only', '-abc'],
|
|
101
|
+
() => {
|
|
102
|
+
mode = 'abcOnly';
|
|
103
|
+
},
|
|
104
|
+
],
|
|
157
105
|
]);
|
|
158
106
|
let currOption;
|
|
159
107
|
process.argv.reverse();
|
|
160
|
-
while (currOption = process.argv.pop()) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
108
|
+
while ((currOption = process.argv.pop())) {
|
|
109
|
+
if (currOption in optionDict) {
|
|
110
|
+
optionDict[currOption]();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
process.argv.push(currOption);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
167
116
|
}
|
|
168
|
-
let text =
|
|
117
|
+
let text = '';
|
|
169
118
|
if (process.argv.length) {
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
119
|
+
text = process.argv.reverse().join(' ');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
const chunks = [];
|
|
123
|
+
let length = 0;
|
|
124
|
+
if (process.stdin.isTTY) {
|
|
125
|
+
printWithPrefix('Enter the text');
|
|
126
|
+
for await (const chunk of process.stdin) {
|
|
127
|
+
chunks.push(chunk);
|
|
128
|
+
length += chunk.length;
|
|
129
|
+
if (chunk.includes('\n'))
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
180
132
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
133
|
+
else {
|
|
134
|
+
for await (const chunk of process.stdin) {
|
|
135
|
+
chunks.push(chunk);
|
|
136
|
+
length += chunk.length;
|
|
137
|
+
}
|
|
185
138
|
}
|
|
186
|
-
|
|
187
|
-
text = Buffer.concat(chunks, length).toString();
|
|
139
|
+
text = Buffer.concat(chunks, length).toString();
|
|
188
140
|
}
|
|
189
|
-
if (process.stdout.write(tarask(text, pipelines[mode], cfg) +
|
|
190
|
-
process.exit(0);
|
|
191
|
-
} else {
|
|
192
|
-
process.stdout.once("drain", () => {
|
|
141
|
+
if (process.stdout.write(tarask(text, pipelines[mode], cfg) + '\n')) {
|
|
193
142
|
process.exit(0);
|
|
194
|
-
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
process.stdout.once('drain', () => {
|
|
146
|
+
process.exit(0);
|
|
147
|
+
});
|
|
195
148
|
}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PartialReadonly, HtmlOptions, NonHtmlOptions, TaraskOptions } from './types';
|
|
2
|
+
export declare class TaraskConfig {
|
|
3
|
+
constructor(options?: PartialReadonly<{
|
|
4
|
+
general: PartialReadonly<TaraskOptions>;
|
|
5
|
+
html: PartialReadonly<HtmlOptions>;
|
|
6
|
+
nonHtml: PartialReadonly<NonHtmlOptions>;
|
|
7
|
+
}>);
|
|
8
|
+
/** @see {@link TaraskOptions} */
|
|
9
|
+
general: TaraskOptions;
|
|
10
|
+
/** @see {@link HtmlOptions} */
|
|
11
|
+
html: HtmlOptions;
|
|
12
|
+
/** @see {@link NonHtmlOptions} */
|
|
13
|
+
nonHtml: NonHtmlOptions;
|
|
14
|
+
}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { alphabets } from './dict';
|
|
2
|
+
import { REPLACE_J, VARIATION } from './constants';
|
|
3
|
+
export class TaraskConfig {
|
|
4
|
+
constructor(options) {
|
|
5
|
+
if (!options)
|
|
6
|
+
return;
|
|
7
|
+
for (const [target, source] of [
|
|
8
|
+
[this.general, options.general],
|
|
9
|
+
[this.html, options.html],
|
|
10
|
+
[this.nonHtml, options.nonHtml],
|
|
11
|
+
]) {
|
|
12
|
+
if (source)
|
|
13
|
+
for (const [key, value] of Object.entries(source)) {
|
|
14
|
+
if (value !== undefined)
|
|
15
|
+
target[key] = value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
general = {
|
|
21
|
+
abc: alphabets.cyrillic,
|
|
22
|
+
j: REPLACE_J.NEVER,
|
|
23
|
+
doEscapeCapitalized: true,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
html = {
|
|
27
|
+
g: false,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
nonHtml = {
|
|
31
|
+
h: false,
|
|
32
|
+
ansiColors: false,
|
|
33
|
+
variations: VARIATION.ALL,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const REPLACE_J: {
|
|
2
|
+
readonly NEVER: 0;
|
|
3
|
+
readonly RANDOM: 1;
|
|
4
|
+
readonly ALWAYS: 2;
|
|
5
|
+
};
|
|
6
|
+
export declare const VARIATION: {
|
|
7
|
+
readonly NO: 0;
|
|
8
|
+
readonly FIRST: 1;
|
|
9
|
+
readonly ALL: 2;
|
|
10
|
+
};
|
|
11
|
+
type ValueOf<T> = T[keyof T];
|
|
12
|
+
export type OptionJ = ValueOf<typeof REPLACE_J>;
|
|
13
|
+
export type Variation = ValueOf<typeof VARIATION>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { dictFrom } from '../lib';
|
|
2
|
+
const soft = '\u0652(?=[еёіюяь])';
|
|
3
|
+
const presoft = '([تزكثࢮбвгджзйклмнпрстфхцчшў])\u0652?(\u0651?)';
|
|
4
|
+
|
|
5
|
+
export const arabic = {
|
|
6
|
+
lower: dictFrom.raw([
|
|
7
|
+
[/ л[ая]/, ' لا'],
|
|
8
|
+
[/л[ая]/, 'ـلا'],
|
|
9
|
+
// падваеньне зычнага, шадда
|
|
10
|
+
[/([бвгджзйклмнпрстфхцчшў]|д[зж])\1/, '$1\u0651'],
|
|
11
|
+
// няма галоснага, сукун
|
|
12
|
+
[/([бвгджзйклмнпрстфхцчшў])/, '$1\u0652'],
|
|
13
|
+
// а, аліф
|
|
14
|
+
[/а/, '\u0627а'],
|
|
15
|
+
// першая галосная, аліф
|
|
16
|
+
[/ (?=[еэыуо])/, ' \u0627'],
|
|
17
|
+
['д\u0652з' + soft, 'ࢮ'],
|
|
18
|
+
['з' + soft, 'ز'],
|
|
19
|
+
['к' + soft, 'ك'],
|
|
20
|
+
['с' + soft, 'ث'],
|
|
21
|
+
['т' + soft, 'ت'],
|
|
22
|
+
[/([تزكث])і/, 'ы'],
|
|
23
|
+
// $2 - шадда
|
|
24
|
+
[presoft + '[аяэе]', '$1$2\u064E'],
|
|
25
|
+
[presoft + '[іы]', '$1$2\u0650'],
|
|
26
|
+
[/ і /, ' \u0627\u0650 '],
|
|
27
|
+
[presoft + '[оёую]', '$1$2\u064F'],
|
|
28
|
+
[/ʼ/, 'ع'],
|
|
29
|
+
[/ь/, ''],
|
|
30
|
+
// [/[ьʼ]/, ''],
|
|
31
|
+
[/[яе]/, 'ي\u064E'],
|
|
32
|
+
[/і/, 'ي\u0650'],
|
|
33
|
+
[/[ёю]/, 'ي\u064F'],
|
|
34
|
+
[/[аэ]/, '\u064E'],
|
|
35
|
+
[/[ыі]/, '\u0650'],
|
|
36
|
+
[/[оу]/, '\u064F'],
|
|
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
|
+
], 'gi'),
|
|
62
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { iwords } from '../iwords';
|
|
2
|
+
import { dictFrom } from '../lib';
|
|
3
|
+
const common = {
|
|
4
|
+
lower: ([
|
|
5
|
+
[
|
|
6
|
+
[/(?<=[аеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)е/, 'je'],
|
|
7
|
+
[/(?<=[eаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)ё/, 'jo'],
|
|
8
|
+
[/(?<=[eoаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)ю/, 'ju'],
|
|
9
|
+
[/(?<=[eouаеёіоуўыэюяьʼ| >АЕЁІОУЎЫЭЮЯЬ]|^)я/, 'ja'],
|
|
10
|
+
],
|
|
11
|
+
[
|
|
12
|
+
[/ʼ/, ''],
|
|
13
|
+
[/ць/, 'ć'],
|
|
14
|
+
[/зь/, 'ź'],
|
|
15
|
+
[/сь/, 'ś'],
|
|
16
|
+
[/нь/, 'ń'],
|
|
17
|
+
[/ль/, 'l'],
|
|
18
|
+
[/а/, 'a'],
|
|
19
|
+
[/б/, 'b'],
|
|
20
|
+
[/в/, 'v'],
|
|
21
|
+
[/г/, 'h'],
|
|
22
|
+
[/ґ/, 'g'],
|
|
23
|
+
[/д/, 'd'],
|
|
24
|
+
[/е/, 'ie'],
|
|
25
|
+
[/ё/, 'io'],
|
|
26
|
+
[/ж/, 'ž'],
|
|
27
|
+
[/з/, 'z'],
|
|
28
|
+
[/і/, 'i'],
|
|
29
|
+
[/й/, 'j'],
|
|
30
|
+
[/к/, 'k'],
|
|
31
|
+
[/л/, 'ł'],
|
|
32
|
+
[/м/, 'm'],
|
|
33
|
+
[/н/, 'n'],
|
|
34
|
+
[/о/, 'o'],
|
|
35
|
+
[/п/, 'p'],
|
|
36
|
+
[/р/, 'r'],
|
|
37
|
+
[/с/, 's'],
|
|
38
|
+
[/т/, 't'],
|
|
39
|
+
[/у/, 'u'],
|
|
40
|
+
[/ў/, 'ŭ'],
|
|
41
|
+
[/ф/, 'f'],
|
|
42
|
+
[/х/, 'ch'],
|
|
43
|
+
[/ц/, 'c'],
|
|
44
|
+
[/ч/, 'č'],
|
|
45
|
+
[/ш/, 'š'],
|
|
46
|
+
[/ы/, 'y'],
|
|
47
|
+
[/э/, 'e'],
|
|
48
|
+
[/ю/, 'iu'],
|
|
49
|
+
[/я/, 'ia'],
|
|
50
|
+
[/łi(?=[eoua])/, 'l'],
|
|
51
|
+
[/łi/, 'li'],
|
|
52
|
+
],
|
|
53
|
+
]).map(dictFrom.nonGlobal),
|
|
54
|
+
upper: ([
|
|
55
|
+
[
|
|
56
|
+
[/ Е(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, ' Je'],
|
|
57
|
+
[/ Ё(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, ' Jo'],
|
|
58
|
+
[/ Ю(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, ' Ju'],
|
|
59
|
+
[/ Я(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/u, ' Ja'],
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
[/([АЕЁІОУЎЫЭЮЯЬ| ]\(?)Е/, '$1JE'],
|
|
63
|
+
[/([EАЕЁІОУЎЫЭЮЯЬ| ]\(?)Ё/, '$1JO'],
|
|
64
|
+
[/([EOАЕЁІОУЎЫЭЮЯЬ| ]\(?)Ю/, '$1JU'],
|
|
65
|
+
[/([EOUАЕЁІОУЎЫЭЮЯЬ| ]\(?)Я/, '$1JA'],
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
[/Е/, 'IE'],
|
|
69
|
+
[/Ё/, 'IO'],
|
|
70
|
+
[/Ю/, 'IU'],
|
|
71
|
+
[/Я/, 'IA'],
|
|
72
|
+
[/Ц[Ьь]/, 'Ć'],
|
|
73
|
+
[/З[Ьь]/, 'Ź'],
|
|
74
|
+
[/С[Ьь]/, 'Ś'],
|
|
75
|
+
[/Н[Ьь]/, 'Ń'],
|
|
76
|
+
[/Л[Ьь]/, 'L'],
|
|
77
|
+
[/А/, 'A'],
|
|
78
|
+
[/Б/, 'B'],
|
|
79
|
+
[/В/, 'V'],
|
|
80
|
+
[/Г/, 'H'],
|
|
81
|
+
[/Ґ/, 'G'],
|
|
82
|
+
[/Д/, 'D'],
|
|
83
|
+
[/Ж/, 'Ž'],
|
|
84
|
+
[/З/, 'Z'],
|
|
85
|
+
[/І/, 'I'],
|
|
86
|
+
[/Й/, 'J'],
|
|
87
|
+
[/К/, 'K'],
|
|
88
|
+
[/Л/, 'Ł'],
|
|
89
|
+
[/М/, 'M'],
|
|
90
|
+
[/Н/, 'N'],
|
|
91
|
+
[/О/, 'O'],
|
|
92
|
+
[/П/, 'P'],
|
|
93
|
+
[/Р/, 'R'],
|
|
94
|
+
[/С/, 'S'],
|
|
95
|
+
[/Т/, 'T'],
|
|
96
|
+
[/У/, 'U'],
|
|
97
|
+
[/Ў/, 'Ŭ'],
|
|
98
|
+
[/Ф/, 'F'],
|
|
99
|
+
[/ Х(?=[\p{Ll} ])/u, ' Ch'],
|
|
100
|
+
[/Х/, 'CH'],
|
|
101
|
+
[/Ц/, 'C'],
|
|
102
|
+
[/Ч/, 'Č'],
|
|
103
|
+
[/Ш/, 'Š'],
|
|
104
|
+
[/Ы/, 'Y'],
|
|
105
|
+
[/Э/, 'E'],
|
|
106
|
+
[/Ł[Ii](?=[AEOUaeou])/, 'L'],
|
|
107
|
+
[/Ł(?=[Ii])/, 'L'],
|
|
108
|
+
],
|
|
109
|
+
]).map(dictFrom.nonGlobal),
|
|
110
|
+
};
|
|
111
|
+
export const latin = {
|
|
112
|
+
lower: [...common.lower[0], [/ʼі/g, 'ji'], ...common.lower[1]],
|
|
113
|
+
upper: common.upper.flat(),
|
|
114
|
+
};
|
|
115
|
+
export const latinJi = {
|
|
116
|
+
lower: dictFrom
|
|
117
|
+
.raw([
|
|
118
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і Ў/, '$1j U'],
|
|
119
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і ў/, '$1j u'],
|
|
120
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )і /, '$1j '],
|
|
121
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І Ў/, '$1J U'],
|
|
122
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І ў/, '$1J u'],
|
|
123
|
+
[/([аеёіоуыэюяАЕЁІОУЫЭЮЯ] )І /, '$1J '],
|
|
124
|
+
[` і(?=${iwords})`, ' ji'],
|
|
125
|
+
[` І(?=${iwords})`, ' Ji'],
|
|
126
|
+
[` І(?=${iwords.toUpperCase()})`, ' JI'],
|
|
127
|
+
])
|
|
128
|
+
.concat([
|
|
129
|
+
...common.lower[0],
|
|
130
|
+
[/([eouaаеёіоуыэюяʼАЕЁІОУЫЭЮЯЬ] *)і/g, '$1ji'],
|
|
131
|
+
...common.lower[1],
|
|
132
|
+
]),
|
|
133
|
+
upper: [
|
|
134
|
+
...common.upper[0],
|
|
135
|
+
[/([eoua] *)І(?=[ \p{P}\d]*\p{Lu}?\p{Ll})/gu, '$1Ji'],
|
|
136
|
+
...common.upper[1],
|
|
137
|
+
[/([AOEUАЕЁІОУЎЫЭЮЯ][( ]*)І/g, '$1JI'],
|
|
138
|
+
...common.upper[2],
|
|
139
|
+
[/ JIŁ -/g, ' IŁ -'],
|
|
140
|
+
],
|
|
141
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Dict } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* If {@link Alphabet.upper} in not defined,
|
|
4
|
+
* it is assumed that the alphabet is case-insensitive,
|
|
5
|
+
* so {@link Alphabet.lower} should replace both
|
|
6
|
+
* upper and lower case letters.
|
|
7
|
+
*/
|
|
8
|
+
export type Alphabet = {
|
|
9
|
+
lower: Dict;
|
|
10
|
+
upper?: Dict;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|