henkan 0.0.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.
Files changed (66) hide show
  1. package/CONTRIBUTING.md +25 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +82 -0
  4. package/SECURITY.md +20 -0
  5. package/dist/index.cjs.js +2257 -0
  6. package/dist/index.cjs.js.map +7 -0
  7. package/dist/index.mjs +2199 -0
  8. package/dist/index.mjs.map +7 -0
  9. package/dist/types/constants.d.ts +8 -0
  10. package/dist/types/constants.d.ts.map +1 -0
  11. package/dist/types/index.d.ts +4 -0
  12. package/dist/types/index.d.ts.map +1 -0
  13. package/dist/types/types.d.ts +680 -0
  14. package/dist/types/types.d.ts.map +1 -0
  15. package/dist/types/utils.d.ts +135 -0
  16. package/dist/types/utils.d.ts.map +1 -0
  17. package/docs/api/README.md +62 -0
  18. package/docs/api/functions/capitalizeString.md +27 -0
  19. package/docs/api/functions/convertJMdict.md +27 -0
  20. package/docs/api/functions/convertKanjiDic.md +27 -0
  21. package/docs/api/functions/convertKradFile.md +39 -0
  22. package/docs/api/functions/convertRadkFile.md +33 -0
  23. package/docs/api/functions/convertTanakaCorpus.md +33 -0
  24. package/docs/api/functions/generateAnkiNote.md +27 -0
  25. package/docs/api/functions/generateAnkiNotesFile.md +27 -0
  26. package/docs/api/functions/getKanji.md +57 -0
  27. package/docs/api/functions/getKanjiExtended.md +69 -0
  28. package/docs/api/functions/getWord.md +63 -0
  29. package/docs/api/functions/isStringArray.md +27 -0
  30. package/docs/api/functions/isValidArray.md +27 -0
  31. package/docs/api/functions/isValidArrayWithFirstElement.md +27 -0
  32. package/docs/api/functions/makeSSML.md +33 -0
  33. package/docs/api/functions/shuffleArray.md +33 -0
  34. package/docs/api/functions/synthesizeSpeech.md +39 -0
  35. package/docs/api/interfaces/DictKanji.md +43 -0
  36. package/docs/api/interfaces/DictKanjiForm.md +51 -0
  37. package/docs/api/interfaces/DictKanjiMisc.md +61 -0
  38. package/docs/api/interfaces/DictKanjiReading.md +31 -0
  39. package/docs/api/interfaces/DictKanjiReadingMeaning.md +33 -0
  40. package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +33 -0
  41. package/docs/api/interfaces/DictKanjiWithRadicals.md +33 -0
  42. package/docs/api/interfaces/DictMeaning.md +129 -0
  43. package/docs/api/interfaces/DictRadical.md +41 -0
  44. package/docs/api/interfaces/DictReading.md +61 -0
  45. package/docs/api/interfaces/DictWord.md +53 -0
  46. package/docs/api/interfaces/ExamplePart.md +75 -0
  47. package/docs/api/interfaces/Grammar.md +165 -0
  48. package/docs/api/interfaces/GrammarMeaning.md +31 -0
  49. package/docs/api/interfaces/Kana.md +125 -0
  50. package/docs/api/interfaces/Kanji.md +239 -0
  51. package/docs/api/interfaces/KanjiComponent.md +31 -0
  52. package/docs/api/interfaces/KanjiForm.md +33 -0
  53. package/docs/api/interfaces/Phrase.md +47 -0
  54. package/docs/api/interfaces/Radical.md +165 -0
  55. package/docs/api/interfaces/Reading.md +43 -0
  56. package/docs/api/interfaces/ResultEntry.md +75 -0
  57. package/docs/api/interfaces/TanakaExample.md +51 -0
  58. package/docs/api/interfaces/Translation.md +33 -0
  59. package/docs/api/interfaces/UsefulRegExps.md +93 -0
  60. package/docs/api/interfaces/Word.md +149 -0
  61. package/docs/api/type-aliases/Dict.md +13 -0
  62. package/docs/api/type-aliases/DictName.md +13 -0
  63. package/docs/api/type-aliases/EntryType.md +13 -0
  64. package/docs/api/type-aliases/JLPT.md +13 -0
  65. package/docs/api/type-aliases/Result.md +13 -0
  66. package/package.json +87 -0
