hebrew-transliteration 2.2.3 → 2.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/README.md CHANGED
@@ -45,7 +45,7 @@ It exports 3 [functions](#functions):
45
45
 
46
46
  And it exports 2 [classes](#classes):
47
47
 
48
- 1. [`Text`](#text) — the [`Text`](https://charlesloder.github.io/havarot/classes/text.Text.html) class from the `havarotjs` package
48
+ 1. [`Text`](#text) — the [`Text`](https://charlesloder.github.io/havarotjs/classes/text.Text.html) class from the `havarotjs` package
49
49
  2. [`Schema`](#schema) — a schema for transliterating Hebrew
50
50
 
51
51
  ### Functions
@@ -56,7 +56,7 @@ Takes a `string` or [`Text`](#text), and optionally a [`Schema`](#schema) or `Pa
56
56
 
57
57
  ```javascript
58
58
  heb.transliterate("אֱלֹהִים");
59
- // "ʾĕlōhîm";
59
+ // ʾĕlōhîm
60
60
  ```
61
61
 
62
62
  If no [`Schema`](#schema) is passed, then the package defaults to SBL's academic style.
@@ -78,13 +78,6 @@ heb.transliterate("בְּבֵית", brillAcademic)
78
78
  ```
79
79
  **Note**: schemas are not endorsed by publishers.
80
80
 
81
- The available schemas are:
82
-
83
- - brillAcademic
84
- - brillSimple
85
- - sblAcademicSpirantization
86
- - sblSimple
87
-
88
81
  If you need a fully customized transliteration, it is best to use the [`Schema`](#schema) constructor:
89
82
 
90
83
  ```javascript
@@ -104,17 +97,32 @@ heb.transliterate("אָ֣ב", schema)
104
97
 
105
98
  #### `remove()`
106
99
 
107
- Takes `string` and options. The default only removes taamim (i.e., accent or cantillation) marks.
100
+ Takes `string` and `RemoveOptions`.
101
+
102
+ The default removes accents (i.e. characters called HEBREW ACCENT) and metheg and rafe.
108
103
 
109
104
  ```javascript
110
105
  heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔");
111
- // "שָׂרַי אִשְׁתְּךָ";
106
+ // שָׂרַי אִשְׁתְּךָ;
107
+ ```
112
108
 
113
- heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
114
- // "שׂרי אשׁתך";
109
+ The `RemoveOptions` can be customized.
115
110
 
116
- heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
117
- // "שרי אשתך";
111
+ ```javascript
112
+ heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { SHIN_DOT: true, SIN_DOT: true });
113
+ // שָרַ֣י אִשְתְּךָ֔
114
+ ```
115
+
116
+ **Note:** unlike a `Schema` where a `Partial<Schema>` extends the default, `RemoveOptions` does not accept a `Partial<RemoveOptions>`.
117
+
118
+ All properties for `RemoveOptions` can be found in the [source](src/remove.ts).
119
+
120
+ There are some preset options availables as well.
121
+
122
+ ```javascript
123
+ const opts = require("hebrew-transliteration/removeOptions");
124
+ heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", opts.all);
125
+ // שרי אשתך, וימצאו
118
126
  ```
119
127
 
120
128
  ---
@@ -132,7 +140,7 @@ heb.sequence("\u{5D1}\u{5B0}\u{5BC}\u{5E8}\u{5B5}\u{5D0}\u{5E9}\u{5B4}\u{5C1}\u{
132
140
 
133
141
  #### Text
134
142
 
135
- The [`Text`](https://charlesloder.github.io/havarot/classes/text.Text.html) class from the [`havarotjs`](https://www.npmjs.com/package/havarotjs) package.
143
+ The [`Text`](https://charlesloder.github.io/havarotjs/classes/text.Text.html) class from the [`havarotjs`](https://www.npmjs.com/package/havarotjs) package.
136
144
 
137
145
  This class is used by [`transliterate()`](#transliterate) internally to syllabify Hebrew text, but it is exposed as well.
138
146
 
@@ -158,18 +166,13 @@ The `Schema` can be divided into a few categories.
158
166
 
159
167
  ##### 1) Syllabification
160
168
 
161
- The options used for syllabifying Hebrew text can be found [here](https://charlesloder.github.io/havarot/interfaces/text.SylOpts.html)
169
+ The options used for syllabifying Hebrew text can be found [here](https://charlesloder.github.io/havarotjs/interfaces/text.SylOpts.html)
162
170
 
163
171
  ###### Differences between `Text` and `Schema`
164
172
 
165
- There are 5 options for syllabification that are the [same as the ones used by the `Text`](https://charlesloder.github.io/havarot/interfaces/text.SylOpts.html) class. The only `Text` syllabification option that `Schema` does not use is `schema` (yes, that's confusing):
166
-
167
- ```javascript
168
- const text = new heb.Text("חׇכְמָ֣ה", { schema: "traditional" }); // this is okay
169
- const schema = new heb.Schema({ schema: "traditional" }); // this does nothing
170
- ```
173
+ 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.
171
174
 
172
- Read more about the syllabification options for the [`Text`](https://charlesloder.github.io/havarot/interfaces/text.SylOpts.html) and a [higher level overview](https://charlesloder.github.io/havarot/pages/Linguistic/syllabification.html)
175
+ 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)
173
176
 
174
177
  ###### Precedence of `Text` over `Schema`
175
178
 
@@ -327,7 +330,7 @@ heb.transliterate("בֵּ֣ית", {
327
330
 
328
331
  ## Live
329
332
 
330
- Use it live at [charlesLoder.github.io/hebrewTransliteration](https://charlesloder.github.io/hebrewTransliteration/index.html)
333
+ Use it live at [https://hebrewtransliteration.app](https://hebrewtransliteration.app)
331
334
 
332
335
  ## Contributing
333
336
 
package/dist/.DS_Store ADDED
Binary file
package/dist/remove.d.ts CHANGED
@@ -1,65 +1,286 @@
1
- /**
2
- * Options for the `remove()` function
3
- */
4
1
  interface RemoveOptions {
5
2
  /**
6
- * an option to remove vowels
7
- *
8
- * @example
9
- * ```ts
10
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
11
- * // "שׂרי אשׁתך";
12
- * ```
13
- */
14
- removeVowels?: boolean;
15
- /**
16
- * an option to remove the shin dot (U+05C1)
17
- *
18
- * @example
19
- * ```ts
20
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
21
- * // "שרי אשתך";
22
- * ```
23
- */
24
- removeShinDot?: boolean;
25
- /**
26
- * an option to remove the sin dot (U+05C2)
27
- *
28
- * @example
29
- * ```ts
30
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
31
- * // "שרי אשתך";
32
- * ```
33
- */
34
- removeSinDot?: boolean;
3
+ * ◌֑
4
+ */
5
+ ETNAHTA?: boolean;
6
+ /**
7
+ * ◌֒
8
+ */
9
+ SEGOLTA?: boolean;
10
+ /**
11
+ * ◌֓
12
+ */
13
+ SHALSHELET?: boolean;
14
+ /**
15
+ * ◌֔
16
+ */
17
+ ZAQEF_QATAN?: boolean;
18
+ /**
19
+ * ◌֕
20
+ */
21
+ ZAQEF_GADOL?: boolean;
22
+ /**
23
+ * ◌֖
24
+ */
25
+ TIPEHA?: boolean;
26
+ /**
27
+ * ◌֗
28
+ */
29
+ REVIA?: boolean;
30
+ /**
31
+ * ◌֘
32
+ */
33
+ ZARQA?: boolean;
34
+ /**
35
+ * ◌֙
36
+ */
37
+ PASHTA?: boolean;
38
+ /**
39
+ * ◌֚
40
+ */
41
+ YETIV?: boolean;
42
+ /**
43
+ * ◌֛
44
+ */
45
+ TEVIR?: boolean;
46
+ /**
47
+ * ◌֜
48
+ */
49
+ GERESH?: boolean;
50
+ /**
51
+ * ◌֝
52
+ */
53
+ GERESH_MUQDAM?: boolean;
54
+ /**
55
+ * ◌֞
56
+ */
57
+ GERSHAYIM?: boolean;
58
+ /**
59
+ * ◌֟
60
+ */
61
+ QARNEY_PARA?: boolean;
62
+ /**
63
+ * ◌֠
64
+ */
65
+ TELISHA_GEDOLA?: boolean;
66
+ /**
67
+ * ◌֡
68
+ */
69
+ PAZER?: boolean;
70
+ /**
71
+ * ◌֢
72
+ */
73
+ ATNAH_HAFUKH?: boolean;
74
+ /**
75
+ * ◌֣
76
+ */
77
+ MUNAH?: boolean;
78
+ /**
79
+ * ◌֤
80
+ */
81
+ MAHAPAKH?: boolean;
82
+ /**
83
+ * ◌֥
84
+ */
85
+ MERKHA?: boolean;
86
+ /**
87
+ * ◌֦
88
+ */
89
+ MERKHA_KEFULA?: boolean;
90
+ /**
91
+ * ◌֧
92
+ */
93
+ DARGA?: boolean;
94
+ /**
95
+ * ◌֨
96
+ */
97
+ QADMA?: boolean;
98
+ /**
99
+ * ◌֩
100
+ */
101
+ TELISHA_QETANA?: boolean;
102
+ /**
103
+ * ◌֪
104
+ */
105
+ YERAH_BEN_YOMO?: boolean;
106
+ /**
107
+ * ◌֫
108
+ */
109
+ OLE?: boolean;
110
+ /**
111
+ * ◌֬
112
+ */
113
+ ILUY?: boolean;
114
+ /**
115
+ * ◌֭
116
+ */
117
+ DEHI?: boolean;
118
+ /**
119
+ * ◌֮
120
+ */
121
+ ZINOR?: boolean;
122
+ /**
123
+ * ◌ְ
124
+ */
125
+ SHEVA?: boolean;
126
+ /**
127
+ * ◌ֱ
128
+ */
129
+ HATAF_SEGOL?: boolean;
130
+ /**
131
+ * ◌ֲ
132
+ */
133
+ HATAF_PATAH?: boolean;
134
+ /**
135
+ * ◌ֳ
136
+ */
137
+ HATAF_QAMATS?: boolean;
138
+ /**
139
+ * ◌ִ
140
+ */
141
+ HIRIQ?: boolean;
142
+ /**
143
+ * ◌ֵ
144
+ */
145
+ TSERE?: boolean;
146
+ /**
147
+ * ◌ֶ
148
+ */
149
+ SEGOL?: boolean;
150
+ /**
151
+ * ◌ַ
152
+ */
153
+ PATAH?: boolean;
154
+ /**
155
+ * ◌ָ
156
+ */
157
+ QAMATS?: boolean;
158
+ /**
159
+ * ◌ֹ
160
+ */
161
+ HOLAM?: boolean;
162
+ /**
163
+ * ◌ֻ
164
+ */
165
+ QUBUTS?: boolean;
166
+ /**
167
+ * ◌ּ
168
+ */
169
+ DAGESH?: boolean;
170
+ /**
171
+ * ◌ֽ
172
+ */
173
+ METEG?: boolean;
174
+ /**
175
+ * ◌ֿ
176
+ */
177
+ RAFE?: boolean;
178
+ /**
179
+ * ◌ׁ
180
+ */
181
+ SHIN_DOT?: boolean;
182
+ /**
183
+ * ◌ׂ
184
+ */
185
+ SIN_DOT?: boolean;
186
+ /**
187
+ * ◌ׇ
188
+ */
189
+ QAMATS_QATAN?: boolean;
190
+ /**
191
+ * ־◌
192
+ */
193
+ MAQAF?: boolean;
194
+ /**
195
+ * ׀ ◌
196
+ */
197
+ PASEQ?: boolean;
198
+ /**
199
+ * ׃◌
200
+ */
201
+ SOF_PASUQ?: boolean;
202
+ /**
203
+ * ׆
204
+ */
205
+ NUN_HAFUKHA?: boolean;
206
+ /**
207
+ * ׳
208
+ */
209
+ PUNC_GERESH?: boolean;
210
+ /**
211
+ * ״
212
+ */
213
+ PUNC_GERSHAYIM?: boolean;
214
+ /**
215
+ * ◌֯
216
+ */
217
+ MASORA_CIRCLE?: boolean;
218
+ /**
219
+ * ◌ׄ
220
+ */
221
+ UPPER_DOT?: boolean;
222
+ /**
223
+ * ◌ׅ
224
+ */
225
+ LOWER_DOT?: boolean;
35
226
  }
36
227
  /**
37
- * removes taamim and optionally removes certain niqqudim
228
+ * removes all chars called HEBREW ACCENT (U+0591-05AF)
229
+ */
230
+ export declare const accents: RemoveOptions;
231
+ /**
232
+ * removes all chars called HEBREW POINT (U+05B0-05BD, U+05BF, U+05C1-05C2 and U+05C7)
233
+ */
234
+ export declare const points: RemoveOptions;
235
+ /**
236
+ * removes chars called HEBREW POINT (U+05B0-05BC and U+05C7) except for:
237
+ * - SHIN_DOT
238
+ * - SIN_DOT
239
+ * - METEG
240
+ * - RAFE
241
+ */
242
+ export declare const vowels: RemoveOptions;
243
+ /**
244
+ * removes all chars called HEBREW PUNCTUATION (U+05BE, U+05C0, U+05C3, and U+05C6)
245
+ */
246
+ export declare const punctuation: RemoveOptions;
247
+ /**
248
+ * removes all chars called HEBREW MARK (U+05AF, U+05C4, and U+05C5)
249
+ */
250
+ export declare const marks: RemoveOptions;
251
+ export declare const all: RemoveOptions;
252
+ /**
253
+ * removes niqqud from Hebrew text
38
254
  *
39
255
  * @param text - a string of Hebrew characters
40
- * @param RemoveOptions - {@link RemoveOptions}
41
- * @returns Hebrew characters with taamim and niqqud optionally removed
256
+ * @param options
257
+ * @returns Hebrew characters with accents and niqqud optionally removed
42
258
  *
43
259
  * @example Default
44
260
  *
45
261
  * ```ts
46
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔");
47
- * // "שָׂרַי אִשְׁתְּךָ";
262
+ * // by default removes all accents and metheg and rafe
263
+ * remove("שָׂרַ֣י אִשְׁתְּךָ֔, וַֽיִּמְצְא֗וּ");
264
+ * // שָׂרַי אִשְׁתְּךָ, וַיִּמְצְאוּ
48
265
  * ```
49
266
  *
50
- * @example Remove vowels
267
+ * @example Remove accents and vowels, but not shin/sin dots
51
268
  *
52
269
  * ```ts
53
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
54
- * // "שׂרי אשׁתך";
270
+ * import { accents, vowelsl } from "hebrew-transliteration/removeOptions";
271
+ *
272
+ * remove("שָׂרַ֣י אִשְׁתְּךָ֔, וַֽיִּמְצְא֗וּ", { ...accents, ...vowels, METEG: true });
273
+ * // שׂרי אשׁתך, וימצאו
55
274
  * ```
56
275
  *
57
276
  * @example Remove all
58
277
  *
59
278
  * ```ts
60
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
61
- * // "שרי אשתך";
279
+ * import { all } from "hebrew-transliteration/removeOptions";
280
+ *
281
+ * remove("שָׂרַ֣י אִשְׁתְּךָ֔, וַֽיִּמְצְא֗וּ", all);
282
+ * // שרי אשתך, וימצאו
62
283
  * ```
63
284
  */
64
- export declare const remove: (text: string, { removeVowels, removeShinDot, removeSinDot }?: RemoveOptions) => string;
285
+ export declare const remove: (text: string, options?: RemoveOptions) => string;
65
286
  export {};
package/dist/remove.js CHANGED
@@ -1,45 +1,213 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.remove = void 0;
3
+ exports.remove = exports.all = exports.marks = exports.punctuation = exports.vowels = exports.points = exports.accents = void 0;
4
4
  const sequence_1 = require("./sequence");
5
- const cantillation = /[\u{0591}-\u{05AF}\u{05BF}\u{05C0}\u{05C3}-\u{05C6}\u{05F3}\u{05F4}]/gu;
6
- const vowels = /[\u{05B0}-\u{05BD}\u{05BF}\u{05C7}]/gu;
7
- const shinDot = /\u{05C1}/gu;
8
- const sinDot = /\u{05C2}/gu;
9
- const removeItem = (text, item) => text.replace(item, "");
5
+ const removeMap = {
6
+ // accents //
7
+ ETNAHTA: "\u{0591}",
8
+ SEGOLTA: "\u{0592}",
9
+ SHALSHELET: "\u{0593}",
10
+ ZAQEF_QATAN: "\u{0594}",
11
+ ZAQEF_GADOL: "\u{0595}",
12
+ TIPEHA: "\u{0596}",
13
+ REVIA: "\u{0597}",
14
+ ZARQA: "\u{0598}",
15
+ PASHTA: "\u{0599}",
16
+ YETIV: "\u{059A}",
17
+ TEVIR: "\u{059B}",
18
+ GERESH: "\u{059C}",
19
+ GERESH_MUQDAM: "\u{059D}",
20
+ GERSHAYIM: "\u{059E}",
21
+ QARNEY_PARA: "\u{059F}",
22
+ TELISHA_GEDOLA: "\u{05A0}",
23
+ PAZER: "\u{05A1}",
24
+ ATNAH_HAFUKH: "\u{05A2}",
25
+ MUNAH: "\u{05A3}",
26
+ MAHAPAKH: "\u{05A4}",
27
+ MERKHA: "\u{05A5}",
28
+ MERKHA_KEFULA: "\u{05A6}",
29
+ DARGA: "\u{05A7}",
30
+ QADMA: "\u{05A8}",
31
+ TELISHA_QETANA: "\u{05A9}",
32
+ YERAH_BEN_YOMO: "\u{05AA}",
33
+ OLE: "\u{05AB}",
34
+ ILUY: "\u{05AC}",
35
+ DEHI: "\u{05AD}",
36
+ ZINOR: "\u{05AE}",
37
+ // points //
38
+ SHEVA: "\u{05B0}",
39
+ HATAF_SEGOL: "\u{05B1}",
40
+ HATAF_PATAH: "\u{05B2}",
41
+ HATAF_QAMATS: "\u{05B3}",
42
+ HIRIQ: "\u{05B4}",
43
+ TSERE: "\u{05B5}",
44
+ SEGOL: "\u{05B6}",
45
+ PATAH: "\u{05B7}",
46
+ QAMATS: "\u{05B8}",
47
+ HOLAM: "\u{05B9}",
48
+ // below is not needed because sequnce() does not output this
49
+ // HOLAM_HASER_FOR_VAV: "\u{05BA}", // HEBREW POINT HOLAM HASER FOR VAV
50
+ QUBUTS: "\u{05BB}",
51
+ DAGESH: "\u{05BC}",
52
+ METEG: "\u{05BD}",
53
+ RAFE: "\u{05BF}",
54
+ SHIN_DOT: "\u{05C1}",
55
+ SIN_DOT: "\u{05C2}",
56
+ QAMATS_QATAN: "\u{05C7}",
57
+ MAQAF: "\u{05BE}",
58
+ PASEQ: "\u{05C0}",
59
+ SOF_PASUQ: "\u{05C3}",
60
+ NUN_HAFUKHA: "\u{05C6}",
61
+ // the punctuation geresh/gereshayim is different then the accent ones
62
+ PUNC_GERESH: "\u{05F3}",
63
+ PUNC_GERSHAYIM: "\u{05F4}",
64
+ MASORA_CIRCLE: "\u{05AF}",
65
+ UPPER_DOT: "\u{05C4}",
66
+ LOWER_DOT: "\u{05C5}" // U+LOWER DOT HEBREW MARK 05C5];
67
+ };
68
+ /**
69
+ * removes all chars called HEBREW ACCENT (U+0591-05AF)
70
+ */
71
+ exports.accents = {
72
+ ETNAHTA: true,
73
+ SEGOLTA: true,
74
+ SHALSHELET: true,
75
+ ZAQEF_QATAN: true,
76
+ ZAQEF_GADOL: true,
77
+ TIPEHA: true,
78
+ REVIA: true,
79
+ ZARQA: true,
80
+ PASHTA: true,
81
+ YETIV: true,
82
+ TEVIR: true,
83
+ GERESH: true,
84
+ GERESH_MUQDAM: true,
85
+ GERSHAYIM: true,
86
+ QARNEY_PARA: true,
87
+ TELISHA_GEDOLA: true,
88
+ PAZER: true,
89
+ ATNAH_HAFUKH: true,
90
+ MUNAH: true,
91
+ MAHAPAKH: true,
92
+ MERKHA: true,
93
+ MERKHA_KEFULA: true,
94
+ DARGA: true,
95
+ QADMA: true,
96
+ TELISHA_QETANA: true,
97
+ YERAH_BEN_YOMO: true,
98
+ OLE: true,
99
+ ILUY: true,
100
+ DEHI: true,
101
+ ZINOR: true
102
+ };
103
+ /**
104
+ * removes all chars called HEBREW POINT (U+05B0-05BD, U+05BF, U+05C1-05C2 and U+05C7)
105
+ */
106
+ exports.points = {
107
+ SHEVA: true,
108
+ HATAF_SEGOL: true,
109
+ HATAF_PATAH: true,
110
+ HATAF_QAMATS: true,
111
+ HIRIQ: true,
112
+ TSERE: true,
113
+ SEGOL: true,
114
+ PATAH: true,
115
+ QAMATS: true,
116
+ HOLAM: true,
117
+ QUBUTS: true,
118
+ DAGESH: true,
119
+ SHIN_DOT: true,
120
+ SIN_DOT: true,
121
+ METEG: true,
122
+ RAFE: true,
123
+ QAMATS_QATAN: true
124
+ };
125
+ /**
126
+ * removes chars called HEBREW POINT (U+05B0-05BC and U+05C7) except for:
127
+ * - SHIN_DOT
128
+ * - SIN_DOT
129
+ * - METEG
130
+ * - RAFE
131
+ */
132
+ exports.vowels = {
133
+ SHEVA: true,
134
+ HATAF_SEGOL: true,
135
+ HATAF_PATAH: true,
136
+ HATAF_QAMATS: true,
137
+ HIRIQ: true,
138
+ TSERE: true,
139
+ SEGOL: true,
140
+ PATAH: true,
141
+ QAMATS: true,
142
+ HOLAM: true,
143
+ QUBUTS: true,
144
+ DAGESH: true,
145
+ QAMATS_QATAN: true
146
+ };
10
147
  /**
11
- * removes taamim and optionally removes certain niqqudim
148
+ * removes all chars called HEBREW PUNCTUATION (U+05BE, U+05C0, U+05C3, and U+05C6)
149
+ */
150
+ exports.punctuation = {
151
+ MAQAF: true,
152
+ PASEQ: true,
153
+ SOF_PASUQ: true,
154
+ NUN_HAFUKHA: true,
155
+ PUNC_GERESH: true,
156
+ PUNC_GERSHAYIM: true
157
+ };
158
+ /**
159
+ * removes all chars called HEBREW MARK (U+05AF, U+05C4, and U+05C5)
160
+ */
161
+ exports.marks = {
162
+ MASORA_CIRCLE: true,
163
+ UPPER_DOT: true,
164
+ LOWER_DOT: true
165
+ };
166
+ exports.all = Object.assign(Object.assign(Object.assign(Object.assign({}, exports.accents), exports.points), exports.punctuation), exports.marks);
167
+ /**
168
+ * removes niqqud from Hebrew text
12
169
  *
13
170
  * @param text - a string of Hebrew characters
14
- * @param RemoveOptions - {@link RemoveOptions}
15
- * @returns Hebrew characters with taamim and niqqud optionally removed
171
+ * @param options
172
+ * @returns Hebrew characters with accents and niqqud optionally removed
16
173
  *
17
174
  * @example Default
18
175
  *
19
176
  * ```ts
20
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔");
21
- * // "שָׂרַי אִשְׁתְּךָ";
177
+ * // by default removes all accents and metheg and rafe
178
+ * remove("שָׂרַ֣י אִשְׁתְּךָ֔, וַֽיִּמְצְא֗וּ");
179
+ * // שָׂרַי אִשְׁתְּךָ, וַיִּמְצְאוּ
22
180
  * ```
23
181
  *
24
- * @example Remove vowels
182
+ * @example Remove accents and vowels, but not shin/sin dots
25
183
  *
26
184
  * ```ts
27
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true });
28
- * // "שׂרי אשׁתך";
185
+ * import { accents, vowelsl } from "hebrew-transliteration/removeOptions";
186
+ *
187
+ * remove("שָׂרַ֣י אִשְׁתְּךָ֔, וַֽיִּמְצְא֗וּ", { ...accents, ...vowels, METEG: true });
188
+ * // שׂרי אשׁתך, וימצאו
29
189
  * ```
30
190
  *
31
191
  * @example Remove all
32
192
  *
33
193
  * ```ts
34
- * heb.remove("שָׂרַ֣י אִשְׁתְּךָ֔", { removeVowels: true, removeShinDot: true, removeSinDot: true });
35
- * // "שרי אשתך";
194
+ * import { all } from "hebrew-transliteration/removeOptions";
195
+ *
196
+ * remove("שָׂרַ֣י אִשְׁתְּךָ֔, וַֽיִּמְצְא֗וּ", all);
197
+ * // שרי אשתך, וימצאו
36
198
  * ```
37
199
  */
38
- const remove = (text, { removeVowels = false, removeShinDot = false, removeSinDot = false } = {}) => {
200
+ const remove = (text, options = Object.assign(Object.assign({}, exports.accents), { METEG: true, RAFE: true })) => {
201
+ /** all the keys of options that are to be removed */
202
+ const keys = Object.keys(options).filter((k) => (k in options ? options[k] : false));
39
203
  const sequenced = (0, sequence_1.sequence)(text);
40
- const remCantillation = removeItem(sequenced, cantillation);
41
- const remVowels = removeVowels ? removeItem(remCantillation, vowels) : remCantillation;
42
- const remShin = removeShinDot ? removeItem(remVowels, shinDot) : remVowels;
43
- return removeSinDot ? removeItem(remShin, sinDot) : remShin;
204
+ return keys.reduce((a, c) => {
205
+ var _a;
206
+ const key = (_a = removeMap[c]) !== null && _a !== void 0 ? _a : null;
207
+ if (key) {
208
+ return a.replace(new RegExp(key, "gu"), "");
209
+ }
210
+ return a;
211
+ }, sequenced);
44
212
  };
45
213
  exports.remove = remove;
package/dist/schema.d.ts CHANGED
@@ -425,7 +425,12 @@ export declare class Schema implements SylOpts {
425
425
  * - `"word"` covers everything else
426
426
  */
427
427
  FEATURE: "word" | "syllable" | "cluster";
428
- /** use consonants and vowels; do not use taamim */
428
+ /**
429
+ * The Hebrew text — use consonants and vowels; do not use taamim
430
+ *
431
+ * The text is parsed as a Regex so special characters like `?` and `|` can be used
432
+ *
433
+ */
429
434
  HEBREW: string;
430
435
  TRANSLITERATION: string;
431
436
  }[];
@@ -469,6 +474,7 @@ export declare class Schema implements SylOpts {
469
474
  wawShureq: SylOpts["wawShureq"];
470
475
  article: SylOpts["article"];
471
476
  allowNoNiqqud: SylOpts["allowNoNiqqud"];
477
+ strict: SylOpts["strict"];
472
478
  constructor(schema: Schema);
473
479
  }
474
480
  export declare class SBL extends Schema {
package/dist/schema.js CHANGED
@@ -75,14 +75,15 @@ class Schema {
75
75
  (this.qametsQatan = schema.qametsQatan),
76
76
  (this.sqnmlvy = schema.sqnmlvy),
77
77
  (this.wawShureq = schema.wawShureq),
78
- (this.article = schema.article);
79
- this.allowNoNiqqud = schema.allowNoNiqqud;
78
+ (this.article = schema.article),
79
+ (this.allowNoNiqqud = schema.allowNoNiqqud),
80
+ (this.strict = schema.strict);
80
81
  }
81
82
  }
82
83
  exports.Schema = Schema;
83
84
  class SBL extends Schema {
84
85
  constructor(schema) {
85
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _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;
86
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _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;
86
87
  super({
87
88
  VOCAL_SHEVA: (_a = schema.VOCAL_SHEVA) !== null && _a !== void 0 ? _a : "ǝ",
88
89
  HATAF_SEGOL: (_b = schema.HATAF_SEGOL) !== null && _b !== void 0 ? _b : "ĕ",
@@ -154,7 +155,8 @@ class SBL extends Schema {
154
155
  sqnmlvy: (_43 = schema.sqnmlvy) !== null && _43 !== void 0 ? _43 : true,
155
156
  wawShureq: (_44 = schema.wawShureq) !== null && _44 !== void 0 ? _44 : true,
156
157
  article: (_45 = schema.article) !== null && _45 !== void 0 ? _45 : true,
157
- allowNoNiqqud: (_46 = schema.allowNoNiqqud) !== null && _46 !== void 0 ? _46 : true
158
+ allowNoNiqqud: (_46 = schema.allowNoNiqqud) !== null && _46 !== void 0 ? _46 : true,
159
+ strict: (_47 = schema.strict) !== null && _47 !== void 0 ? _47 : false
158
160
  });
159
161
  }
160
162
  }
@@ -70,5 +70,6 @@ exports.brillAcademic = {
70
70
  sqnmlvy: true,
71
71
  wawShureq: true,
72
72
  article: true,
73
- allowNoNiqqud: true
73
+ allowNoNiqqud: true,
74
+ strict: false
74
75
  };
@@ -69,5 +69,6 @@ exports.brillSimple = {
69
69
  sqnmlvy: true,
70
70
  wawShureq: true,
71
71
  article: true,
72
- allowNoNiqqud: true
72
+ allowNoNiqqud: true,
73
+ strict: false
73
74
  };
@@ -2,4 +2,5 @@ import { brillAcademic } from "./brillAcademic";
2
2
  import { brillSimple } from "./brillSimple";
3
3
  import { sblAcademicSpirantization } from "./sblAcademicSpirantization";
4
4
  import { sblSimple } from "./sblSimple";
5
- export { brillAcademic, brillSimple, sblAcademicSpirantization, sblSimple };
5
+ import { michiganClaremont } from "./michiganClaremont";
6
+ export { brillAcademic, brillSimple, sblAcademicSpirantization, sblSimple, michiganClaremont };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sblSimple = exports.sblAcademicSpirantization = exports.brillSimple = exports.brillAcademic = void 0;
3
+ exports.michiganClaremont = exports.sblSimple = exports.sblAcademicSpirantization = exports.brillSimple = exports.brillAcademic = void 0;
4
4
  const brillAcademic_1 = require("./brillAcademic");
5
5
  Object.defineProperty(exports, "brillAcademic", { enumerable: true, get: function () { return brillAcademic_1.brillAcademic; } });
6
6
  const brillSimple_1 = require("./brillSimple");
@@ -9,3 +9,5 @@ const sblAcademicSpirantization_1 = require("./sblAcademicSpirantization");
9
9
  Object.defineProperty(exports, "sblAcademicSpirantization", { enumerable: true, get: function () { return sblAcademicSpirantization_1.sblAcademicSpirantization; } });
10
10
  const sblSimple_1 = require("./sblSimple");
11
11
  Object.defineProperty(exports, "sblSimple", { enumerable: true, get: function () { return sblSimple_1.sblSimple; } });
12
+ const michiganClaremont_1 = require("./michiganClaremont");
13
+ Object.defineProperty(exports, "michiganClaremont", { enumerable: true, get: function () { return michiganClaremont_1.michiganClaremont; } });
@@ -63,5 +63,6 @@ exports.michiganClaremont = {
63
63
  sqnmlvy: false,
64
64
  wawShureq: true,
65
65
  article: false,
66
- allowNoNiqqud: true
66
+ allowNoNiqqud: true,
67
+ strict: false
67
68
  };
@@ -0,0 +1,2 @@
1
+ import { Schema } from "../schema";
2
+ export declare const romaniote: Schema;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.romaniote = void 0;
4
+ exports.romaniote = {
5
+ ALEF: "",
6
+ BET: "β",
7
+ BET_DAGESH: "μπ",
8
+ GIMEL: "γ",
9
+ GIMEL_DAGESH: "γκ",
10
+ DALET: "δ",
11
+ DALET_DAGESH: "ντ",
12
+ HE: "",
13
+ VAV: "β",
14
+ ZAYIN: "ζ",
15
+ HET: "χ",
16
+ TET: "τ",
17
+ YOD: "γι",
18
+ KAF: "χ",
19
+ KAF_DAGESH: "κ",
20
+ FINAL_KAF: "χ",
21
+ LAMED: "λ",
22
+ MEM: "μ",
23
+ FINAL_MEM: "μ",
24
+ NUN: "ν",
25
+ FINAL_NUN: "ν",
26
+ SAMEKH: "σ",
27
+ AYIN: "",
28
+ PE: "φ",
29
+ PE_DAGESH: "π",
30
+ FINAL_PE: "φ",
31
+ TSADI: "τσ",
32
+ FINAL_TSADI: "τς",
33
+ QOF: "κ",
34
+ RESH: "ρ",
35
+ SIN: "σ",
36
+ SHIN: "σσ",
37
+ TAV: "θ",
38
+ TAV_DAGESH: "τ",
39
+ DAGESH: "",
40
+ DAGESH_CHAZAQ: false,
41
+ VOCAL_SHEVA: "ε",
42
+ PATAH: "α",
43
+ HATAF_PATAH: "α",
44
+ QAMATS: "α",
45
+ HATAF_QAMATS: "ο",
46
+ SEGOL: "ε",
47
+ HATAF_SEGOL: "ε",
48
+ TSERE: "ε",
49
+ HIRIQ: "ι",
50
+ HOLAM: "ω",
51
+ QUBUTS: "ου",
52
+ QAMATS_HE: "α",
53
+ SEGOL_HE: "ε",
54
+ TSERE_HE: "ε",
55
+ SEGOL_YOD: "ε",
56
+ HIRIQ_YOD: "η",
57
+ TSERE_YOD: "ε",
58
+ FURTIVE_PATAH: "a",
59
+ QAMATS_QATAN: "ο",
60
+ HOLAM_VAV: "ω",
61
+ SHUREQ: "ου",
62
+ MS_SUFX: "άβ",
63
+ PASEQ: "",
64
+ SOF_PASUQ: "",
65
+ MAQAF: "-",
66
+ DIVINE_NAME: "Αδωνάη",
67
+ ADDITIONAL_FEATURES: [
68
+ {
69
+ FEATURE: "cluster",
70
+ HEBREW: "זּ",
71
+ TRANSLITERATION: "τζ"
72
+ },
73
+ {
74
+ FEATURE: "syllable",
75
+ HEBREW: "ִים",
76
+ TRANSLITERATION: "είμ"
77
+ },
78
+ // https://github.com/microsoft/TypeScript/issues/36444
79
+ // can I define a final tsere-yod where syllable.isFinal
80
+ // https://stackoverflow.com/questions/56949513/typescript-type-of-a-property-dependent-on-another-property-within-the-same-obj
81
+ {
82
+ FEATURE: "syllable",
83
+ HEBREW: "\u{05B5}\u{05D9}$",
84
+ TRANSLITERATION: "αί"
85
+ },
86
+ {
87
+ FEATURE: "syllable",
88
+ HEBREW: "\u{05B5}\u{05D9}[\u{05BE}|-]?$",
89
+ TRANSLITERATION: "αί-"
90
+ },
91
+ {
92
+ FEATURE: "cluster",
93
+ HEBREW: "\u{5E9}\u{5C1}$",
94
+ TRANSLITERATION: "σς"
95
+ },
96
+ {
97
+ FEATURE: "cluster",
98
+ HEBREW: "\u{5E9}\u{5C1}$",
99
+ TRANSLITERATION: "σς"
100
+ }
101
+ ],
102
+ longVowels: true,
103
+ sqnmlvy: true,
104
+ qametsQatan: true,
105
+ wawShureq: true,
106
+ article: true,
107
+ allowNoNiqqud: true,
108
+ strict: false
109
+ };
@@ -69,5 +69,6 @@ exports.sblAcademicSpirantization = {
69
69
  sqnmlvy: true,
70
70
  wawShureq: true,
71
71
  article: true,
72
- allowNoNiqqud: true
72
+ allowNoNiqqud: true,
73
+ strict: false
73
74
  };
@@ -61,10 +61,23 @@ exports.sblSimple = {
61
61
  SOF_PASUQ: "",
62
62
  MAQAF: "-",
63
63
  DIVINE_NAME: "yhwh",
64
+ ADDITIONAL_FEATURES: [
65
+ {
66
+ FEATURE: "cluster",
67
+ HEBREW: "\u{05E9}\u{05C1}\u{05BC}",
68
+ TRANSLITERATION: "sh"
69
+ },
70
+ {
71
+ FEATURE: "cluster",
72
+ HEBREW: "\u{05E6}\u{05BC}",
73
+ TRANSLITERATION: "ts"
74
+ }
75
+ ],
64
76
  longVowels: true,
65
77
  sqnmlvy: true,
66
78
  qametsQatan: true,
67
79
  wawShureq: true,
68
80
  article: true,
69
- allowNoNiqqud: true
81
+ allowNoNiqqud: true,
82
+ strict: false
70
83
  };
@@ -25,6 +25,8 @@ const getSylOpts = (schema) => {
25
25
  options.article = schema.article;
26
26
  if ("allowNoNiqqud" in schema)
27
27
  options.allowNoNiqqud = schema.allowNoNiqqud;
28
+ if ("strict" in schema)
29
+ options.strict = schema.strict;
28
30
  return options;
29
31
  };
30
32
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hebrew-transliteration",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "description": "a package for transliterating Hebrew",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,12 +15,20 @@
15
15
  "types": "./dist/schemas/index.d.ts",
16
16
  "require": "./dist/schemas/index.js",
17
17
  "import": "./dist/schemas/index.js"
18
+ },
19
+ "./removeOptions": {
20
+ "types": "./dist/remove.d.ts",
21
+ "require": "./dist/remove.js",
22
+ "import": "./dist/remove.js"
18
23
  }
19
24
  },
20
25
  "typesVersions": {
21
26
  "*": {
22
27
  "schemas": [
23
28
  "./dist/schemas/index.d.ts"
29
+ ],
30
+ "removeOptions": [
31
+ "./dist/remove.d.ts"
24
32
  ]
25
33
  }
26
34
  },
@@ -56,22 +64,22 @@
56
64
  "author": "Charles Loder",
57
65
  "license": "MIT",
58
66
  "devDependencies": {
59
- "@types/jest": "^29.2.0",
60
- "@typescript-eslint/eslint-plugin": "^5.41.0",
61
- "esbuild": "^0.15.12",
62
- "eslint": "^8.26.0",
67
+ "@types/jest": "^29.2.2",
68
+ "@typescript-eslint/eslint-plugin": "^5.42.1",
69
+ "esbuild": "^0.15.13",
70
+ "eslint": "^8.27.0",
63
71
  "eslint-config-prettier": "^8.5.0",
64
- "eslint-plugin-jest": "^27.1.3",
65
- "eslint-plugin-jsdoc": "^39.3.25",
72
+ "eslint-plugin-jest": "^27.1.4",
73
+ "eslint-plugin-jsdoc": "^39.6.2",
66
74
  "eslint-plugin-prefer-arrow": "^1.2.3",
67
- "jest": "^29.2.2",
68
- "npm-check-updates": "^16.3.15",
75
+ "jest": "^29.3.1",
76
+ "npm-check-updates": "^16.3.18",
69
77
  "npm-dts": "^1.3.12",
70
78
  "prettier": "^2.7.1",
71
79
  "ts-jest": "^29.0.3",
72
80
  "typescript": "^4.8.4"
73
81
  },
74
82
  "dependencies": {
75
- "havarotjs": "^0.10.1"
83
+ "havarotjs": "^0.11.2"
76
84
  }
77
85
  }