hebrew-transliteration 2.6.5 → 2.7.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/README.md +2 -391
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/remove.js.map +2 -2
- package/dist/cjs/schema.js +160 -3
- package/dist/cjs/schema.js.map +2 -2
- package/dist/cjs/schemas/jss.js +1 -1
- package/dist/cjs/schemas/jss.js.map +1 -1
- package/dist/cjs/schemas/tiberian.js +8 -0
- package/dist/cjs/schemas/tiberian.js.map +2 -2
- package/dist/cjs/sequence.js.map +2 -2
- package/dist/cjs/transliterate.js +2 -2
- package/dist/cjs/transliterate.js.map +2 -2
- package/dist/esm/index.js +4 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/remove.js +8 -11
- package/dist/esm/remove.js.map +1 -1
- package/dist/esm/schema.js +1300 -211
- package/dist/esm/schema.js.map +1 -1
- package/dist/esm/schemas/jss.js +1 -1
- package/dist/esm/schemas/jss.js.map +1 -1
- package/dist/esm/schemas/tiberian.js +8 -0
- package/dist/esm/schemas/tiberian.js.map +1 -1
- package/dist/esm/sequence.js +9 -7
- package/dist/esm/sequence.js.map +1 -1
- package/dist/esm/transliterate.js +21 -18
- package/dist/esm/transliterate.js.map +1 -1
- package/dist/types/index.d.ts +5 -8
- package/dist/types/remove.d.ts +148 -13
- package/dist/types/schema.d.ts +1396 -227
- package/dist/types/sequence.d.ts +9 -7
- package/dist/types/transliterate.d.ts +15 -16
- package/package.json +21 -20
package/README.md
CHANGED
|
@@ -43,396 +43,7 @@ transliterate("אֱלֹהִים");
|
|
|
43
43
|
|
|
44
44
|
## DOCS
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
This is a JavaScript package for transliterating Hebrew.
|
|
49
|
-
|
|
50
|
-
It exports 3 [functions](#functions):
|
|
51
|
-
|
|
52
|
-
1. [`transliterate()`](#transliterate) — the main function which transliterates Hebrew
|
|
53
|
-
2. [`remove()`](#remove) — removes taamim and optionally removes certain niqqudim
|
|
54
|
-
3. [`sequence()`](#sequence) — sequences Hebrew characters according to the [SBL Hebrew Font Manual](https://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf)
|
|
55
|
-
|
|
56
|
-
And it exports 2 [classes](#classes):
|
|
57
|
-
|
|
58
|
-
1. [`Text`](#text) — the [`Text`](https://charlesloder.github.io/havarotjs/classes/text.Text.html) class from the `havarotjs` package
|
|
59
|
-
2. [`Schema`](#schema) — a schema for transliterating Hebrew
|
|
60
|
-
|
|
61
|
-
### Functions
|
|
62
|
-
|
|
63
|
-
#### `transliterate()`
|
|
64
|
-
|
|
65
|
-
Takes a `string` or [`Text`](#text), and optionally a [`Schema`](#schema) or `Partial<Schema>`
|
|
66
|
-
|
|
67
|
-
```javascript
|
|
68
|
-
heb.transliterate("אֱלֹהִים");
|
|
69
|
-
// ʾĕlōhîm
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
If no [`Schema`](#schema) is passed, then the package defaults to SBL's academic style.
|
|
73
|
-
|
|
74
|
-
You can pass in a `Partial<Schema>` that will modify SBL's academic style:
|
|
75
|
-
|
|
76
|
-
```javascript
|
|
77
|
-
heb.transliterate("שָׁלוֹם", { SHIN: "sh" });
|
|
78
|
-
// shālôm
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
There are premade schemas as well.
|
|
82
|
-
|
|
83
|
-
```javascript
|
|
84
|
-
const brillAcademic = require("hebrew-transliteration/schemas").brillAcademic;
|
|
85
|
-
|
|
86
|
-
heb.transliterate("בְּבֵית", brillAcademic)
|
|
87
|
-
// bᵉḇêṯ
|
|
88
|
-
```
|
|
89
|
-
**Note**: schemas are not endorsed by publishers.
|
|
90
|
-
|
|
91
|
-
If you need a fully customized transliteration, it is best to use the [`Schema`](#schema) constructor:
|
|
92
|
-
|
|
93
|
-
```javascript
|
|
94
|
-
const schema = new heb.Schema({
|
|
95
|
-
ALEF: "'",
|
|
96
|
-
BET: "B",
|
|
97
|
-
...
|
|
98
|
-
QAMETS: "A",
|
|
99
|
-
...
|
|
100
|
-
}) // truncated for brevity
|
|
101
|
-
|
|
102
|
-
heb.transliterate("אָ֣ב", schema)
|
|
103
|
-
// 'AB
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
#### `remove()`
|
|
108
|
-
|
|
109
|
-
Takes `string` and `RemoveOptions`.
|
|
110
|
-
|
|
111
|
-
The default removes accents (i.e. characters called HEBREW ACCENT) and metheg and rafe.
|
|
112
|
-
|
|
113
|
-
```javascript
|
|
114
|
-
heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔");
|
|
115
|
-
// שָׂרַי אִשְׁתְּךָ;
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
The `RemoveOptions` can be customized.
|
|
119
|
-
|
|
120
|
-
```javascript
|
|
121
|
-
heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { SHIN_DOT: true, SIN_DOT: true });
|
|
122
|
-
// שָרַ֣י אִשְתְּךָ֔
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Note:** unlike a `Schema` where a `Partial<Schema>` extends the default, `RemoveOptions` does not accept a `Partial<RemoveOptions>`.
|
|
126
|
-
|
|
127
|
-
All properties for `RemoveOptions` can be found in the [source](src/remove.ts).
|
|
128
|
-
|
|
129
|
-
There are some preset options availables as well.
|
|
130
|
-
|
|
131
|
-
```javascript
|
|
132
|
-
const opts = require("hebrew-transliteration/removeOptions");
|
|
133
|
-
heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", opts.all);
|
|
134
|
-
// שרי אשתך, וימצאו
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
#### `sequence()`
|
|
139
|
-
|
|
140
|
-
Takes a `string`. Returns a string of properly sequenced characters according to the [SBL Hebrew Font manual](https://www.sbl-site.org/Fonts/SBLHebrewUserManual1.5x.pdf) following the pattern of: consonant - dagesh - vowel - ta'am
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
heb.sequence("\u{5D1}\u{5B0}\u{5BC}\u{5E8}\u{5B5}\u{5D0}\u{5E9}\u{5B4}\u{5C1}\u{596}\u{5D9}\u{5EA}");
|
|
144
|
-
// "\u{5D1}\u{5BC}\u{5B0}\u{5E8}\u{5B5}\u{5D0}\u{5E9}\u{5C1}\u{5B4}\u{596}\u{5D9}\u{5EA}"
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Classes
|
|
148
|
-
|
|
149
|
-
#### Text
|
|
150
|
-
|
|
151
|
-
The [`Text`](https://charlesloder.github.io/havarotjs/classes/text.Text.html) class from the [`havarotjs`](https://www.npmjs.com/package/havarotjs) package.
|
|
152
|
-
|
|
153
|
-
This class is used by [`transliterate()`](#transliterate) internally to syllabify Hebrew text, but it is exposed as well.
|
|
154
|
-
|
|
155
|
-
```javascript
|
|
156
|
-
const text = new heb.Text("הֲבָרֹות");
|
|
157
|
-
text.syllables;
|
|
158
|
-
// [
|
|
159
|
-
// Syllable { original: "הֲ" },
|
|
160
|
-
// Syllable { original: "בָ" },
|
|
161
|
-
// Syllable { original: "רֹות" }
|
|
162
|
-
// ]
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
If a `Text` is passed into [`transliterate()`](#transliterate) instead of a `string`, then the syllabification from the `Text` class is used.
|
|
166
|
-
If a `string` is passed in, then syllabification come from the options passed into the [`Schema`](#schema).
|
|
167
|
-
See more under [syllabification](#syllabification).
|
|
168
|
-
|
|
169
|
-
#### Schema
|
|
170
|
-
|
|
171
|
-
A `Schema` is used to define a schema for transliteration. See the [`Schema` source](src/schema.ts) for all available properties.
|
|
172
|
-
|
|
173
|
-
The `Schema` can be divided into a few categories.
|
|
174
|
-
|
|
175
|
-
##### 1) Syllabification
|
|
176
|
-
|
|
177
|
-
The options used for syllabifying Hebrew text can be found [here](https://charlesloder.github.io/havarotjs/interfaces/text.SylOpts.html)
|
|
178
|
-
|
|
179
|
-
###### Differences between `Text` and `Schema`
|
|
180
|
-
|
|
181
|
-
There are 5 options for syllabification that are the [same as the ones used by the `Text`](https://charlesloder.github.io/havarotjs/interfaces/text.SylOpts.html) class.
|
|
182
|
-
|
|
183
|
-
Read more about the syllabification options for the [`Text`](https://charlesloder.github.io/havarotjs/interfaces/text.SylOpts.html) and a [higher level overview](https://charlesloder.github.io/havarotjs/pages/Linguistic/syllabification.html)
|
|
184
|
-
|
|
185
|
-
###### Precedence of `Text` over `Schema`
|
|
186
|
-
|
|
187
|
-
The syllabification options set by `Schema` are used if a `string` is passed into [`transliterate()`](#transliterate). If a `Text` is passed into [`transliterate()`](#transliterate) instead of a `string`, then the syllabification from the `Text` class is used:
|
|
188
|
-
|
|
189
|
-
```javascript
|
|
190
|
-
// using default
|
|
191
|
-
heb.transliterate("חָכְמָ֣ה"); // ḥokmâ
|
|
192
|
-
|
|
193
|
-
// using Schema for syllabification
|
|
194
|
-
heb.transliterate("חָכְמָ֣ה", { qametsQatan: false }); // ḥākǝmâ
|
|
195
|
-
|
|
196
|
-
// using Text for syllabification
|
|
197
|
-
heb.transliterate(new heb.Text("חָכְמָ֣ה", { qametsQatan: false })); // ḥākǝmâ
|
|
198
|
-
|
|
199
|
-
// using Schema and Text — Text takes precedence
|
|
200
|
-
heb.transliterate(new heb.Text("חָכְמָ֣ה", { qametsQatan: true }), { qametsQatan: false }); // ḥokmâ
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
**Note**: `qametsQatan` only converts a regular _qamets_ character; if a [_qamets qatan_ character](https://www.compart.com/en/unicode/U+05C7) is used, it will always be a _qamets qatan_.
|
|
204
|
-
|
|
205
|
-
##### 2) Characters
|
|
206
|
-
|
|
207
|
-
Most `Schema` properties are for defining single Hebrew characters:
|
|
208
|
-
|
|
209
|
-
```javascript
|
|
210
|
-
heb.transliterate("אָ", { ALEF: "@", QAMETS: "A" });
|
|
211
|
-
// @A
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
##### 3) Orthographic Features
|
|
215
|
-
|
|
216
|
-
Some properties are for defining common Hebrew orthographies for:
|
|
217
|
-
|
|
218
|
-
###### _BeGaDKePhaT_
|
|
219
|
-
|
|
220
|
-
There are properties for the digraphs of _BeGaDKePhaT_ letters:
|
|
221
|
-
|
|
222
|
-
- `BET_DAGESH`
|
|
223
|
-
- `GIMEL_DAGESH`
|
|
224
|
-
- `DALET_DAGESH`
|
|
225
|
-
- `KAF_DAGESH`
|
|
226
|
-
- `PE_DAGESH`
|
|
227
|
-
- `TAV_DAGESH`
|
|
228
|
-
|
|
229
|
-
Each one is the consonant character followed by the _dagesh_ character (U+05BC).
|
|
230
|
-
|
|
231
|
-
These are helpful for distinguishing between spirantized forms.
|
|
232
|
-
|
|
233
|
-
```javascript
|
|
234
|
-
heb.transliterate("בְּבֵית", { BET: "b" });
|
|
235
|
-
// bǝbêt
|
|
236
|
-
|
|
237
|
-
heb.transliterate("בְּבֵית", { BET: "v", BET_DAGESH: "b" });
|
|
238
|
-
// bǝvêt
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
###### Matres Lectionis
|
|
242
|
-
|
|
243
|
-
The following properties are for _matres lectionis_:
|
|
244
|
-
|
|
245
|
-
- `HIRIQ_YOD`
|
|
246
|
-
- `TSERE_YOD`
|
|
247
|
-
- `SEGOL_YOD`
|
|
248
|
-
- `SHUREQ`
|
|
249
|
-
- `HOLAM_VAV`
|
|
250
|
-
- `QAMATS_HE`
|
|
251
|
-
- `SEGOL_HE`
|
|
252
|
-
- `TSERE_HE`
|
|
253
|
-
|
|
254
|
-
```javascript
|
|
255
|
-
heb.transliterate("פֶּה", { SEGOL_HE: "é" });
|
|
256
|
-
// pé
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
###### Others
|
|
260
|
-
|
|
261
|
-
There are other orthographic features:
|
|
262
|
-
|
|
263
|
-
- `MS_SUFX` — HEBREW LETTER QAMATS (U+05B8) and YOD (U+05D9) and VAV (U+05D5) יו◌ָ
|
|
264
|
-
- `DIVINE_NAME` — the full form of the divine name - יהוה
|
|
265
|
-
- `DIVINE_NAME_ELOHIM` — optionally, the form of the divine name pointed as ʾelōhîm (e.g. יֱהֹוִה)
|
|
266
|
-
- `SYLLABLE_SEPARATOR` — a syllable separator, usually an empty string
|
|
267
|
-
- `DAGESH_CHAZAQ` — if true, repeats the consonant with the _dagesh_, or can take a string
|
|
268
|
-
|
|
269
|
-
```javascript
|
|
270
|
-
heb.transliterate("שַׁבָּת", { DAGESH_CHAZAQ: true });
|
|
271
|
-
// šabbāt
|
|
272
|
-
|
|
273
|
-
heb.transliterate("שַׁבָּת", { DAGESH_CHAZAQ: false });
|
|
274
|
-
// šabāt
|
|
275
|
-
|
|
276
|
-
heb.transliterate("שַׁבָּת", { DAGESH_CHAZAQ: "\u0301" });
|
|
277
|
-
// šab́āt
|
|
278
|
-
|
|
279
|
-
heb.transliterate("הָאָֽרֶץ", { SYLLABLE_SEPARATOR: "-" });
|
|
280
|
-
// hā-ʾā-reṣ
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
##### 4) Others
|
|
284
|
-
|
|
285
|
-
###### Additional Features
|
|
286
|
-
|
|
287
|
-
The `ADDITIONAL_FEATURES` property is for defining non-typical Hebrew orthography, example:
|
|
288
|
-
|
|
289
|
-
```javascript
|
|
290
|
-
heb.transliterate("הַזֹּאת", {
|
|
291
|
-
ADDITIONAL_FEATURES: [
|
|
292
|
-
{
|
|
293
|
-
FEATURE: "cluster",
|
|
294
|
-
HEBREW: "זּ",
|
|
295
|
-
TRANSLITERATION: "tz"
|
|
296
|
-
}
|
|
297
|
-
]
|
|
298
|
-
});
|
|
299
|
-
// hatzōʾt
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
- The orthography `זּ` is most often a doubling of the `ZAYIN` (i.e. `'z'` with no _dagesh_, and `'zz'` with a _dagesh chazaq_)
|
|
303
|
-
- In the Romaniote reading tradition, however, the `ZAYIN` is usually transliterated with `'z'` (really `'ζ'`),
|
|
304
|
-
- but a `ZAYIN` followed by a _dagesh_ is transliterated as `'tz'` (really `'τζ'`)
|
|
305
|
-
|
|
306
|
-
Each additional feature consists of 4 properties:
|
|
307
|
-
|
|
308
|
-
1. `FEATURE` — has three options:
|
|
309
|
-
- `"cluster"` — a `cluster` is any combination of a single character and optionally a *dagesh* and vowel.
|
|
310
|
-
- `"syllable"` — a `syllable` is any combination of a multiple characters and a single vowel and optionally a *dagesh*
|
|
311
|
-
- `"word"` — covers everything else
|
|
312
|
-
2. `HEBREW` — the Hebrew text to be transliterated
|
|
313
|
-
3. `TRANSLITERATION` — the text used to transliterate the Hebrew text, or a callback function
|
|
314
|
-
4. `PASS_THROUGH` — if `true` passes the characters of the result of the `TRANSLITERATION` callback to the be mapped to the schema. If `TRANSLITERATION` is a string, this does nothing. Default `true`.
|
|
315
|
-
|
|
316
|
-
**Using a callback**
|
|
317
|
-
|
|
318
|
-
A callback can be used `TRANSLITERATION` instead of just a string.
|
|
319
|
-
|
|
320
|
-
```js
|
|
321
|
-
const heb = require("hebrew-transliteration");
|
|
322
|
-
const rules = require("hebrew-transliteration/dist/rules");
|
|
323
|
-
|
|
324
|
-
// use a callback to transliterate a vocal sheva with the same character as the next syllable
|
|
325
|
-
heb.transliterate("בְּרֵאשִׁ֖ית וַיַּבְדֵּל", {
|
|
326
|
-
ADDITIONAL_FEATURES: [
|
|
327
|
-
{
|
|
328
|
-
// matches any sheva in a syllable that is NOT preceded by a vowel character
|
|
329
|
-
HEBREW: "(?<![\u{05B1}-\u{05BB}\u{05C7}].*)\u{05B0}",
|
|
330
|
-
FEATURE: "syllable",
|
|
331
|
-
TRANSLITERATION: function (syllable, _hebrew, schema) {
|
|
332
|
-
const next = syllable.next;
|
|
333
|
-
// ensure type safety
|
|
334
|
-
const nextVowel = next.vowelName === "SHEVA" ? "VOCAL_SHEVA" : next.vowelName;
|
|
335
|
-
|
|
336
|
-
if (next && nextVowel) {
|
|
337
|
-
const vowel = schema[nextVowel] || "";
|
|
338
|
-
return syllable.text.replace(new RegExp("\u{05B0}", "u"), vowel);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return syllable.text;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
]
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
// bērēʾšît wayyabdēl
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
:warning: this is an experimental `ADDTIONAL_FEATURES`; results may not always meet expectations.
|
|
352
|
-
|
|
353
|
-
###### Stress Marker
|
|
354
|
-
|
|
355
|
-
The `STRESS_MARKER` property is an optional property to indicate stress in transliteration.
|
|
356
|
-
|
|
357
|
-
It's properties are:
|
|
358
|
-
- location
|
|
359
|
-
- mark
|
|
360
|
-
- exclude (optional)
|
|
361
|
-
|
|
362
|
-
**Example**
|
|
363
|
-
```javascript
|
|
364
|
-
heb.transliterate("מֶ֣לֶךְ", { STRESS_MARKER: { location: "after-vowel", mark: "\u0301" } });
|
|
365
|
-
// mélek
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
_mark_
|
|
369
|
-
|
|
370
|
-
The string used to mark stress (e.g. [a combining acute accent (U+0301)](https://www.compart.com/en/unicode/U+0301) )
|
|
371
|
-
|
|
372
|
-
_location_
|
|
373
|
-
|
|
374
|
-
The `location` has four options:
|
|
375
|
-
|
|
376
|
-
- `"before-syllable"`
|
|
377
|
-
- `"after-syllable"`
|
|
378
|
-
- `"before-vowel"`
|
|
379
|
-
- `"after-vowel"`
|
|
380
|
-
|
|
381
|
-
A combining mark (e.g. `"\u0301"`) placed `"after-vowel"` will print on top of the vowel, and placed after a digraph will print on the second vowel.
|
|
382
|
-
|
|
383
|
-
```javascript
|
|
384
|
-
heb.transliterate("בֵּ֣ית", {
|
|
385
|
-
TSERE_YOD: "ei",
|
|
386
|
-
STRESS_MARKER: { location: "after-vowel", mark: "\u0301" }
|
|
387
|
-
});
|
|
388
|
-
// beít
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
_exclude_
|
|
392
|
-
|
|
393
|
-
An optional property determining whether to exclude the mark on certain syllables.
|
|
394
|
-
|
|
395
|
-
It has three options
|
|
396
|
-
- `undefined`/`"never"`
|
|
397
|
-
- `"single"`
|
|
398
|
-
- `"final"`
|
|
399
|
-
|
|
400
|
-
Examples:
|
|
401
|
-
|
|
402
|
-
```js
|
|
403
|
-
// undefined and "never" are the same
|
|
404
|
-
heb.transliterate("בֹּ֖קֶר י֥וֹם אֶחָֽד׃ ", {
|
|
405
|
-
STRESS_MARKER: {
|
|
406
|
-
location: "after-vowel",
|
|
407
|
-
mark: "\u0301",
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
// bṓqer yốm ʾeḥā́d
|
|
412
|
-
|
|
413
|
-
// exclude only single syllable words
|
|
414
|
-
heb.transliterate("בֹּ֖קֶר י֥וֹם אֶחָֽד׃ ", {
|
|
415
|
-
STRESS_MARKER: {
|
|
416
|
-
location: "after-vowel",
|
|
417
|
-
mark: "\u0301",
|
|
418
|
-
exclude: "single"
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
// bṓqer yôm ʾeḥā́d
|
|
423
|
-
|
|
424
|
-
// exclude when accent is on the final syllable
|
|
425
|
-
// implicitly excludes single syllable words
|
|
426
|
-
heb.transliterate("בֹּ֖קֶר י֥וֹם אֶחָֽד׃ ", {
|
|
427
|
-
STRESS_MARKER: {
|
|
428
|
-
location: "after-vowel",
|
|
429
|
-
mark: "\u0301",
|
|
430
|
-
exclude: "single"
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
// bṓqer yôm ʾeḥād
|
|
435
|
-
```
|
|
46
|
+
View the docs online at https://charlesloder.github.io/hebrew-transliteration/getting-started/quick-start
|
|
436
47
|
|
|
437
48
|
## Live
|
|
438
49
|
|
|
@@ -440,4 +51,4 @@ Use it live at [https://hebrewtransliteration.app](https://hebrewtransliteration
|
|
|
440
51
|
|
|
441
52
|
## Contributing
|
|
442
53
|
|
|
443
|
-
See [contributing](./CONTRIBUTING.md)
|
|
54
|
+
See [contributing](./CONTRIBUTING.md)
|
package/dist/cjs/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var esm_exports = {};
|
|
19
19
|
__export(esm_exports, {
|
|
20
|
+
SBL: () => import_schema.SBL,
|
|
20
21
|
Schema: () => import_schema.Schema,
|
|
21
22
|
Text: () => import_havarotjs.Text,
|
|
22
23
|
remove: () => import_remove.remove,
|
|
@@ -25,12 +26,13 @@ __export(esm_exports, {
|
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(esm_exports);
|
|
27
28
|
var import_havarotjs = require("havarotjs");
|
|
28
|
-
var import_transliterate = require("./transliterate.js");
|
|
29
|
-
var import_sequence = require("./sequence.js");
|
|
30
29
|
var import_remove = require("./remove.js");
|
|
31
30
|
var import_schema = require("./schema.js");
|
|
31
|
+
var import_sequence = require("./sequence.js");
|
|
32
|
+
var import_transliterate = require("./transliterate.js");
|
|
32
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
34
|
0 && (module.exports = {
|
|
35
|
+
SBL,
|
|
34
36
|
Schema,
|
|
35
37
|
Text,
|
|
36
38
|
remove,
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Text } from \"havarotjs\";\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA
|
|
4
|
+
"sourcesContent": ["import { Text } from \"havarotjs\";\nimport { remove, RemoveOptions } from \"./remove\";\nimport {\n ClusterCallback,\n ClusterFeature,\n HebrewFeature,\n PassThrough,\n SBL,\n Schema,\n SyllableCallback,\n SyllableFeature,\n SylOpts,\n WordCallback,\n WordFeature\n} from \"./schema\";\nimport { sequence } from \"./sequence\";\nimport { transliterate } from \"./transliterate\";\n\nexport { remove, SBL, Schema, sequence, Text, transliterate };\nexport type {\n ClusterCallback,\n ClusterFeature,\n HebrewFeature,\n PassThrough,\n RemoveOptions,\n SyllableCallback,\n SyllableFeature,\n SylOpts,\n WordCallback,\n WordFeature\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;uBAAqB;AACrB,oBAAsC;AACtC,oBAYO;AACP,sBAAyB;AACzB,2BAA8B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/remove.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/remove.ts"],
|
|
4
|
-
"sourcesContent": ["import { sequence } from \"./sequence\";\n\ninterface RemoveOptions {\n // accents //\n /**\n * \u25CC\u0591\n */\n ETNAHTA?: boolean;\n /**\n * \u25CC\u0592\n */\n SEGOLTA?: boolean;\n /**\n * \u25CC\u0593\n */\n SHALSHELET?: boolean;\n /**\n * \u25CC\u0594\n */\n ZAQEF_QATAN?: boolean;\n /**\n * \u25CC\u0595\n */\n ZAQEF_GADOL?: boolean;\n /**\n * \u25CC\u0596\n */\n TIPEHA?: boolean;\n /**\n * \u25CC\u0597\n */\n REVIA?: boolean;\n /**\n * \u25CC\u0598\n */\n ZARQA?: boolean;\n /**\n * \u25CC\u0599\n */\n PASHTA?: boolean;\n /**\n * \u25CC\u059A\n */\n YETIV?: boolean;\n /**\n * \u25CC\u059B\n */\n TEVIR?: boolean;\n /**\n * \u25CC\u059C\n */\n GERESH?: boolean;\n /**\n * \u25CC\u059D\n */\n GERESH_MUQDAM?: boolean;\n /**\n * \u25CC\u059E\n */\n GERSHAYIM?: boolean;\n /**\n * \u25CC\u059F\n */\n QARNEY_PARA?: boolean;\n /**\n * \u25CC\u05A0\n */\n TELISHA_GEDOLA?: boolean;\n /**\n * \u25CC\u05A1\n */\n PAZER?: boolean;\n /**\n * \u25CC\u05A2\n */\n ATNAH_HAFUKH?: boolean;\n /**\n * \u25CC\u05A3\n */\n MUNAH?: boolean;\n /**\n * \u25CC\u05A4\n */\n MAHAPAKH?: boolean;\n /**\n * \u25CC\u05A5\n */\n MERKHA?: boolean;\n /**\n * \u25CC\u05A6\n */\n MERKHA_KEFULA?: boolean;\n /**\n * \u25CC\u05A7\n */\n DARGA?: boolean;\n /**\n * \u25CC\u05A8\n */\n QADMA?: boolean;\n /**\n * \u25CC\u05A9\n */\n TELISHA_QETANA?: boolean;\n /**\n * \u25CC\u05AA\n */\n YERAH_BEN_YOMO?: boolean;\n /**\n * \u25CC\u05AB\n */\n OLE?: boolean;\n /**\n * \u25CC\u05AC\n */\n ILUY?: boolean;\n /**\n * \u25CC\u05AD\n */\n DEHI?: boolean;\n /**\n * \u25CC\u05AE\n */\n ZINOR?: boolean;\n // points //\n /**\n * \u25CC\u05B0\n */\n SHEVA?: boolean;\n /**\n * \u25CC\u05B1\n */\n HATAF_SEGOL?: boolean;\n /**\n * \u25CC\u05B2\n */\n HATAF_PATAH?: boolean;\n /**\n * \u25CC\u05B3\n */\n HATAF_QAMATS?: boolean;\n /**\n * \u25CC\u05B4\n */\n HIRIQ?: boolean;\n /**\n * \u25CC\u05B5\n */\n TSERE?: boolean;\n /**\n * \u25CC\u05B6\n */\n SEGOL?: boolean;\n /**\n * \u25CC\u05B7\n */\n PATAH?: boolean;\n /**\n * \u25CC\u05B8\n */\n QAMATS?: boolean;\n /**\n * \u25CC\u05B9\n */\n HOLAM?: boolean;\n /**\n * \u25CC\u05BB\n */\n QUBUTS?: boolean;\n /**\n * \u25CC\u05BC\n */\n DAGESH?: boolean;\n /**\n * \u25CC\u05BD\n */\n METEG?: boolean;\n /**\n * \u25CC\u05BF\n */\n RAFE?: boolean;\n /**\n * \u25CC\u05C1\n */\n SHIN_DOT?: boolean;\n /**\n * \u25CC\u05C2\n */\n SIN_DOT?: boolean;\n /**\n * \u25CC\u05C7\n */\n QAMATS_QATAN?: boolean;\n // punctuation //\n /**\n * \u05BE\u25CC\n *\n * @description\n * Unlike other characters, this is replaced with a space instead of being removed.\n */\n MAQAF?: boolean;\n /**\n * \u05C0 \u25CC\n */\n PASEQ?: boolean;\n /**\n * \u05C3\u25CC\n */\n SOF_PASUQ?: boolean;\n /**\n * \u05C6\n */\n NUN_HAFUKHA?: boolean;\n /**\n * \u05F3\n */\n PUNC_GERESH?: boolean;\n /**\n * \u05F4\n */\n PUNC_GERSHAYIM?: boolean;\n // marks //\n /**\n * \u25CC\u05AF\n */\n MASORA_CIRCLE?: boolean;\n /**\n * \u25CC\u05C4\n */\n UPPER_DOT?: boolean;\n /**\n * \u25CC\u05C5\n */\n LOWER_DOT?: boolean;\n}\n\ntype OptionKey = keyof RemoveOptions;\n\ntype map = { [k in keyof RemoveOptions]: string };\n\nconst removeMap: map = {\n // accents //\n ETNAHTA: \"\\u{0591}\", // U+0591 HEBREW ACCENT ETNAHTA\n SEGOLTA: \"\\u{0592}\", // U+0592 HEBREW ACCENT SEGOL\n SHALSHELET: \"\\u{0593}\", // U+0593 HEBREW ACCENT SHALSHELET\n ZAQEF_QATAN: \"\\u{0594}\", // U+0594 HEBREW ACCENT ZAQEF QATAN\n ZAQEF_GADOL: \"\\u{0595}\", // U+0595 HEBREW ACCENT ZAQEF GADOL\n TIPEHA: \"\\u{0596}\", // U+0596 HEBREW ACCENT TIPEHA\n REVIA: \"\\u{0597}\", // U+0597 HEBREW ACCENT REVIA\n ZARQA: \"\\u{0598}\", // U+0598 HEBREW ACCENT ZARQA\n PASHTA: \"\\u{0599}\", // U+0599 HEBREW ACCENT PASHTA\n YETIV: \"\\u{059A}\", // U+059A HEBREW ACCENT YETIV\n TEVIR: \"\\u{059B}\", // U+059B HEBREW ACCENT TEVIR\n GERESH: \"\\u{059C}\", // U+059C HEBREW ACCENT GERESH\n GERESH_MUQDAM: \"\\u{059D}\", // U+059D HEBREW ACCENT GERESH MUQDAM\n GERSHAYIM: \"\\u{059E}\", // U+059E HEBREW ACCENT GERSHAYIM\n QARNEY_PARA: \"\\u{059F}\", // U+059F HEBREW ACCENT QARNEY PARA\n TELISHA_GEDOLA: \"\\u{05A0}\", // U+05A0 HEBREW ACCENT TELISHA GEDOLA\n PAZER: \"\\u{05A1}\", // U+05A1 HEBREW ACCENT PAZER\n ATNAH_HAFUKH: \"\\u{05A2}\", // U+05A2 HEBREW ACCENT ATNAH HAFUKH\n MUNAH: \"\\u{05A3}\", // U+05A3 HEBREW ACCENT MUNAH\n MAHAPAKH: \"\\u{05A4}\", // U+05A4 HEBREW ACCENT MAHAPAKH\n MERKHA: \"\\u{05A5}\", // U+05A5 HEBREW ACCENT MERKHA\n MERKHA_KEFULA: \"\\u{05A6}\", // U+05A6 HEBREW ACCENT MERKHA KEFULA\n DARGA: \"\\u{05A7}\", // U+05A7 HEBREW ACCENT DARGA\n QADMA: \"\\u{05A8}\", // U+05A8 HEBREW ACCENT QADMA\n TELISHA_QETANA: \"\\u{05A9}\", // U+05A9 HEBREW ACCENT TELISHA QETANA\n YERAH_BEN_YOMO: \"\\u{05AA}\", // U+05AA HEBREW ACCENT YERAH BEN YOMO\n OLE: \"\\u{05AB}\", // U+05AB HEBREW ACCENT OLE\n ILUY: \"\\u{05AC}\", // U+05AC HEBREW ACCENT ILUY\n DEHI: \"\\u{05AD}\", // U+05AD HEBREW ACCENT DEHI\n ZINOR: \"\\u{05AE}\", // U+05AE HEBREW ACCENT ZINOR\n // points //\n SHEVA: \"\\u{05B0}\", // HEBREW POINT SHEVA\n HATAF_SEGOL: \"\\u{05B1}\", // HEBREW POINT HATAF SEGOL\n HATAF_PATAH: \"\\u{05B2}\", // HEBREW POINT HATAF PATAH\n HATAF_QAMATS: \"\\u{05B3}\", // HEBREW POINT HATAF QAMATS\n HIRIQ: \"\\u{05B4}\", // HEBREW POINT HIRIQ\n TSERE: \"\\u{05B5}\", // HEBREW POINT TSERE\n SEGOL: \"\\u{05B6}\", // HEBREW POINT SEGOL\n PATAH: \"\\u{05B7}\", // HEBREW POINT PATAH\n QAMATS: \"\\u{05B8}\", // HEBREW POINT QAMATS\n HOLAM: \"\\u{05B9}\", // HEBREW POINT HOLAM\n // below is not needed because sequnce() does not output this\n // HOLAM_HASER_FOR_VAV: \"\\u{05BA}\", // HEBREW POINT HOLAM HASER FOR VAV\n QUBUTS: \"\\u{05BB}\", // HEBREW POINT QUBUTS\n DAGESH: \"\\u{05BC}\", // HEBREW POINT DAGESH OR MAPIQ\n METEG: \"\\u{05BD}\", // HEBREW POINT METEG\n RAFE: \"\\u{05BF}\", // HEBREW POINT RAFE\n SHIN_DOT: \"\\u{05C1}\", // HEBREW POINT SHIN DOT\n SIN_DOT: \"\\u{05C2}\", // HEBREW POINT SIN DOT\n QAMATS_QATAN: \"\\u{05C7}\", // HEBREW POINT QAMATS QATAN\n MAQAF: \"\\u{05BE}\", // HEBREW PUNCTUATION MAQAF\n PASEQ: \"\\u{05C0}\", // HEBREW PUNCTUATION PASEQ\n SOF_PASUQ: \"\\u{05C3}\", // HEBREW PUNCTUATION SOF_PASUQ\n NUN_HAFUKHA: \"\\u{05C6}\", // HEBREW PUNCTUATION NUN_HAFUKHA\n // the punctuation geresh/gereshayim is different then the accent ones\n PUNC_GERESH: \"\\u{05F3}\", // HEBREW PUNCTUATION GERESH\n PUNC_GERSHAYIM: \"\\u{05F4}\", // HEBREW PUNCTUATION GERSHAYIM\n MASORA_CIRCLE: \"\\u{05AF}\", // U+MASORA CIRCLE HEBREW MARK 05AF,\n UPPER_DOT: \"\\u{05C4}\", // U+UPPER DOT HEBREW MARK 05C4,\n LOWER_DOT: \"\\u{05C5}\" // U+LOWER DOT HEBREW MARK 05C5];\n};\n\n/**\n * removes all chars called HEBREW ACCENT (U+0591-05AF)\n */\nexport const accents: RemoveOptions = {\n ETNAHTA: true,\n SEGOLTA: true,\n SHALSHELET: true,\n ZAQEF_QATAN: true,\n ZAQEF_GADOL: true,\n TIPEHA: true,\n REVIA: true,\n ZARQA: true,\n PASHTA: true,\n YETIV: true,\n TEVIR: true,\n GERESH: true,\n GERESH_MUQDAM: true,\n GERSHAYIM: true,\n QARNEY_PARA: true,\n TELISHA_GEDOLA: true,\n PAZER: true,\n ATNAH_HAFUKH: true,\n MUNAH: true,\n MAHAPAKH: true,\n MERKHA: true,\n MERKHA_KEFULA: true,\n DARGA: true,\n QADMA: true,\n TELISHA_QETANA: true,\n YERAH_BEN_YOMO: true,\n OLE: true,\n ILUY: true,\n DEHI: true,\n ZINOR: true\n};\n\n/**\n * removes all chars called HEBREW POINT (U+05B0-05BD, U+05BF, U+05C1-05C2 and U+05C7)\n */\nexport const points: RemoveOptions = {\n SHEVA: true,\n HATAF_SEGOL: true,\n HATAF_PATAH: true,\n HATAF_QAMATS: true,\n HIRIQ: true,\n TSERE: true,\n SEGOL: true,\n PATAH: true,\n QAMATS: true,\n HOLAM: true,\n QUBUTS: true,\n DAGESH: true,\n SHIN_DOT: true,\n SIN_DOT: true,\n METEG: true,\n RAFE: true,\n QAMATS_QATAN: true\n};\n\n/**\n * removes chars called HEBREW POINT (U+05B0-05BC and U+05C7) except for:\n * - SHIN_DOT\n * - SIN_DOT\n * - METEG\n * - RAFE\n */\nexport const vowels: RemoveOptions = {\n SHEVA: true,\n HATAF_SEGOL: true,\n HATAF_PATAH: true,\n HATAF_QAMATS: true,\n HIRIQ: true,\n TSERE: true,\n SEGOL: true,\n PATAH: true,\n QAMATS: true,\n HOLAM: true,\n QUBUTS: true,\n DAGESH: true,\n QAMATS_QATAN: true\n};\n\n/**\n * removes all chars called HEBREW PUNCTUATION (U+05BE, U+05C0, U+05C3, and U+05C6)\n */\nexport const punctuation: RemoveOptions = {\n MAQAF: true,\n PASEQ: true,\n SOF_PASUQ: true,\n NUN_HAFUKHA: true,\n PUNC_GERESH: true,\n PUNC_GERSHAYIM: true\n};\n\n/**\n * removes all chars called HEBREW MARK (U+05AF, U+05C4, and U+05C5)\n */\nexport const marks: RemoveOptions = {\n MASORA_CIRCLE: true,\n UPPER_DOT: true,\n LOWER_DOT: true\n};\n\nexport const all: RemoveOptions = {\n ...accents,\n ...points,\n ...punctuation,\n ...marks\n};\n\n/**\n * removes niqqud from Hebrew text\n *\n * @param text - a string of Hebrew characters\n * @param options\n * @returns Hebrew characters with accents and niqqud optionally removed\n *\n * @example Default\n *\n * ```ts\n * // by default removes all accents and metheg and rafe\n * remove(\"\u05E9\u05C2\u05B8\u05E8\u05B7\u05A3\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8\u0594, \u05D5\u05B7\u05BD\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u0597\u05D5\u05BC\");\n * // \u05E9\u05C2\u05B8\u05E8\u05B7\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8, \u05D5\u05B7\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u05D5\u05BC\n * ```\n *\n * @example Remove accents and vowels, but not shin/sin dots\n *\n * ```ts\n * import { accents, vowelsl } from \"hebrew-transliteration/removeOptions\";\n *\n * remove(\"\u05E9\u05C2\u05B8\u05E8\u05B7\u05A3\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8\u0594, \u05D5\u05B7\u05BD\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u0597\u05D5\u05BC\", { ...accents, ...vowels, METEG: true });\n * // \u05E9\u05C2\u05E8\u05D9 \u05D0\u05E9\u05C1\u05EA\u05DA, \u05D5\u05D9\u05DE\u05E6\u05D0\u05D5\n * ```\n *\n * @example Remove all\n *\n * ```ts\n * import { all } from \"hebrew-transliteration/removeOptions\";\n *\n * remove(\"\u05E9\u05C2\u05B8\u05E8\u05B7\u05A3\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8\u0594, \u05D5\u05B7\u05BD\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u0597\u05D5\u05BC\", all);\n * // \u05E9\u05E8\u05D9 \u05D0\u05E9\u05EA\u05DA, \u05D5\u05D9\u05DE\u05E6\u05D0\u05D5\n * ```\n */\nexport const remove = (text: string, options: RemoveOptions = { ...accents, METEG: true, RAFE: true }): string => {\n /** all the keys of options that are to be removed */\n const keys = Object.keys(options).filter((k) => (k in options ? options[k as OptionKey] : false));\n const sequenced = sequence(text);\n return keys.reduce((a, c) => {\n const key = removeMap[c as OptionKey] ?? null;\n if (key) {\n // if it is a MAQAF, replace it with a space\n const replacement = key === \"\\u{05BE}\" ? \" \" : \"\";\n return a.replace(new RegExp(key, \"gu\"), replacement);\n }\n return a;\n }, sequenced);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;sBAAyB;
|
|
4
|
+
"sourcesContent": ["import { sequence } from \"./sequence\";\n\n/**\n * @categoryDescription Taamim\n * Also called \"accent\" characters\n *\n * @categoryDescription Vowels\n * Hebrew vowel characters\n *\n * @categoryDescription Punctuation\n * Characters not bound to other characters (e.g. paseq)\n */\n\n/**\n * Options for removing characters from Hebrew text, divided into categories\n */\nexport interface RemoveOptions {\n /**\n * HEBREW ACCENT ETNAHTA (U+0591)\n * \u25CC\u0591\n * @category Taamim\n */\n ETNAHTA?: boolean;\n /**\n * HEBREW ACCENT SEGOL (U+0592)\n * \u25CC\u0592\n * @category Taamim\n */\n SEGOLTA?: boolean;\n /**\n * HEBREW ACCENT SHALSHELET (U+0593)\n * \u25CC\u0593\n * @category Taamim\n */\n SHALSHELET?: boolean;\n /**\n * HEBREW ACCENT ZAQEF QATAN (U+0594)\n * \u25CC\u0594\n * @category Taamim\n */\n ZAQEF_QATAN?: boolean;\n /**\n * HEBREW ACCENT ZAQEF GADOL (U+0595)\n * \u25CC\u0595\n * @category Taamim\n */\n ZAQEF_GADOL?: boolean;\n /**\n * HEBREW ACCENT TIPEHA (U+0596)\n * \u25CC\u0596\n * @category Taamim\n */\n TIPEHA?: boolean;\n /**\n * HEBREW ACCENT REVIA (U+0597)\n * \u25CC\u0597\n * @category Taamim\n */\n REVIA?: boolean;\n /**\n * HEBREW ACCENT ZARQA (U+0598)\n * \u25CC\u0598\n * @category Taamim\n */\n ZARQA?: boolean;\n /**\n * HEBREW ACCENT PASHTA (U+0599)\n * \u25CC\u0599\n * @category Taamim\n */\n PASHTA?: boolean;\n /**\n * HEBREW ACCENT YETIV (U+059A)\n * \u25CC\u059A\n * @category Taamim\n */\n YETIV?: boolean;\n /**\n * HEBREW ACCENT TEVIR (U+059B)\n * \u25CC\u059B\n * @category Taamim\n */\n TEVIR?: boolean;\n /**\n * HEBREW ACCENT GERESH (U+059C)\n * \u25CC\u059C\n * @category Taamim\n */\n GERESH?: boolean;\n /**\n * HEBREW ACCENT GERESH MUQDAM (U+059D)\n * \u25CC\u059D\n * @category Taamim\n */\n GERESH_MUQDAM?: boolean;\n /**\n * HEBREW ACCENT GERSHAYIM (U+059E)\n * \u25CC\u059E\n * @category Taamim\n */\n GERSHAYIM?: boolean;\n /**\n * HEBREW ACCENT QARNEY PARA (U+059F)\n * \u25CC\u059F\n * @category Taamim\n */\n QARNEY_PARA?: boolean;\n /**\n * HEBREW ACCENT TELISHA GEDOLA (U+05A0)\n * \u25CC\u05A0\n * @category Taamim\n */\n TELISHA_GEDOLA?: boolean;\n /**\n * HEBREW ACCENT PAZER (U+05A1)\n * \u25CC\u05A1\n * @category Taamim\n */\n PAZER?: boolean;\n /**\n * HEBREW ACCENT ATNAH HAFUKH (U+05A2)\n * \u25CC\u05A2\n * @category Taamim\n */\n ATNAH_HAFUKH?: boolean;\n /**\n * HEBREW ACCENT MUNAH (U+05A3)\n * \u25CC\u05A3\n * @category Taamim\n */\n MUNAH?: boolean;\n /**\n * HEBREW ACCENT MAHAPAKH (U+05A4)\n * \u25CC\u05A4\n * @category Taamim\n */\n MAHAPAKH?: boolean;\n /**\n * HEBREW ACCENT MERKHA (U+05A5)\n * \u25CC\u05A5\n * @category Taamim\n */\n MERKHA?: boolean;\n /**\n * HEBREW ACCENT MERKHA KEFULA (U+05A6)\n * \u25CC\u05A6\n * @category Taamim\n */\n MERKHA_KEFULA?: boolean;\n /**\n * HEBREW ACCENT DARGA (U+05A7)\n * \u25CC\u05A7\n * @category Taamim\n */\n DARGA?: boolean;\n /**\n * HEBREW ACCENT QADMA (U+05A8)\n * \u25CC\u05A8\n * @category Taamim\n */\n QADMA?: boolean;\n /**\n * HEBREW ACCENT TELISHA QETANA (U+05A9)\n * \u25CC\u05A9\n * @category Taamim\n */\n TELISHA_QETANA?: boolean;\n /**\n * HEBREW ACCENT YERAH BEN YOMO (U+05AA)\n * \u25CC\u05AA\n * @category Taamim\n */\n YERAH_BEN_YOMO?: boolean;\n /**\n * HEBREW ACCENT OLE (U+05AB)\n * \u25CC\u05AB\n * @category Taamim\n */\n OLE?: boolean;\n /**\n * HEBREW ACCENT ILUY (U+05AC)\n * \u25CC\u05AC\n * @category Taamim\n */\n ILUY?: boolean;\n /**\n * HEBREW ACCENT DEHI (U+05AD)\n * \u25CC\u05AD\n * @category Taamim\n */\n DEHI?: boolean;\n /**\n * HEBREW ACCENT ZINOR (U+05AE)\n * \u25CC\u05AE\n * @category Taamim\n */\n ZINOR?: boolean;\n /**\n * HEBREW POINT SHEVA (U+05B0)\n * \u25CC\u05B0\n * @category Vowels\n */\n SHEVA?: boolean;\n /**\n * HEBREW POINT HATAF SEGOL (U+05B1)\n * \u25CC\u05B1\n * @category Vowels\n */\n HATAF_SEGOL?: boolean;\n /**\n * HEBREW POINT HATAF PATAH (U+05B2)\n * \u25CC\u05B2\n * @category Vowels\n */\n HATAF_PATAH?: boolean;\n /**\n * HEBREW POINT HATAF QAMATS (U+05B3)\n * \u25CC\u05B3\n * @category Vowels\n */\n HATAF_QAMATS?: boolean;\n /**\n * HEBREW POINT HIRIQ (U+05B4)\n * \u25CC\u05B4\n * @category Vowels\n */\n HIRIQ?: boolean;\n /**\n * HEBREW POINT TSERE (U+05B5)\n * \u25CC\u05B5\n * @category Vowels\n */\n TSERE?: boolean;\n /**\n * HEBREW POINT SEGOL (U+05B6)\n * \u25CC\u05B6\n * @category Vowels\n */\n SEGOL?: boolean;\n /**\n * HEBREW POINT PATAH (U+05B7)\n * \u25CC\u05B7\n * @category Vowels\n */\n PATAH?: boolean;\n /**\n * HEBREW POINT QAMATS (U+05B8)\n * \u25CC\u05B8\n * @category Vowels\n */\n QAMATS?: boolean;\n /**\n * HEBREW POINT HOLAM (U+05B9)\n * \u25CC\u05B9\n * @category Vowels\n */\n HOLAM?: boolean;\n /**\n * HEBREW POINT QUBUTS (U+05BB)\n * \u25CC\u05BB\n * @category Vowels\n */\n QUBUTS?: boolean;\n /**\n * HEBREW POINT DAGESH OR MAPIQ (U+05BC)\n * \u25CC\u05BC\n * @category Vowels\n */\n DAGESH?: boolean;\n /**\n * HEBREW POINT METEG (U+05BD)\n * \u25CC\u05BD\n * @category Vowels\n */\n METEG?: boolean;\n /**\n * HEBREW POINT RAFE (U+05BF)\n * \u25CC\u05BF\n * @category Vowels\n */\n RAFE?: boolean;\n /**\n * HEBREW POINT SHIN DOT (U+05C1)\n * \u25CC\u05C1\n * @category Vowels\n */\n SHIN_DOT?: boolean;\n /**\n * HEBREW POINT SIN DOT (U+05C2)\n * \u25CC\u05C2\n * @category Vowels\n */\n SIN_DOT?: boolean;\n /**\n * HEBREW POINT QAMATS QATAN (U+05C7)\n * \u25CC\u05C7\n * @category Vowels\n */\n QAMATS_QATAN?: boolean;\n /**\n * HEBREW PUNCTUATION MAQAF (U+05BE)\n * \u05BE\u25CC\n * @category Punctuation\n *\n * @remarks\n * Unlike other characters, this is replaced with a space instead of being removed.\n */\n MAQAF?: boolean;\n /**\n * HEBREW PUNCTUATION PASEQ (U+05C0)\n * \u05C0 \u25CC\n * @category Punctuation\n */\n PASEQ?: boolean;\n /**\n * HEBREW PUNCTUATION SOF PASUQ (U+05C3)\n * \u05C3\u25CC\n * @category Punctuation\n */\n SOF_PASUQ?: boolean;\n /**\n * HEBREW PUNCTUATION NUN HAFUKHA (U+05C6)\n * \u05C6\n * @category Punctuation\n */\n NUN_HAFUKHA?: boolean;\n /**\n * HEBREW PUNCTUATION GERESH (U+05F3)\n * \u05F3\u25CC\n * @category Punctuation\n * @category Taamim\n *\n * @remarks\n * Distinguished from {@link RemoveOptions.GERESH | GERESH (U+059C)}. This character is mostly used in Modern Hebrew, but could be used in place of the other.\n */\n PUNC_GERESH?: boolean;\n /**\n * HEBREW PUNCTUATION GERSHAYIM (U+05F4)\n * \u05F4\u25CC\n * @category Punctuation\n * @category Taamim\n *\n * @remarks\n * Distinguished from {@link RemoveOptions.GERSHAYIM | GERSHAYIM (U+059E)}. This character is mostly used in Modern Hebrew, but could be used in place of the other.\n */\n PUNC_GERSHAYIM?: boolean;\n /**\n * HEBREW MARK MASORA CIRCLE (U+05AF)\n * \u25CC\u05AF\n * @category Punctuation\n * @category Taamim\n */\n MASORA_CIRCLE?: boolean;\n /**\n * HEBREW MARK UPPER DOT (U+05C4)\n * \u25CC\u05C4\n * @category Punctuation\n * @category Taamim\n */\n UPPER_DOT?: boolean;\n /**\n * HEBREW MARK LOWER DOT (U+05C5)\n * \u25CC\u05C5\n * @category Punctuation\n * @category Taamim\n */\n LOWER_DOT?: boolean;\n}\n\ntype OptionKey = keyof RemoveOptions;\n\ntype map = { [k in keyof RemoveOptions]: string };\n\nconst removeMap: map = {\n ETNAHTA: \"\\u{0591}\", // U+0591 HEBREW ACCENT ETNAHTA\n SEGOLTA: \"\\u{0592}\", // U+0592 HEBREW ACCENT SEGOL\n SHALSHELET: \"\\u{0593}\", // U+0593 HEBREW ACCENT SHALSHELET\n ZAQEF_QATAN: \"\\u{0594}\", // U+0594 HEBREW ACCENT ZAQEF QATAN\n ZAQEF_GADOL: \"\\u{0595}\", // U+0595 HEBREW ACCENT ZAQEF GADOL\n TIPEHA: \"\\u{0596}\", // U+0596 HEBREW ACCENT TIPEHA\n REVIA: \"\\u{0597}\", // U+0597 HEBREW ACCENT REVIA\n ZARQA: \"\\u{0598}\", // U+0598 HEBREW ACCENT ZARQA\n PASHTA: \"\\u{0599}\", // U+0599 HEBREW ACCENT PASHTA\n YETIV: \"\\u{059A}\", // U+059A HEBREW ACCENT YETIV\n TEVIR: \"\\u{059B}\", // U+059B HEBREW ACCENT TEVIR\n GERESH: \"\\u{059C}\", // U+059C HEBREW ACCENT GERESH\n GERESH_MUQDAM: \"\\u{059D}\", // U+059D HEBREW ACCENT GERESH MUQDAM\n GERSHAYIM: \"\\u{059E}\", // U+059E HEBREW ACCENT GERSHAYIM\n QARNEY_PARA: \"\\u{059F}\", // U+059F HEBREW ACCENT QARNEY PARA\n TELISHA_GEDOLA: \"\\u{05A0}\", // U+05A0 HEBREW ACCENT TELISHA GEDOLA\n PAZER: \"\\u{05A1}\", // U+05A1 HEBREW ACCENT PAZER\n ATNAH_HAFUKH: \"\\u{05A2}\", // U+05A2 HEBREW ACCENT ATNAH HAFUKH\n MUNAH: \"\\u{05A3}\", // U+05A3 HEBREW ACCENT MUNAH\n MAHAPAKH: \"\\u{05A4}\", // U+05A4 HEBREW ACCENT MAHAPAKH\n MERKHA: \"\\u{05A5}\", // U+05A5 HEBREW ACCENT MERKHA\n MERKHA_KEFULA: \"\\u{05A6}\", // U+05A6 HEBREW ACCENT MERKHA KEFULA\n DARGA: \"\\u{05A7}\", // U+05A7 HEBREW ACCENT DARGA\n QADMA: \"\\u{05A8}\", // U+05A8 HEBREW ACCENT QADMA\n TELISHA_QETANA: \"\\u{05A9}\", // U+05A9 HEBREW ACCENT TELISHA QETANA\n YERAH_BEN_YOMO: \"\\u{05AA}\", // U+05AA HEBREW ACCENT YERAH BEN YOMO\n OLE: \"\\u{05AB}\", // U+05AB HEBREW ACCENT OLE\n ILUY: \"\\u{05AC}\", // U+05AC HEBREW ACCENT ILUY\n DEHI: \"\\u{05AD}\", // U+05AD HEBREW ACCENT DEHI\n ZINOR: \"\\u{05AE}\", // U+05AE HEBREW ACCENT ZINOR\n SHEVA: \"\\u{05B0}\", // HEBREW POINT SHEVA\n HATAF_SEGOL: \"\\u{05B1}\", // HEBREW POINT HATAF SEGOL\n HATAF_PATAH: \"\\u{05B2}\", // HEBREW POINT HATAF PATAH\n HATAF_QAMATS: \"\\u{05B3}\", // HEBREW POINT HATAF QAMATS\n HIRIQ: \"\\u{05B4}\", // HEBREW POINT HIRIQ\n TSERE: \"\\u{05B5}\", // HEBREW POINT TSERE\n SEGOL: \"\\u{05B6}\", // HEBREW POINT SEGOL\n PATAH: \"\\u{05B7}\", // HEBREW POINT PATAH\n QAMATS: \"\\u{05B8}\", // HEBREW POINT QAMATS\n HOLAM: \"\\u{05B9}\", // HEBREW POINT HOLAM\n // below is not needed because sequnce() does not output this\n // HOLAM_HASER_FOR_VAV: \"\\u{05BA}\", // HEBREW POINT HOLAM HASER FOR VAV\n QUBUTS: \"\\u{05BB}\", // HEBREW POINT QUBUTS\n DAGESH: \"\\u{05BC}\", // HEBREW POINT DAGESH OR MAPIQ\n METEG: \"\\u{05BD}\", // HEBREW POINT METEG\n RAFE: \"\\u{05BF}\", // HEBREW POINT RAFE\n SHIN_DOT: \"\\u{05C1}\", // HEBREW POINT SHIN DOT\n SIN_DOT: \"\\u{05C2}\", // HEBREW POINT SIN DOT\n QAMATS_QATAN: \"\\u{05C7}\", // HEBREW POINT QAMATS QATAN\n MAQAF: \"\\u{05BE}\", // HEBREW PUNCTUATION MAQAF\n PASEQ: \"\\u{05C0}\", // HEBREW PUNCTUATION PASEQ\n SOF_PASUQ: \"\\u{05C3}\", // HEBREW PUNCTUATION SOF_PASUQ\n NUN_HAFUKHA: \"\\u{05C6}\", // HEBREW PUNCTUATION NUN_HAFUKHA\n PUNC_GERESH: \"\\u{05F3}\", // HEBREW PUNCTUATION GERESH\n PUNC_GERSHAYIM: \"\\u{05F4}\", // HEBREW PUNCTUATION GERSHAYIM\n MASORA_CIRCLE: \"\\u{05AF}\", // U+MASORA CIRCLE HEBREW MARK 05AF,\n UPPER_DOT: \"\\u{05C4}\", // U+UPPER DOT HEBREW MARK 05C4,\n LOWER_DOT: \"\\u{05C5}\" // U+LOWER DOT HEBREW MARK 05C5];\n};\n\n/**\n * removes all chars called HEBREW ACCENT (U+0591-05AF)\n */\nexport const accents: RemoveOptions = {\n ETNAHTA: true,\n SEGOLTA: true,\n SHALSHELET: true,\n ZAQEF_QATAN: true,\n ZAQEF_GADOL: true,\n TIPEHA: true,\n REVIA: true,\n ZARQA: true,\n PASHTA: true,\n YETIV: true,\n TEVIR: true,\n GERESH: true,\n GERESH_MUQDAM: true,\n GERSHAYIM: true,\n QARNEY_PARA: true,\n TELISHA_GEDOLA: true,\n PAZER: true,\n ATNAH_HAFUKH: true,\n MUNAH: true,\n MAHAPAKH: true,\n MERKHA: true,\n MERKHA_KEFULA: true,\n DARGA: true,\n QADMA: true,\n TELISHA_QETANA: true,\n YERAH_BEN_YOMO: true,\n OLE: true,\n ILUY: true,\n DEHI: true,\n ZINOR: true\n};\n\n/**\n * removes all chars called HEBREW POINT (U+05B0-05BD, U+05BF, U+05C1-05C2 and U+05C7)\n */\nexport const points: RemoveOptions = {\n SHEVA: true,\n HATAF_SEGOL: true,\n HATAF_PATAH: true,\n HATAF_QAMATS: true,\n HIRIQ: true,\n TSERE: true,\n SEGOL: true,\n PATAH: true,\n QAMATS: true,\n HOLAM: true,\n QUBUTS: true,\n DAGESH: true,\n SHIN_DOT: true,\n SIN_DOT: true,\n METEG: true,\n RAFE: true,\n QAMATS_QATAN: true\n};\n\n/**\n * removes chars called HEBREW POINT (U+05B0-05BC and U+05C7) except for:\n * - SHIN_DOT\n * - SIN_DOT\n * - METEG\n * - RAFE\n */\nexport const vowels: RemoveOptions = {\n SHEVA: true,\n HATAF_SEGOL: true,\n HATAF_PATAH: true,\n HATAF_QAMATS: true,\n HIRIQ: true,\n TSERE: true,\n SEGOL: true,\n PATAH: true,\n QAMATS: true,\n HOLAM: true,\n QUBUTS: true,\n DAGESH: true,\n QAMATS_QATAN: true\n};\n\n/**\n * removes all chars called HEBREW PUNCTUATION (U+05BE, U+05C0, U+05C3, and U+05C6)\n */\nexport const punctuation: RemoveOptions = {\n MAQAF: true,\n PASEQ: true,\n SOF_PASUQ: true,\n NUN_HAFUKHA: true,\n PUNC_GERESH: true,\n PUNC_GERSHAYIM: true\n};\n\n/**\n * removes all chars called HEBREW MARK (U+05AF, U+05C4, and U+05C5)\n */\nexport const marks: RemoveOptions = {\n MASORA_CIRCLE: true,\n UPPER_DOT: true,\n LOWER_DOT: true\n};\n\nexport const all: RemoveOptions = {\n ...accents,\n ...points,\n ...punctuation,\n ...marks\n};\n\n/**\n * Removes niqqud from Hebrew text\n *\n * @param text - a string of Hebrew characters\n * @param options\n * @returns Hebrew characters with accents and niqqud optionally removed\n *\n * @example\n * Default\n * ```ts\n * // by default removes all accents and metheg and rafe\n * remove(\"\u05E9\u05C2\u05B8\u05E8\u05B7\u05A3\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8\u0594, \u05D5\u05B7\u05BD\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u0597\u05D5\u05BC\");\n * // \u05E9\u05C2\u05B8\u05E8\u05B7\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8, \u05D5\u05B7\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u05D5\u05BC\n * ```\n *\n * @example\n * Remove accents and vowels, but not shin/sin dots\n * ```ts\n * import { accents, vowels } from \"hebrew-transliteration/removeOptions\";\n *\n * remove(\"\u05E9\u05C2\u05B8\u05E8\u05B7\u05A3\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8\u0594, \u05D5\u05B7\u05BD\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u0597\u05D5\u05BC\", { ...accents, ...vowels, METEG: true });\n * // \u05E9\u05C2\u05E8\u05D9 \u05D0\u05E9\u05C1\u05EA\u05DA, \u05D5\u05D9\u05DE\u05E6\u05D0\u05D5\n * ```\n *\n * @example\n * Remove all\n * ```ts\n * import { all } from \"hebrew-transliteration/removeOptions\";\n *\n * remove(\"\u05E9\u05C2\u05B8\u05E8\u05B7\u05A3\u05D9 \u05D0\u05B4\u05E9\u05C1\u05B0\u05EA\u05BC\u05B0\u05DA\u05B8\u0594, \u05D5\u05B7\u05BD\u05D9\u05B4\u05BC\u05DE\u05B0\u05E6\u05B0\u05D0\u0597\u05D5\u05BC\", all);\n * // \u05E9\u05E8\u05D9 \u05D0\u05E9\u05EA\u05DA, \u05D5\u05D9\u05DE\u05E6\u05D0\u05D5\n * ```\n */\nexport const remove = (text: string, options: RemoveOptions = { ...accents, METEG: true, RAFE: true }): string => {\n /** all the keys of options that are to be removed */\n const keys = Object.keys(options).filter((k) => (k in options ? options[k as OptionKey] : false));\n const sequenced = sequence(text);\n return keys.reduce((a, c) => {\n const key = removeMap[c as OptionKey] ?? null;\n if (key) {\n // if it is a MAQAF, replace it with a space\n const replacement = key === \"\\u{05BE}\" ? \" \" : \"\";\n return a.replace(new RegExp(key, \"gu\"), replacement);\n }\n return a;\n }, sequenced);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;sBAAyB;AAqXzB,MAAM,YAAiB;EACrB,SAAS;EACT,SAAS;EACT,YAAY;EACZ,aAAa;EACb,aAAa;EACb,QAAQ;EACR,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,OAAO;EACP,QAAQ;EACR,eAAe;EACf,WAAW;EACX,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP,cAAc;EACd,OAAO;EACP,UAAU;EACV,QAAQ;EACR,eAAe;EACf,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,gBAAgB;EAChB,KAAK;EACL,MAAM;EACN,MAAM;EACN,OAAO;EACP,OAAO;EACP,aAAa;EACb,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EAGP,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,MAAM;EACN,UAAU;EACV,SAAS;EACT,cAAc;EACd,OAAO;EACP,OAAO;EACP,WAAW;EACX,aAAa;EACb,aAAa;EACb,gBAAgB;EAChB,eAAe;EACf,WAAW;EACX,WAAW;;AAMN,MAAM,UAAyB;EACpC,SAAS;EACT,SAAS;EACT,YAAY;EACZ,aAAa;EACb,aAAa;EACb,QAAQ;EACR,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,OAAO;EACP,QAAQ;EACR,eAAe;EACf,WAAW;EACX,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP,cAAc;EACd,OAAO;EACP,UAAU;EACV,QAAQ;EACR,eAAe;EACf,OAAO;EACP,OAAO;EACP,gBAAgB;EAChB,gBAAgB;EAChB,KAAK;EACL,MAAM;EACN,MAAM;EACN,OAAO;;AAMF,MAAM,SAAwB;EACnC,OAAO;EACP,aAAa;EACb,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,SAAS;EACT,OAAO;EACP,MAAM;EACN,cAAc;;AAUT,MAAM,SAAwB;EACnC,OAAO;EACP,aAAa;EACb,aAAa;EACb,cAAc;EACd,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,cAAc;;AAMT,MAAM,cAA6B;EACxC,OAAO;EACP,OAAO;EACP,WAAW;EACX,aAAa;EACb,aAAa;EACb,gBAAgB;;AAMX,MAAM,QAAuB;EAClC,eAAe;EACf,WAAW;EACX,WAAW;;AAGN,MAAM,MAAqB;EAChC,GAAG;EACH,GAAG;EACH,GAAG;EACH,GAAG;;AAoCE,MAAM,SAAS,CAAC,MAAc,UAAyB,EAAE,GAAG,SAAS,OAAO,MAAM,MAAM,KAAI,MAAc;AAE/G,QAAM,OAAO,OAAO,KAAK,OAAO,EAAE,OAAO,CAAC,MAAO,KAAK,UAAU,QAAQ,KAAkB,KAAM;AAChG,QAAM,gBAAY,0BAAS,IAAI;AAC/B,SAAO,KAAK,OAAO,CAAC,GAAG,MAAK;AArkB9B;AAskBI,UAAM,OAAM,eAAU,OAAV,YAA6B;AACzC,QAAI,KAAK;AAEP,YAAM,cAAc,QAAQ,WAAa,MAAM;AAC/C,aAAO,EAAE,QAAQ,IAAI,OAAO,KAAK,IAAI,GAAG,WAAW;IACrD;AACA,WAAO;EACT,GAAG,SAAS;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|