@@ -0,0 +1,680 @@
1
+ /**
2
+ * JLPT levels
3
+ */
4
+ export type JLPT = "N5" | "N4" | "N3" | "N2" | "N1";
5
+ /**
6
+ * Standardized dictionary names
7
+ */
8
+ export type DictName = "JMDict" | "Kanjidic" | "tanaka" | "radk" | "krad";
9
+ /**
10
+ * Word kanji form information
11
+ *
12
+ * Equivalent to the `k_ele` JMdict element
13
+ */
14
+ export interface DictKanjiForm {
15
+ /**
16
+ * The kanji form of the word
17
+ */
18
+ readonly form: string;
19
+ /**
20
+ * Other information about the kanji form
21
+ *
22
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_kinf}
23
+ */
24
+ notes?: string[] | undefined;
25
+ /**
26
+ * Priority codes
27
+ *
28
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_freq}
29
+ */
30
+ commonness?: string[] | undefined;
31
+ }
32
+ /**
33
+ * Word reading information
34
+ *
35
+ * Equivalent to the `r_ele` JMdict element
36
+ */
37
+ export interface DictReading {
38
+ /**
39
+ * The reading of the word
40
+ */
41
+ readonly reading: string;
42
+ /**
43
+ * Other information about the reading
44
+ *
45
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_rinf}
46
+ */
47
+ notes?: string[] | undefined;
48
+ /**
49
+ * Priority codes
50
+ *
51
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_freq}
52
+ */
53
+ commonness?: string[] | undefined;
54
+ /**
55
+ * Kanji forms the reading is restricted to
56
+ */
57
+ kanjiFormRestrictions?: string[] | undefined;
58
+ }
59
+ /**
60
+ * Word meaning/sense information
61
+ *
62
+ * Equivalent to the `sense` JMdict element
63
+ */
64
+ export interface DictMeaning {
65
+ /**
66
+ * Part of speech information
67
+ *
68
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_pos}
69
+ */
70
+ partOfSpeech?: string[] | undefined;
71
+ /**
72
+ * Word glosses
73
+ */
74
+ translations?: (string | {
75
+ translation: string;
76
+ type: "lit" | "expl" | "tm";
77
+ })[] | undefined;
78
+ /**
79
+ * Cross-references to other similar/related words *(when used with this meaning)*
80
+ */
81
+ references?: string[] | undefined;
82
+ /**
83
+ * Kanji forms the meaning is restricted to
84
+ */
85
+ kanjiFormRestrictions?: string[] | undefined;
86
+ /**
87
+ * Readings the meaning is restricted to
88
+ */
89
+ readingRestrictions?: string[] | undefined;
90
+ /**
91
+ * References to antonyms of the word *(when used with this meaning)*
92
+ */
93
+ antonyms?: string[] | undefined;
94
+ /**
95
+ * Field of application of the word *(when used with this meaning)*
96
+ *
97
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_fld}
98
+ */
99
+ fields?: string[] | undefined;
100
+ /**
101
+ * Additional information about the meaning
102
+ */
103
+ info?: string[] | undefined;
104
+ /**
105
+ * Other relevant information about the meaning
106
+ *
107
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_misc}
108
+ */
109
+ misc?: string[] | undefined;
110
+ /**
111
+ * Regional dialects the meaning is restricted to
112
+ *
113
+ * @see {@link https://www.edrdg.org/jmwsgi/edhelp.py?svc=jmdict#kw_dial}
114
+ */
115
+ dialects?: string[] | undefined;
116
+ }
117
+ /**
118
+ * JMdict entry (word)
119
+ *
120
+ * Equivalent to the `entry` JMdict element
121
+ */
122
+ export interface DictWord {
123
+ /**
124
+ * The entry sequence number
125
+ */
126
+ readonly id: string;
127
+ /**
128
+ * The word's kanji forms
129
+ */
130
+ kanjiForms?: DictKanjiForm[] | undefined;
131
+ /**
132
+ * The word's readings
133
+ */
134
+ readings: DictReading[];
135
+ /**
136
+ * The word's meanings/senses
137
+ */
138
+ meanings: DictMeaning[];
139
+ }
140
+ /**
141
+ * Miscellaneous information about the kanji
142
+ *
143
+ * Equivalent to the `misc` KANJIDIC2 element *(excluding some subelements)*
144
+ */
145
+ export interface DictKanjiMisc {
146
+ /**
147
+ * The stroke count of the kanji, including the radical
148
+ */
149
+ readonly strokeNumber: string;
150
+ /**
151
+ * The kanji grade level
152
+ *
153
+ * 1-6 -> {@link [Kyōiku kanji](https://en.wikipedia.org/wiki/Ky%C5%8Diku_kanji)}
154
+ *
155
+ * 7-8 -> {@link [Jōyō kanji](https://en.wikipedia.org/wiki/J%C5%8Dy%C5%8D_kanji)} (excluding Kyōiku kanji)
156
+ *
157
+ * 9-10 -> {@link [Jinmeiyō kanji](https://en.wikipedia.org/wiki/Jinmeiy%C5%8D_kanji)}
158
+ */
159
+ grade?: string | undefined;
160
+ /**
161
+ * The frequency-of-use ranking
162
+ *
163
+ * A number from `1` to `2500`
164
+ */
165
+ frequency?: string | undefined;
166
+ /**
167
+ * The {@link [pre-2010 JLPT](https://en.wikipedia.org/wiki/Japanese-Language_Proficiency_Test#Previous_format_(1984%E2%80%932009))} level
168
+ */
169
+ jlpt?: string | undefined;
170
+ }
171
+ /**
172
+ * Kanji reading information
173
+ */
174
+ export interface DictKanjiReading {
175
+ /**
176
+ * The kanji reading (hiragana or katakana)
177
+ */
178
+ readonly reading: string;
179
+ /**
180
+ * The type of reading (onyomi or kunyomi)
181
+ */
182
+ type: "ja_on" | "ja_kun";
183
+ }
184
+ /**
185
+ * Kanji "readings-meanings" pair
186
+ *
187
+ * Equivalent to the `rmgroup` KANJIDIC2 element
188
+ */
189
+ export interface DictKanjiReadingMeaningGroup {
190
+ /**
191
+ * The kanji readings
192
+ */
193
+ readings: DictKanjiReading[];
194
+ /**
195
+ * The kanji meanings
196
+ */
197
+ meanings: string[];
198
+ }
199
+ /**
200
+ * Kanji "readings-meanings" groups and nanori readings
201
+ *
202
+ * Equivalent to the `reading_meaning` KANJIDIC2 element
203
+ */
204
+ export interface DictKanjiReadingMeaning {
205
+ /**
206
+ * The Kanji "readings-meanings" pairs
207
+ */
208
+ groups: DictKanjiReadingMeaningGroup[];
209
+ /**
210
+ * The kanji nanori readings
211
+ */
212
+ nanori?: string[] | undefined;
213
+ }
214
+ /**
215
+ * KANJIDIC2 entry (kanji)
216
+ *
217
+ * Equivalent to the `character` KANJIDIC2 element *(excluding some subelements)*
218
+ */
219
+ export interface DictKanji {
220
+ /**
221
+ * The kanji character
222
+ */
223
+ readonly kanji: string;
224
+ /**
225
+ * The miscellaneous information about the kanji
226
+ */
227
+ misc?: DictKanjiMisc | undefined;
228
+ /**
229
+ * The "readings-meanings" groups and nanori readings of the kanji
230
+ */
231
+ readingMeaning: DictKanjiReadingMeaning[];
232
+ }
233
+ /**
234
+ * RADKFILE2 entry (radical)
235
+ */
236
+ export interface DictRadical {
237
+ /**
238
+ * The radical character
239
+ */
240
+ readonly radical: string;
241
+ /**
242
+ * The kanji that include the radical
243
+ */
244
+ kanji: DictKanji[];
245
+ /**
246
+ * The stroke count of the radical
247
+ */
248
+ strokes: string;
249
+ }
250
+ /**
251
+ * KRADFILE2 entry (kanji with its radicals/components)
252
+ */
253
+ export interface DictKanjiWithRadicals {
254
+ /**
255
+ * The kanji character
256
+ */
257
+ readonly kanji: string;
258
+ /**
259
+ * The radicals/components that make up the kanji
260
+ *
261
+ * Can be {@link DictKanji} objects if the component is a kanji found in KANJIDIC and/or {@link Kana.kana} if the component is a katakana character that does not use (or have) its (or a) kanji variant.
262
+ */
263
+ radicals: (DictKanji | string)[];
264
+ }
265
+ /**
266
+ * A word/part from the `B` section of a Tanaka Corpus `examples.utf` entry
267
+ */
268
+ export interface ExamplePart {
269
+ /**
270
+ * The common form in which the word is found in JMdict
271
+ */
272
+ baseForm: string;
273
+ /**
274
+ * The reading (in kana) of the word
275
+ */
276
+ reading?: string | undefined;
277
+ /**
278
+ * The JMdict sense number corresponding to the word’s usage in the phrase
279
+ */
280
+ glossNumber?: number | undefined;
281
+ /**
282
+ * The actual form in which the word is used in the phrase
283
+ */
284
+ inflectedForm?: string | undefined;
285
+ /**
286
+ * A sequence number that references a JMdict entry associated with the word
287
+ */
288
+ referenceID?: string | undefined;
289
+ /**
290
+ * Whether or not the word is part of an entry that has been edited and adapted
291
+ *
292
+ * {@link https://www.edrdg.org/wiki/Tanaka_Corpus.html#Subset}
293
+ *
294
+ * {@link https://www.edrdg.org/wiki/Tanaka_Corpus.html#Initial_Modifications_to_the_Corpus}
295
+ */
296
+ edited?: true | undefined;
297
+ }
298
+ /**
299
+ * Tanaka Corpus `examples.utf` examples
300
+ */
301
+ export interface TanakaExample {
302
+ /**
303
+ * The Japanese phrase (found in the `A` section, **before** the tab)
304
+ */
305
+ phrase: string;
306
+ /**
307
+ * The English translation of the phrase (found in the `A` section, **after** the tab)
308
+ */
309
+ translation: string;
310
+ /**
311
+ * The `B` section, split into parts
312
+ */
313
+ parts: ExamplePart[];
314
+ /**
315
+ * The Japanese phrase, with furigana attached
316
+ */
317
+ furigana?: string | undefined;
318
+ }
319
+ /**
320
+ * Any type of entry list
321
+ */
322
+ export type Dict = DictWord[] | DictKanji[] | TanakaExample[] | DictRadical[] | DictKanjiWithRadicals[];
323
+ /**
324
+ * Names of entry types used for the Anki note IDs
325
+ */
326
+ export type EntryType = "word" | "kanji" | "radical" | "kana" | "grammar";
327
+ /**
328
+ * Basic Anki note information
329
+ */
330
+ export interface ResultEntry<EntryType extends string> {
331
+ /**
332
+ * ID used for the resulting Anki note
333
+ */
334
+ readonly noteID?: `${EntryType}_${string}` | undefined;
335
+ /**
336
+ * ID used for the Anki note ID
337
+ */
338
+ readonly id?: string | undefined;
339
+ /**
340
+ * Anki note type name
341
+ */
342
+ noteTypeName?: string | undefined;
343
+ /**
344
+ * The full path of the Anki deck
345
+ */
346
+ deckPath?: string | undefined;
347
+ /**
348
+ * Tags generated based on the entry's information
349
+ */
350
+ tags?: string[] | undefined;
351
+ }
352
+ /**
353
+ * A kanji form of the word
354
+ *
355
+ * Converted from a {@link DictKanjiForm}
356
+ */
357
+ export interface KanjiForm {
358
+ /**
359
+ * The kanji form
360
+ */
361
+ readonly kanjiForm: string;
362
+ /**
363
+ * Optional notes for the kanji form
364
+ */
365
+ notes?: string[] | undefined;
366
+ }
367
+ /**
368
+ * A reading of the word
369
+ *
370
+ * Converted from {@link DictReading}
371
+ */
372
+ export interface Reading {
373
+ /**
374
+ * The reading (in kana)
375
+ */
376
+ readonly reading: string;
377
+ /**
378
+ * Optional notes for the reading
379
+ */
380
+ notes?: string[] | undefined;
381
+ /**
382
+ * The filename of an audio file for the reading
383
+ */
384
+ audio?: string | undefined;
385
+ }
386
+ /**
387
+ * A translation of the word
388
+ *
389
+ * Converted from {@link DictMeaning}
390
+ */
391
+ export interface Translation {
392
+ /**
393
+ * The translation
394
+ */
395
+ readonly translation: string;
396
+ /**
397
+ * Information about the translation
398
+ */
399
+ notes?: string[] | undefined;
400
+ }
401
+ /**
402
+ * Kanji component information
403
+ */
404
+ export interface KanjiComponent {
405
+ /**
406
+ * The component character
407
+ */
408
+ readonly component: string;
409
+ /**
410
+ * The meaning of the component
411
+ */
412
+ meaning?: string | undefined;
413
+ }
414
+ /**
415
+ * Kanji information
416
+ *
417
+ * Converted from {@link DictKanji} and extra info added
418
+ */
419
+ export interface Kanji extends ResultEntry<"kanji"> {
420
+ /**
421
+ * @see {@link DictKanji.kanji}
422
+ */
423
+ readonly kanji: string;
424
+ /**
425
+ * @see {@link DictKanjiMisc.strokeNumber}
426
+ */
427
+ strokes?: string | undefined;
428
+ /**
429
+ * @see {@link DictKanjiReadingMeaningGroup.meanings}
430
+ */
431
+ meanings?: string[] | undefined;
432
+ /**
433
+ * The kanji onyomi readings
434
+ */
435
+ onyomi?: string[] | undefined;
436
+ /**
437
+ * The kanji kunyomi readings
438
+ */
439
+ kunyomi?: string[] | undefined;
440
+ /**
441
+ * @see {@link DictKanjiReadingMeaning.nanori}
442
+ */
443
+ nanori?: string[] | undefined;
444
+ /**
445
+ * The kanji SVG filename
446
+ */
447
+ svg?: string | undefined;
448
+ /**
449
+ * The kanji radicals/components
450
+ */
451
+ components?: KanjiComponent[] | undefined;
452
+ /**
453
+ * The kanji mnemonic
454
+ */
455
+ mnemonic?: string | undefined;
456
+ /**
457
+ * Words that use the kanji
458
+ */
459
+ words?: Word[] | undefined;
460
+ /**
461
+ * @see {@link DictKanjiMisc.grade}
462
+ */
463
+ grade?: string | undefined;
464
+ /**
465
+ * @see {@link DictKanjiMisc.frequency}
466
+ */
467
+ frequency?: string | undefined;
468
+ /**
469
+ * The source (besides KANJIDIC) from which data for this kanji has been extracted
470
+ */
471
+ source?: string | undefined;
472
+ /**
473
+ * Whether or not this kanji object contains information **only** from `jpdb.io`
474
+ */
475
+ fromJpdb?: true | undefined;
476
+ }
477
+ /**
478
+ * Kanji radical/component information
479
+ */
480
+ export interface Radical extends ResultEntry<"radical"> {
481
+ /**
482
+ * The radical/component character
483
+ */
484
+ readonly radical: string;
485
+ /**
486
+ * The radical/component reading (in kana)
487
+ */
488
+ reading: string;
489
+ /**
490
+ * The radical/component meanings
491
+ */
492
+ meanings: string[];
493
+ /**
494
+ * The stroke count of the radical/component
495
+ */
496
+ strokes?: string | undefined;
497
+ /**
498
+ * The radical/component SVG filename
499
+ */
500
+ svg?: string | undefined;
501
+ /**
502
+ * The radical/component mnemonic
503
+ */
504
+ mnemonic?: string | undefined;
505
+ /**
506
+ * Kanji that include the radical/component
507
+ */
508
+ kanji?: Kanji[] | undefined;
509
+ /**
510
+ * The sources from which data for this radical/component has been extracted
511
+ */
512
+ sources?: string[] | undefined;
513
+ }
514
+ /**
515
+ * Phrase information
516
+ *
517
+ * Converted from {@link TanakaExample}
518
+ */
519
+ export interface Phrase {
520
+ /**
521
+ * The Japanese phrase, either with furigana attached or not
522
+ */
523
+ readonly phrase: string;
524
+ /**
525
+ * @see {@link TanakaExample.translation}
526
+ */
527
+ readonly translation: string;
528
+ /**
529
+ * @see {@link TanakaExample.phrase}
530
+ */
531
+ readonly originalPhrase: string;
532
+ }
533
+ /**
534
+ * Word information
535
+ *
536
+ * Converted from {@link DictWord}
537
+ */
538
+ export interface Word extends ResultEntry<"word"> {
539
+ /**
540
+ * The word readings (in kana)
541
+ */
542
+ readings: Reading[];
543
+ /**
544
+ * The word translations/senses
545
+ */
546
+ translations?: Translation[];
547
+ /**
548
+ * The word kanji forms
549
+ */
550
+ kanjiForms?: KanjiForm[] | undefined;
551
+ /**
552
+ * A list of kanji used in the kanji forms
553
+ */
554
+ kanji?: Kanji[] | undefined;
555
+ /**
556
+ * Phrases associated to the word
557
+ */
558
+ phrases?: Phrase[] | undefined;
559
+ /**
560
+ * Whether or not the word is common
561
+ *
562
+ * A word is considered *common* if the {@link DictWord.readings} and/or the {@link DictWord.kanjiForms} array(s) include(s) at least one element with the {@link DictReading.commonness} or {@link DictKanjiForm.commonness} property defined.
563
+ */
564
+ common?: true | undefined;
565
+ }
566
+ /**
567
+ * Kana information
568
+ */
569
+ export interface Kana extends ResultEntry<"kana"> {
570
+ /**
571
+ * The kana character
572
+ */
573
+ readonly kana: string;
574
+ /**
575
+ * The romaji reading of the kana
576
+ */
577
+ reading: string;
578
+ /**
579
+ * The filename of an audio file for the kana reading
580
+ */
581
+ audio?: string | undefined;
582
+ /**
583
+ * The kana SVG filename
584
+ */
585
+ svg?: string | undefined;
586
+ }
587
+ /**
588
+ * Grammar point meaning
589
+ */
590
+ export interface GrammarMeaning {
591
+ /**
592
+ * The meaning of the grammar point
593
+ */
594
+ meaning: string;
595
+ /**
596
+ * An example phrase using the grammar point
597
+ */
598
+ example?: string | undefined;
599
+ }
600
+ /**
601
+ * Grammar point information
602
+ */
603
+ export interface Grammar extends ResultEntry<"grammar"> {
604
+ /**
605
+ * The most common form in which the grammar point written in
606
+ */
607
+ readonly point: string;
608
+ /**
609
+ * The English meaning/translation of the grammar point
610
+ */
611
+ meaning: GrammarMeaning;
612
+ /**
613
+ * The readings of the grammar point
614
+ */
615
+ readings?: Reading[] | undefined;
616
+ /**
617
+ * Ways in which the grammar point is used in Japanese
618
+ */
619
+ usages?: string[] | undefined;
620
+ /**
621
+ * Example phrase using the grammar point
622
+ */
623
+ phrases?: Phrase[] | undefined;
624
+ /**
625
+ * The {@link [post-2010 JLPT](https://en.wikipedia.org/wiki/Japanese-Language_Proficiency_Test#Test_format)} level
626
+ */
627
+ jlpt?: JLPT | undefined;
628
+ /**
629
+ * The source from which data for this grammar point has been extracted
630
+ */
631
+ source?: string | undefined;
632
+ /**
633
+ * The filename of an audio file for the grammar point
634
+ */
635
+ audio?: string | undefined;
636
+ }
637
+ /**
638
+ * Any type of converted entry from a {@link Dict} array + others not from a dictionary
639
+ */
640
+ export type Result = Word | Kanji | Radical | Kana | Grammar;
641
+ /**
642
+ * Some useful regular expressions
643
+ */
644
+ export interface UsefulRegExps {
645
+ /**
646
+ * Matches any *hiragana* character(s)
647
+ */
648
+ readonly hiragana: RegExp;
649
+ /**
650
+ * Matches any *katakana* character(s)
651
+ */
652
+ readonly katakana: RegExp;
653
+ /**
654
+ * Matches any *kanji* character(s)
655
+ */
656
+ readonly kanji: RegExp;
657
+ /**
658
+ * Matches and splits Japanese expressions into different scripts
659
+ *
660
+ * Used when creating a SSML
661
+ */
662
+ readonly scriptSplit: RegExp;
663
+ /**
664
+ * Matches any character that is part of the regex syntax
665
+ */
666
+ readonly regExChars: RegExp;
667
+ /**
668
+ * Matches the `#ID=` part in a Tanaka Corpus `examples.utf` file
669
+ */
670
+ readonly tanakaID: RegExp;
671
+ /**
672
+ * Matches and splits a part found in the `B` section of a Tanaka Corpus `examples.utf` file
673
+ */
674
+ readonly tanakaPart: RegExp;
675
+ /**
676
+ * Matches the reference ID element of a Tanaka example part
677
+ */
678
+ readonly tanakaReferenceID: RegExp;
679
+ }
680
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CA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