henkan 2.2.4 → 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/dist/index.cjs.js +671 -592
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +659 -589
- package/dist/index.mjs.map +3 -3
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/types.d.ts +22 -12
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +34 -22
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/README.md +2 -0
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertJawiktionaryAsync.md +1 -1
- package/docs/api/functions/convertJawiktionarySync.md +1 -1
- package/docs/api/functions/convertKanjiDic.md +1 -1
- package/docs/api/functions/convertKradFile.md +1 -1
- package/docs/api/functions/convertRadkFile.md +1 -1
- package/docs/api/functions/convertTanakaCorpus.md +1 -1
- package/docs/api/functions/convertTanakaCorpusWithFurigana.md +1 -1
- package/docs/api/functions/createEntryMaps.md +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getKanji.md +4 -4
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getValidForms.md +1 -1
- package/docs/api/functions/getWord.md +4 -4
- package/docs/api/functions/getWordDefinitions.md +4 -4
- package/docs/api/functions/getWordDefinitionsWithFurigana.md +1 -1
- package/docs/api/functions/hiraganaToKatakana.md +27 -0
- package/docs/api/functions/katakanaToHiragana.md +27 -0
- package/docs/api/interfaces/DefaultNoteInfo.md +4 -4
- package/docs/api/interfaces/Definition.md +6 -2
- package/docs/api/interfaces/DictKanjiMisc.md +1 -1
- package/docs/api/interfaces/DictWord.md +3 -3
- package/docs/api/interfaces/Grammar.md +16 -16
- package/docs/api/interfaces/GrammarMeaning.md +3 -3
- package/docs/api/interfaces/JaWiktionaryEntry.md +2 -2
- package/docs/api/interfaces/Kana.md +11 -11
- package/docs/api/interfaces/Kanji.md +24 -24
- package/docs/api/interfaces/KanjiComponent.md +3 -3
- package/docs/api/interfaces/KanjiForm.md +4 -4
- package/docs/api/interfaces/NoteAndTag.md +3 -3
- package/docs/api/interfaces/NoteHeaderKeys.md +7 -7
- package/docs/api/interfaces/Phrase.md +5 -5
- package/docs/api/interfaces/Radical.md +16 -16
- package/docs/api/interfaces/Reading.md +5 -5
- package/docs/api/interfaces/ResultEntry.md +10 -10
- package/docs/api/interfaces/Translation.md +3 -3
- package/docs/api/interfaces/UsefulRegExps.md +8 -8
- package/docs/api/interfaces/Word.md +15 -15
- package/docs/api/interfaces/WordDefinitionPair.md +15 -3
- package/docs/api/type-aliases/Dict.md +1 -1
- package/docs/api/type-aliases/EntryType.md +1 -1
- package/docs/api/type-aliases/JLPT.md +1 -1
- package/docs/api/type-aliases/Result.md +1 -1
- package/package.json +7 -4
- package/src/constants.ts +1225 -0
- package/src/index.ts +3 -0
- package/src/types.ts +1056 -0
- package/src/utils.ts +3018 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,1056 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JLPT levels
|
|
3
|
+
*/
|
|
4
|
+
export type JLPT = `N${number}`;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Japanese parts of speech (from the `pos_title` field of `ja.wiktionary.org` pages)
|
|
8
|
+
*/
|
|
9
|
+
export type POS =
|
|
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
|
+
/**
|
|
48
|
+
* Standardized dictionary names
|
|
49
|
+
*/
|
|
50
|
+
export type DictName = "JMDict" | "Kanjidic" | "tanaka" | "radk" | "krad";
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A number written as a string
|
|
54
|
+
*/
|
|
55
|
+
export type StringNumber = `${number}`;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Word kanji form information
|
|
59
|
+
*
|
|
60
|
+
* Equivalent to the `k_ele` JMdict element
|
|
61
|
+
*/
|
|
62
|
+
export interface DictKanjiForm {
|
|
63
|
+
/**
|
|
64
|
+
* The kanji form of the word
|
|
65
|
+
*/
|
|
66
|
+
readonly form: string;
|
|
67
|
+
/**
|
|
68
|
+
* Other information about the kanji form
|
|
69
|
+
*
|
|
70
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_kinf}
|
|
71
|
+
*/
|
|
72
|
+
notes?: string[] | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Priority codes
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_freq}
|
|
77
|
+
*/
|
|
78
|
+
commonness?: string[] | undefined;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Word reading information
|
|
83
|
+
*
|
|
84
|
+
* Equivalent to the `r_ele` JMdict element
|
|
85
|
+
*/
|
|
86
|
+
export interface DictReading {
|
|
87
|
+
/**
|
|
88
|
+
* The reading of the word
|
|
89
|
+
*/
|
|
90
|
+
readonly reading: string;
|
|
91
|
+
/**
|
|
92
|
+
* Other information about the reading
|
|
93
|
+
*
|
|
94
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_rinf}
|
|
95
|
+
*/
|
|
96
|
+
notes?: string[] | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* Priority codes
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_freq}
|
|
101
|
+
*/
|
|
102
|
+
commonness?: string[] | undefined;
|
|
103
|
+
/**
|
|
104
|
+
* Kanji forms the reading is restricted to
|
|
105
|
+
*/
|
|
106
|
+
kanjiFormRestrictions?: string[] | undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* A word's readings-kanji forms pair
|
|
111
|
+
*/
|
|
112
|
+
export interface ReadingsKanjiFormsPair {
|
|
113
|
+
/**
|
|
114
|
+
* The readings
|
|
115
|
+
*/
|
|
116
|
+
readings: DictReading[];
|
|
117
|
+
/**
|
|
118
|
+
* The kanji forms
|
|
119
|
+
*/
|
|
120
|
+
kanjiForms?: DictKanjiForm[] | undefined;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A JMdict sense translation
|
|
125
|
+
*/
|
|
126
|
+
export type DictTranslation =
|
|
127
|
+
| string
|
|
128
|
+
| { translation: string; type: "lit" | "expl" | "tm" };
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Word meaning/sense information
|
|
132
|
+
*
|
|
133
|
+
* Equivalent to the `sense` JMdict element
|
|
134
|
+
*/
|
|
135
|
+
export interface DictMeaning {
|
|
136
|
+
/**
|
|
137
|
+
* Part of speech information
|
|
138
|
+
*
|
|
139
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_pos}
|
|
140
|
+
*/
|
|
141
|
+
partOfSpeech: string[];
|
|
142
|
+
/**
|
|
143
|
+
* Word glosses
|
|
144
|
+
*/
|
|
145
|
+
translations: DictTranslation[];
|
|
146
|
+
/**
|
|
147
|
+
* Cross-references to other similar/related words *(when used with this meaning)*
|
|
148
|
+
*/
|
|
149
|
+
references?: string[] | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Kanji forms the meaning is restricted to
|
|
152
|
+
*/
|
|
153
|
+
kanjiFormRestrictions?: string[] | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Readings the meaning is restricted to
|
|
156
|
+
*/
|
|
157
|
+
readingRestrictions?: string[] | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* References to antonyms of the word *(when used with this meaning)*
|
|
160
|
+
*/
|
|
161
|
+
antonyms?: string[] | undefined;
|
|
162
|
+
/**
|
|
163
|
+
* Field of application of the word *(when used with this meaning)*
|
|
164
|
+
*
|
|
165
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_fld}
|
|
166
|
+
*/
|
|
167
|
+
fields?: string[] | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Additional information about the meaning
|
|
170
|
+
*/
|
|
171
|
+
info?: string[] | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* Other relevant information about the meaning
|
|
174
|
+
*
|
|
175
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_misc}
|
|
176
|
+
*/
|
|
177
|
+
misc?: string[] | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Regional dialects the meaning is restricted to
|
|
180
|
+
*
|
|
181
|
+
* @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_dial}
|
|
182
|
+
*/
|
|
183
|
+
dialects?: string[] | undefined;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* JMdict entry (word)
|
|
188
|
+
*
|
|
189
|
+
* Equivalent to the `entry` JMdict element + miscellaneous info
|
|
190
|
+
*/
|
|
191
|
+
export interface DictWord {
|
|
192
|
+
/**
|
|
193
|
+
* The entry sequence number
|
|
194
|
+
*/
|
|
195
|
+
readonly id: StringNumber;
|
|
196
|
+
/**
|
|
197
|
+
* The word's readings
|
|
198
|
+
*/
|
|
199
|
+
readings: DictReading[];
|
|
200
|
+
/**
|
|
201
|
+
* The word's meanings/senses
|
|
202
|
+
*/
|
|
203
|
+
meanings: DictMeaning[];
|
|
204
|
+
/**
|
|
205
|
+
* The word's kanji forms
|
|
206
|
+
*/
|
|
207
|
+
kanjiForms?: DictKanjiForm[] | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Whether or not the entry has a priority tag (`k_pri` or `r_pri`)
|
|
210
|
+
*/
|
|
211
|
+
isCommon?: true | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Whether or not the word is typically written in kana alone
|
|
214
|
+
*
|
|
215
|
+
* Set to `true` only if the word is usually written in kana for all word senses.
|
|
216
|
+
*/
|
|
217
|
+
usuallyInKana?: true | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* Whether or not the entry has at least one Tanaka Corpus phrase associated with it
|
|
220
|
+
*
|
|
221
|
+
* **May not always be accurate**
|
|
222
|
+
*/
|
|
223
|
+
hasPhrases?: true | undefined;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Miscellaneous information about the kanji
|
|
228
|
+
*
|
|
229
|
+
* Equivalent to the `misc` KANJIDIC2 element *(excluding some subelements)*
|
|
230
|
+
*/
|
|
231
|
+
export interface DictKanjiMisc {
|
|
232
|
+
/**
|
|
233
|
+
* The stroke count of the kanji, including the radical
|
|
234
|
+
*/
|
|
235
|
+
strokeNumber?: string | undefined;
|
|
236
|
+
/**
|
|
237
|
+
* The kanji grade level
|
|
238
|
+
*
|
|
239
|
+
* 1-6 -> {@link https://en.wikipedia.org/wiki/Ky%C5%8Diku_kanji | Kyōiku kanji}
|
|
240
|
+
*
|
|
241
|
+
* 7-8 -> {@link https://en.wikipedia.org/wiki/J%C5%8Dy%C5%8D_kanji | Jōyō kanji} (excluding Kyōiku kanji)
|
|
242
|
+
*
|
|
243
|
+
* 9-10 -> {@link https://en.wikipedia.org/wiki/Jinmeiy%C5%8D_kanji | Jinmeiyō kanji}
|
|
244
|
+
*/
|
|
245
|
+
grade?: string | undefined;
|
|
246
|
+
/**
|
|
247
|
+
* The frequency-of-use ranking
|
|
248
|
+
*
|
|
249
|
+
* A number from `1` to `2500`
|
|
250
|
+
*/
|
|
251
|
+
frequency?: string | undefined;
|
|
252
|
+
/**
|
|
253
|
+
* The {@link https://en.wikipedia.org/wiki/Japanese-Language_Proficiency_Test#Previous_format_(1984%E2%80%932009) | pre-2010 JLPT} level
|
|
254
|
+
*/
|
|
255
|
+
jlpt?: JLPT | undefined;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Kanji reading information
|
|
260
|
+
*/
|
|
261
|
+
export interface DictKanjiReading {
|
|
262
|
+
/**
|
|
263
|
+
* The kanji reading (hiragana or katakana)
|
|
264
|
+
*/
|
|
265
|
+
readonly reading: string;
|
|
266
|
+
/**
|
|
267
|
+
* The type of reading (onyomi or kunyomi)
|
|
268
|
+
*/
|
|
269
|
+
type: "ja_on" | "ja_kun";
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Kanji "readings-meanings" pair
|
|
274
|
+
*
|
|
275
|
+
* Equivalent to the `rmgroup` KANJIDIC2 element
|
|
276
|
+
*/
|
|
277
|
+
export interface DictKanjiReadingMeaningGroup {
|
|
278
|
+
/**
|
|
279
|
+
* The kanji readings
|
|
280
|
+
*/
|
|
281
|
+
readings?: DictKanjiReading[] | undefined;
|
|
282
|
+
/**
|
|
283
|
+
* The kanji meanings
|
|
284
|
+
*/
|
|
285
|
+
meanings?: string[] | undefined;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Kanji "readings-meanings" groups and nanori readings
|
|
290
|
+
*
|
|
291
|
+
* Equivalent to the `reading_meaning` KANJIDIC2 element
|
|
292
|
+
*/
|
|
293
|
+
export interface DictKanjiReadingMeaning {
|
|
294
|
+
/**
|
|
295
|
+
* The Kanji "readings-meanings" pairs
|
|
296
|
+
*/
|
|
297
|
+
groups?: DictKanjiReadingMeaningGroup[] | undefined;
|
|
298
|
+
/**
|
|
299
|
+
* The kanji nanori readings
|
|
300
|
+
*/
|
|
301
|
+
nanori?: string[] | undefined;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* KANJIDIC2 entry (kanji)
|
|
306
|
+
*
|
|
307
|
+
* Equivalent to the `character` KANJIDIC2 element *(excluding some subelements)*
|
|
308
|
+
*/
|
|
309
|
+
export interface DictKanji {
|
|
310
|
+
/**
|
|
311
|
+
* The kanji character
|
|
312
|
+
*/
|
|
313
|
+
readonly kanji: string;
|
|
314
|
+
/**
|
|
315
|
+
* The miscellaneous information about the kanji
|
|
316
|
+
*/
|
|
317
|
+
misc?: DictKanjiMisc | undefined;
|
|
318
|
+
/**
|
|
319
|
+
* The "readings-meanings" groups and nanori readings of the kanji
|
|
320
|
+
*/
|
|
321
|
+
readingMeaning?: DictKanjiReadingMeaning[] | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* Whether or not the kanji is kokuji
|
|
324
|
+
*/
|
|
325
|
+
isKokuji?: true | undefined;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* RADKFILE2 entry (radical)
|
|
330
|
+
*/
|
|
331
|
+
export interface DictRadical {
|
|
332
|
+
/**
|
|
333
|
+
* The radical character
|
|
334
|
+
*/
|
|
335
|
+
readonly radical: string;
|
|
336
|
+
/**
|
|
337
|
+
* The stroke count of the radical
|
|
338
|
+
*/
|
|
339
|
+
readonly strokes: string;
|
|
340
|
+
/**
|
|
341
|
+
* The kanji that include the radical
|
|
342
|
+
*/
|
|
343
|
+
kanji?: DictKanji[] | undefined;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* KRADFILE2 entry (kanji with its radicals/components)
|
|
348
|
+
*/
|
|
349
|
+
export interface DictKanjiWithRadicals {
|
|
350
|
+
/**
|
|
351
|
+
* The kanji character
|
|
352
|
+
*/
|
|
353
|
+
readonly kanji: string;
|
|
354
|
+
/**
|
|
355
|
+
* The radicals/components that make up the kanji
|
|
356
|
+
*
|
|
357
|
+
* Can be {@link DictKanji} objects with either an actual kanji or a katakana character (which takes the place of the missing kanji)
|
|
358
|
+
*/
|
|
359
|
+
radicals: DictKanji[];
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* A word/part from the `B` section of a Tanaka Corpus `examples.utf` entry
|
|
364
|
+
*/
|
|
365
|
+
export interface ExamplePart {
|
|
366
|
+
/**
|
|
367
|
+
* The common form in which the word is found in JMdict
|
|
368
|
+
*/
|
|
369
|
+
baseForm: string;
|
|
370
|
+
/**
|
|
371
|
+
* The reading (in kana) of the word
|
|
372
|
+
*/
|
|
373
|
+
reading?: string | undefined;
|
|
374
|
+
/**
|
|
375
|
+
* The JMdict sense number corresponding to the word’s usage in the phrase
|
|
376
|
+
*/
|
|
377
|
+
glossNumber?: number | undefined;
|
|
378
|
+
/**
|
|
379
|
+
* The actual form in which the word is used in the phrase
|
|
380
|
+
*/
|
|
381
|
+
inflectedForm?: string | undefined;
|
|
382
|
+
/**
|
|
383
|
+
* A sequence number that references a JMdict entry associated with the word
|
|
384
|
+
*/
|
|
385
|
+
referenceID?: StringNumber | undefined;
|
|
386
|
+
/**
|
|
387
|
+
* Whether or not the word is part of an entry that has been edited and adapted
|
|
388
|
+
*
|
|
389
|
+
* {@link https://www.edrdg.org/wiki/Tanaka_Corpus.html#Subset}
|
|
390
|
+
*
|
|
391
|
+
* {@link https://www.edrdg.org/wiki/Tanaka_Corpus.html#Initial_Modifications_to_the_Corpus}
|
|
392
|
+
*/
|
|
393
|
+
edited?: true | undefined;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* A pair of a word ID and a number associated with a gloss number
|
|
398
|
+
*/
|
|
399
|
+
export interface GlossSpecificNumber {
|
|
400
|
+
/**
|
|
401
|
+
* The entry ID
|
|
402
|
+
*/
|
|
403
|
+
readonly wordId: StringNumber;
|
|
404
|
+
/**
|
|
405
|
+
* The entry's gloss number
|
|
406
|
+
*/
|
|
407
|
+
readonly glossNumber: number;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export type TanakaID = `${number}_${number}`;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Tanaka Corpus `examples.utf` examples
|
|
414
|
+
*/
|
|
415
|
+
export interface TanakaExample {
|
|
416
|
+
/**
|
|
417
|
+
* The ID of the example
|
|
418
|
+
*/
|
|
419
|
+
readonly id: TanakaID;
|
|
420
|
+
/**
|
|
421
|
+
* The Japanese phrase (found in the `A` section, **before** the tab)
|
|
422
|
+
*/
|
|
423
|
+
readonly phrase: string;
|
|
424
|
+
/**
|
|
425
|
+
* The English translation of the phrase (found in the `A` section, **after** the tab)
|
|
426
|
+
*/
|
|
427
|
+
readonly translation: string;
|
|
428
|
+
/**
|
|
429
|
+
* The `B` section, split into parts
|
|
430
|
+
*/
|
|
431
|
+
readonly parts: ExamplePart[];
|
|
432
|
+
/**
|
|
433
|
+
* The Japanese phrase, with furigana attached
|
|
434
|
+
*/
|
|
435
|
+
furigana?: string | undefined;
|
|
436
|
+
/**
|
|
437
|
+
* The word-gloss pair
|
|
438
|
+
*/
|
|
439
|
+
glossNumber?: GlossSpecificNumber | undefined;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* A `JMdict entry ID` ---> {@link DictWord} `object` map
|
|
444
|
+
*/
|
|
445
|
+
export type WordIDEntryMap = Map<StringNumber, DictWord>;
|
|
446
|
+
/**
|
|
447
|
+
* A `KANJIDIC kanji character` ---> {@link DictKanji} `object` map
|
|
448
|
+
*/
|
|
449
|
+
export type KanjiEntryMap = Map<string, DictKanji>;
|
|
450
|
+
/**
|
|
451
|
+
* A `KANJIDIC kanji character` ---> `SVG filename` map
|
|
452
|
+
*/
|
|
453
|
+
export type KanjiSVGMap = Map<string, string>;
|
|
454
|
+
/**
|
|
455
|
+
* A `KANJIDIC kanji character` ---> `JMdict entries with kanji forms that include the kanji` map
|
|
456
|
+
*/
|
|
457
|
+
export type KanjiWordsMap = Map<string, DictWord[]>;
|
|
458
|
+
/**
|
|
459
|
+
* A `JMdict entry ID` ---> `Tanaka examples associated with the JMdict entry` map
|
|
460
|
+
*/
|
|
461
|
+
export type WordExamplesMap = Map<StringNumber, TanakaExample[]>;
|
|
462
|
+
/**
|
|
463
|
+
* A `JMdict entry ID` ---> `Japanese definitions associated with the JMdict entry` map
|
|
464
|
+
*/
|
|
465
|
+
export type WordDefinitionsMap = Map<StringNumber, Definition[]>;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Maps with various entry associations
|
|
469
|
+
*/
|
|
470
|
+
export interface EntryMaps {
|
|
471
|
+
/**
|
|
472
|
+
* @see {@link WordIDEntryMap}
|
|
473
|
+
*/
|
|
474
|
+
wordIDEntryMap?: WordIDEntryMap | undefined;
|
|
475
|
+
/**
|
|
476
|
+
* @see {@link KanjiWordsMap}
|
|
477
|
+
*/
|
|
478
|
+
kanjiWordsMap?: KanjiWordsMap | undefined;
|
|
479
|
+
/**
|
|
480
|
+
* @see {@link KanjiEntryMap}
|
|
481
|
+
*/
|
|
482
|
+
kanjiEntryMap?: KanjiEntryMap | undefined;
|
|
483
|
+
/**
|
|
484
|
+
* @see {@link WordExamplesMap}
|
|
485
|
+
*/
|
|
486
|
+
wordExamplesMap?: WordExamplesMap | undefined;
|
|
487
|
+
/**
|
|
488
|
+
* @see {@link WordDefinitionsMap}
|
|
489
|
+
*/
|
|
490
|
+
wordDefinitionsMap?: WordDefinitionsMap | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* @see {@link KanjiSVGMap}
|
|
493
|
+
*/
|
|
494
|
+
kanjiSVGMap?: KanjiSVGMap | undefined;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export interface JaWiktionaryEntrySense {
|
|
498
|
+
/**
|
|
499
|
+
* The sense's glosses
|
|
500
|
+
*/
|
|
501
|
+
glosses: string[];
|
|
502
|
+
/**
|
|
503
|
+
* The readings associated with the sense
|
|
504
|
+
*/
|
|
505
|
+
form_of?: string[] | undefined;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Useful information from a `ja.wiktionary.org` entry
|
|
510
|
+
*/
|
|
511
|
+
export interface JaWiktionaryEntry {
|
|
512
|
+
/**
|
|
513
|
+
* The "title" (word) of the page
|
|
514
|
+
*/
|
|
515
|
+
word: string;
|
|
516
|
+
/**
|
|
517
|
+
* The word senses
|
|
518
|
+
*/
|
|
519
|
+
senses: JaWiktionaryEntrySense[];
|
|
520
|
+
/**
|
|
521
|
+
* The part of speech (in Japanese)
|
|
522
|
+
*/
|
|
523
|
+
pos_title?: POS | undefined;
|
|
524
|
+
/**
|
|
525
|
+
* Other forms (as kanji form or kana) of the word
|
|
526
|
+
*/
|
|
527
|
+
forms?: string[] | undefined;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* A word definition
|
|
532
|
+
*/
|
|
533
|
+
export interface Definition {
|
|
534
|
+
/**
|
|
535
|
+
* The definition
|
|
536
|
+
*/
|
|
537
|
+
definition: string;
|
|
538
|
+
/**
|
|
539
|
+
* The definition with furigana attached
|
|
540
|
+
*/
|
|
541
|
+
furigana?: string | undefined;
|
|
542
|
+
/**
|
|
543
|
+
* Whether or not the definition is associated with other words
|
|
544
|
+
*
|
|
545
|
+
* - `undefined` - accurate
|
|
546
|
+
* - `1` - maybe inaccurate
|
|
547
|
+
* - `2` - most likely inaccurate
|
|
548
|
+
*/
|
|
549
|
+
mayNotBeAccurate?: 1 | 2 | undefined;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* A word paired with its definitions
|
|
554
|
+
*/
|
|
555
|
+
export interface WordDefinitionPair {
|
|
556
|
+
/**
|
|
557
|
+
* The word's JMdict entry ID
|
|
558
|
+
*/
|
|
559
|
+
wordID: StringNumber;
|
|
560
|
+
/**
|
|
561
|
+
* The word definitions
|
|
562
|
+
*/
|
|
563
|
+
definitions: Definition[];
|
|
564
|
+
/**
|
|
565
|
+
* The word's readings and/or kanji forms used when searching definitions.
|
|
566
|
+
*
|
|
567
|
+
* **Used for final checks in case of inaccurate definitions; always deleted afterwards**
|
|
568
|
+
*/
|
|
569
|
+
wordForms?: Set<string> | undefined;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Types of converted dictionary entries
|
|
574
|
+
*/
|
|
575
|
+
export type Dict =
|
|
576
|
+
| DictWord[]
|
|
577
|
+
| DictKanji[]
|
|
578
|
+
| TanakaExample[]
|
|
579
|
+
| DictRadical[]
|
|
580
|
+
| DictKanjiWithRadicals[]
|
|
581
|
+
| WordDefinitionPair[];
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Names of entry types used for the Anki note IDs
|
|
585
|
+
*/
|
|
586
|
+
export type EntryType = "word" | "kanji" | "radical" | "kana" | "grammar";
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Basic Anki note information
|
|
590
|
+
*/
|
|
591
|
+
export interface ResultEntry<E extends EntryType> {
|
|
592
|
+
/**
|
|
593
|
+
* ID used for the resulting Anki note
|
|
594
|
+
*/
|
|
595
|
+
noteID?: `${`${E}_` | ""}${string}` | undefined;
|
|
596
|
+
/**
|
|
597
|
+
* ID used for the Anki note ID
|
|
598
|
+
*/
|
|
599
|
+
id?: StringNumber | undefined;
|
|
600
|
+
/**
|
|
601
|
+
* Anki note type name
|
|
602
|
+
*/
|
|
603
|
+
noteTypeName?: string | undefined;
|
|
604
|
+
/**
|
|
605
|
+
* The full path of the Anki deck
|
|
606
|
+
*/
|
|
607
|
+
deckPath?: string | undefined;
|
|
608
|
+
/**
|
|
609
|
+
* Tags generated based on the entry's information
|
|
610
|
+
*/
|
|
611
|
+
tags?: string[] | undefined;
|
|
612
|
+
/**
|
|
613
|
+
* Whether or not this entry should be converted into an Anki note
|
|
614
|
+
*/
|
|
615
|
+
doNotCreateNote?: true | undefined;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* A pair of a "kanji form"/"reading"/"sense" note and its associated tag
|
|
620
|
+
*/
|
|
621
|
+
export interface NoteAndTag {
|
|
622
|
+
/**
|
|
623
|
+
* The note
|
|
624
|
+
*/
|
|
625
|
+
readonly note: string;
|
|
626
|
+
/**
|
|
627
|
+
* The tag
|
|
628
|
+
*/
|
|
629
|
+
readonly tag?: string | undefined;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* A kanji form of the word
|
|
634
|
+
*
|
|
635
|
+
* Converted from a {@link DictKanjiForm}
|
|
636
|
+
*/
|
|
637
|
+
export interface KanjiForm {
|
|
638
|
+
/**
|
|
639
|
+
* The kanji form
|
|
640
|
+
*/
|
|
641
|
+
readonly kanjiForm: string;
|
|
642
|
+
/**
|
|
643
|
+
* Optional notes for the kanji form
|
|
644
|
+
*/
|
|
645
|
+
notes?: string[] | undefined;
|
|
646
|
+
/**
|
|
647
|
+
* Whether or not the kanji form is common
|
|
648
|
+
*/
|
|
649
|
+
common?: true | undefined;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* A reading of the word
|
|
654
|
+
*
|
|
655
|
+
* Converted from {@link DictReading}
|
|
656
|
+
*/
|
|
657
|
+
export interface Reading {
|
|
658
|
+
/**
|
|
659
|
+
* The reading (in kana)
|
|
660
|
+
*/
|
|
661
|
+
readonly reading: string;
|
|
662
|
+
/**
|
|
663
|
+
* Optional notes for the reading
|
|
664
|
+
*/
|
|
665
|
+
notes?: string[] | undefined;
|
|
666
|
+
/**
|
|
667
|
+
* Whether or not the reading is common
|
|
668
|
+
*/
|
|
669
|
+
common?: true | undefined;
|
|
670
|
+
/**
|
|
671
|
+
* The filename of an audio file for the reading
|
|
672
|
+
*/
|
|
673
|
+
audio?: string | undefined;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* A translation of the word
|
|
678
|
+
*
|
|
679
|
+
* Converted from {@link DictMeaning}
|
|
680
|
+
*/
|
|
681
|
+
export interface Translation {
|
|
682
|
+
/**
|
|
683
|
+
* The translation
|
|
684
|
+
*/
|
|
685
|
+
readonly translation: string;
|
|
686
|
+
/**
|
|
687
|
+
* Information about the translation
|
|
688
|
+
*/
|
|
689
|
+
notes?: string[] | undefined;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Kanji component information
|
|
694
|
+
*/
|
|
695
|
+
export interface KanjiComponent {
|
|
696
|
+
/**
|
|
697
|
+
* The component character
|
|
698
|
+
*/
|
|
699
|
+
readonly component: string;
|
|
700
|
+
/**
|
|
701
|
+
* The meaning of the component
|
|
702
|
+
*/
|
|
703
|
+
meaning?: string | undefined;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* Kanji information
|
|
708
|
+
*
|
|
709
|
+
* Converted from {@link DictKanji} and extra info added
|
|
710
|
+
*/
|
|
711
|
+
export interface Kanji extends ResultEntry<"kanji"> {
|
|
712
|
+
/**
|
|
713
|
+
* @see {@link DictKanji.kanji}
|
|
714
|
+
*/
|
|
715
|
+
readonly kanji: string;
|
|
716
|
+
/**
|
|
717
|
+
* @see {@link DictKanjiMisc.strokeNumber}
|
|
718
|
+
*/
|
|
719
|
+
strokes?: string | undefined;
|
|
720
|
+
/**
|
|
721
|
+
* @see {@link DictKanjiReadingMeaningGroup.meanings}
|
|
722
|
+
*/
|
|
723
|
+
meanings?: string[] | undefined;
|
|
724
|
+
/**
|
|
725
|
+
* The kanji onyomi readings
|
|
726
|
+
*/
|
|
727
|
+
onyomi?: string[] | undefined;
|
|
728
|
+
/**
|
|
729
|
+
* The kanji kunyomi readings
|
|
730
|
+
*/
|
|
731
|
+
kunyomi?: string[] | undefined;
|
|
732
|
+
/**
|
|
733
|
+
* @see {@link DictKanjiReadingMeaning.nanori}
|
|
734
|
+
*/
|
|
735
|
+
nanori?: string[] | undefined;
|
|
736
|
+
/**
|
|
737
|
+
* The kanji SVG filename
|
|
738
|
+
*/
|
|
739
|
+
svg?: string | undefined;
|
|
740
|
+
/**
|
|
741
|
+
* The kanji radicals/components
|
|
742
|
+
*/
|
|
743
|
+
components?: KanjiComponent[] | undefined;
|
|
744
|
+
/**
|
|
745
|
+
* The kanji mnemonic
|
|
746
|
+
*/
|
|
747
|
+
mnemonic?: string | undefined;
|
|
748
|
+
/**
|
|
749
|
+
* Words that use the kanji
|
|
750
|
+
*/
|
|
751
|
+
words?: Word[] | undefined;
|
|
752
|
+
/**
|
|
753
|
+
* @see {@link DictKanjiMisc.grade}
|
|
754
|
+
*/
|
|
755
|
+
grade?: string | undefined;
|
|
756
|
+
/**
|
|
757
|
+
* @see {@link DictKanjiMisc.frequency}
|
|
758
|
+
*/
|
|
759
|
+
frequency?: string | undefined;
|
|
760
|
+
/**
|
|
761
|
+
* @see {@link DictKanjiMisc.jlpt}
|
|
762
|
+
*/
|
|
763
|
+
jlpt?: JLPT | undefined;
|
|
764
|
+
/**
|
|
765
|
+
* Whether or not the kanji is a kokuji
|
|
766
|
+
*/
|
|
767
|
+
kokuji?: true | undefined;
|
|
768
|
+
/**
|
|
769
|
+
* The source (besides KANJIDIC) from which data for this kanji has been extracted
|
|
770
|
+
*/
|
|
771
|
+
source?: string | undefined;
|
|
772
|
+
/**
|
|
773
|
+
* Whether or not this kanji object contains information extracted from {@link source}
|
|
774
|
+
*/
|
|
775
|
+
externalInfo?: true | undefined;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Kanji radical/component information
|
|
780
|
+
*/
|
|
781
|
+
export interface Radical extends ResultEntry<"radical"> {
|
|
782
|
+
/**
|
|
783
|
+
* The radical/component character
|
|
784
|
+
*/
|
|
785
|
+
readonly radical: string;
|
|
786
|
+
/**
|
|
787
|
+
* The radical/component reading (in kana)
|
|
788
|
+
*/
|
|
789
|
+
reading: string;
|
|
790
|
+
/**
|
|
791
|
+
* The radical/component meanings
|
|
792
|
+
*/
|
|
793
|
+
meanings: string[];
|
|
794
|
+
/**
|
|
795
|
+
* The stroke count of the radical/component
|
|
796
|
+
*/
|
|
797
|
+
strokes?: string | undefined;
|
|
798
|
+
/**
|
|
799
|
+
* The radical/component SVG filename
|
|
800
|
+
*/
|
|
801
|
+
svg?: string | undefined;
|
|
802
|
+
/**
|
|
803
|
+
* The radical/component mnemonic
|
|
804
|
+
*/
|
|
805
|
+
mnemonic?: string | undefined;
|
|
806
|
+
/**
|
|
807
|
+
* Kanji that include the radical/component
|
|
808
|
+
*/
|
|
809
|
+
kanji?: Kanji[] | undefined;
|
|
810
|
+
/**
|
|
811
|
+
* The sources from which data for this radical/component has been extracted
|
|
812
|
+
*/
|
|
813
|
+
sources?: string[] | undefined;
|
|
814
|
+
/**
|
|
815
|
+
* Whether or not this radical/component object contains information extracted from {@link sources}
|
|
816
|
+
*/
|
|
817
|
+
externalInfo?: true | undefined;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Phrase information
|
|
822
|
+
*
|
|
823
|
+
* Converted from {@link TanakaExample}
|
|
824
|
+
*/
|
|
825
|
+
export interface Phrase {
|
|
826
|
+
/**
|
|
827
|
+
* The Japanese phrase, either with furigana attached or not
|
|
828
|
+
*/
|
|
829
|
+
readonly phrase: string;
|
|
830
|
+
/**
|
|
831
|
+
* @see {@link TanakaExample.translation}
|
|
832
|
+
*/
|
|
833
|
+
readonly translation: string;
|
|
834
|
+
/**
|
|
835
|
+
* @see {@link TanakaExample.phrase}
|
|
836
|
+
*/
|
|
837
|
+
readonly originalPhrase: string;
|
|
838
|
+
/**
|
|
839
|
+
* @see {@link TanakaExample.glossNumber}
|
|
840
|
+
*/
|
|
841
|
+
readonly glossNumber?: GlossSpecificNumber | undefined;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Word information
|
|
846
|
+
*
|
|
847
|
+
* Converted from {@link DictWord}
|
|
848
|
+
*/
|
|
849
|
+
export interface Word extends ResultEntry<"word"> {
|
|
850
|
+
/**
|
|
851
|
+
* The word readings (in kana)
|
|
852
|
+
*/
|
|
853
|
+
readings: Reading[];
|
|
854
|
+
/**
|
|
855
|
+
* The word translations/senses
|
|
856
|
+
*/
|
|
857
|
+
translations: Translation[];
|
|
858
|
+
/**
|
|
859
|
+
* The word kanji forms
|
|
860
|
+
*/
|
|
861
|
+
kanjiForms?: KanjiForm[] | undefined;
|
|
862
|
+
/**
|
|
863
|
+
* A list of kanji used in the kanji forms
|
|
864
|
+
*/
|
|
865
|
+
kanji?: Kanji[] | undefined;
|
|
866
|
+
/**
|
|
867
|
+
* Phrases associated to the word
|
|
868
|
+
*/
|
|
869
|
+
phrases?: Phrase[] | undefined;
|
|
870
|
+
/**
|
|
871
|
+
* Japanese definitions associated with the word
|
|
872
|
+
*/
|
|
873
|
+
definitions?: Definition[] | undefined;
|
|
874
|
+
/**
|
|
875
|
+
* @see {@link DictWord.isCommon}
|
|
876
|
+
*/
|
|
877
|
+
common?: true | undefined;
|
|
878
|
+
/**
|
|
879
|
+
* @see {@link DictWord.usuallyInKana}
|
|
880
|
+
*/
|
|
881
|
+
usuallyInKana?: true | undefined;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Kana information
|
|
886
|
+
*/
|
|
887
|
+
export interface Kana extends ResultEntry<"kana"> {
|
|
888
|
+
/**
|
|
889
|
+
* The kana character
|
|
890
|
+
*/
|
|
891
|
+
readonly kana: string;
|
|
892
|
+
/**
|
|
893
|
+
* The romaji reading of the kana
|
|
894
|
+
*/
|
|
895
|
+
reading: string;
|
|
896
|
+
/**
|
|
897
|
+
* The filename of an audio file for the kana reading
|
|
898
|
+
*/
|
|
899
|
+
audio?: string | undefined;
|
|
900
|
+
/**
|
|
901
|
+
* The kana SVG filename
|
|
902
|
+
*/
|
|
903
|
+
svg?: string | undefined;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Grammar point meaning
|
|
908
|
+
*/
|
|
909
|
+
export interface GrammarMeaning {
|
|
910
|
+
/**
|
|
911
|
+
* The meaning of the grammar point
|
|
912
|
+
*/
|
|
913
|
+
meaning: string;
|
|
914
|
+
/**
|
|
915
|
+
* An example phrase using the grammar point
|
|
916
|
+
*/
|
|
917
|
+
example?: string | undefined;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Grammar point information
|
|
922
|
+
*/
|
|
923
|
+
export interface Grammar extends ResultEntry<"grammar"> {
|
|
924
|
+
/**
|
|
925
|
+
* The most common form in which the grammar point written in
|
|
926
|
+
*/
|
|
927
|
+
readonly point: string;
|
|
928
|
+
/**
|
|
929
|
+
* The English meaning/translation of the grammar point
|
|
930
|
+
*/
|
|
931
|
+
meaning: GrammarMeaning;
|
|
932
|
+
/**
|
|
933
|
+
* The readings of the grammar point
|
|
934
|
+
*/
|
|
935
|
+
readings?: Reading[] | undefined;
|
|
936
|
+
/**
|
|
937
|
+
* Ways in which the grammar point is used in Japanese
|
|
938
|
+
*/
|
|
939
|
+
usages?: string[] | undefined;
|
|
940
|
+
/**
|
|
941
|
+
* Example phrase using the grammar point
|
|
942
|
+
*/
|
|
943
|
+
phrases?: Phrase[] | undefined;
|
|
944
|
+
/**
|
|
945
|
+
* The {@link https://en.wikipedia.org/wiki/Japanese-Language_Proficiency_Test#Test_format | post-2010 JLPT} level
|
|
946
|
+
*/
|
|
947
|
+
jlpt?: JLPT | undefined;
|
|
948
|
+
/**
|
|
949
|
+
* The source from which data for this grammar point has been extracted
|
|
950
|
+
*/
|
|
951
|
+
source?: string | undefined;
|
|
952
|
+
/**
|
|
953
|
+
* The filename of an audio file for the grammar point
|
|
954
|
+
*/
|
|
955
|
+
audio?: string | undefined;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Any type of converted entry from a {@link Dict} array + others not from a dictionary
|
|
960
|
+
*/
|
|
961
|
+
export type Result = Word | Kanji | Radical | Kana | Grammar;
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Default note ID, note type and deck name of a note
|
|
965
|
+
*
|
|
966
|
+
* Setting any of the properties to:
|
|
967
|
+
*
|
|
968
|
+
* - a `string` will make that string the default note ID/note type/deck name of the note in case {@link Result.noteID}/{@link Result.noteTypeName}/{@link Result.deckPath} is `undefined`.
|
|
969
|
+
*
|
|
970
|
+
* - `true` will require all {@link Result} objects to have {@link Result.noteID}/{@link Result.noteTypeName}/{@link Result.deckPath} set (*no default values*).
|
|
971
|
+
*
|
|
972
|
+
* - `undefined` (*or not set*) will require all {@link Result} objects to either have {@link Result.noteID}/{@link Result.noteTypeName}/{@link Result.deckPath} set or not set (*no default values*).
|
|
973
|
+
*
|
|
974
|
+
*/
|
|
975
|
+
export interface DefaultNoteInfo {
|
|
976
|
+
/**
|
|
977
|
+
* A default for {@link Result.noteID}
|
|
978
|
+
*
|
|
979
|
+
* `main_information` will make either the ID or kana/kanji/radical character the default note ID of the note.
|
|
980
|
+
*/
|
|
981
|
+
guid?: "main_information" | true | undefined;
|
|
982
|
+
/**
|
|
983
|
+
* A default for {@link Result.noteTypeName}
|
|
984
|
+
*/
|
|
985
|
+
noteType?: string | true | undefined;
|
|
986
|
+
/**
|
|
987
|
+
* A default for {@link Result.deckPath}
|
|
988
|
+
*/
|
|
989
|
+
deckPath?: string | true | undefined;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Anki note file headers keys
|
|
994
|
+
*
|
|
995
|
+
* @see {@link https://docs.ankiweb.net/importing/text-files.html#file-headers}
|
|
996
|
+
*/
|
|
997
|
+
export interface NoteHeaderKeys {
|
|
998
|
+
/**
|
|
999
|
+
* Field separator
|
|
1000
|
+
*/
|
|
1001
|
+
readonly separator: `${string}:${string}`;
|
|
1002
|
+
/**
|
|
1003
|
+
* HTML treatment
|
|
1004
|
+
*/
|
|
1005
|
+
readonly html: `${string}:${boolean}`;
|
|
1006
|
+
/**
|
|
1007
|
+
* GUID column header
|
|
1008
|
+
*/
|
|
1009
|
+
readonly guid: `${string}:`;
|
|
1010
|
+
/**
|
|
1011
|
+
* Note type column header
|
|
1012
|
+
*/
|
|
1013
|
+
readonly notetype: `${string}:`;
|
|
1014
|
+
/**
|
|
1015
|
+
* Deck name column header
|
|
1016
|
+
*/
|
|
1017
|
+
readonly deck: `${string}:`;
|
|
1018
|
+
/**
|
|
1019
|
+
* Tags column header (*must be completed with a number after `:`*)
|
|
1020
|
+
*/
|
|
1021
|
+
readonly tags: `${string}:`;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Some useful regular expressions
|
|
1026
|
+
*/
|
|
1027
|
+
export interface UsefulRegExps {
|
|
1028
|
+
/**
|
|
1029
|
+
* Matches any *hiragana* character(s)
|
|
1030
|
+
*/
|
|
1031
|
+
readonly hiragana: RegExp;
|
|
1032
|
+
/**
|
|
1033
|
+
* Matches any *katakana* character(s)
|
|
1034
|
+
*/
|
|
1035
|
+
readonly katakana: RegExp;
|
|
1036
|
+
/**
|
|
1037
|
+
* Matches any *kanji* character(s)
|
|
1038
|
+
*/
|
|
1039
|
+
readonly kanji: RegExp;
|
|
1040
|
+
/**
|
|
1041
|
+
* Matches any character that is part of the regex syntax
|
|
1042
|
+
*/
|
|
1043
|
+
readonly regExChars: RegExp;
|
|
1044
|
+
/**
|
|
1045
|
+
* Matches the `#ID=` part in a Tanaka Corpus `examples.utf` file
|
|
1046
|
+
*/
|
|
1047
|
+
readonly tanakaID: RegExp;
|
|
1048
|
+
/**
|
|
1049
|
+
* Matches and splits a part found in the `B` section of a Tanaka Corpus `examples.utf` file
|
|
1050
|
+
*/
|
|
1051
|
+
readonly tanakaPart: RegExp;
|
|
1052
|
+
/**
|
|
1053
|
+
* Matches the reference ID element of a Tanaka example part
|
|
1054
|
+
*/
|
|
1055
|
+
readonly tanakaReferenceID: RegExp;
|
|
1056
|
+
}
|