henkan 1.1.0 → 1.1.2

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 (68) hide show
  1. package/README.md +1 -0
  2. package/dist/index.cjs.js +512 -174
  3. package/dist/index.cjs.js.map +3 -3
  4. package/dist/index.mjs +506 -168
  5. package/dist/index.mjs.map +3 -3
  6. package/dist/types/constants.d.ts +2 -2
  7. package/dist/types/constants.d.ts.map +1 -1
  8. package/dist/types/types.d.ts +32 -0
  9. package/dist/types/types.d.ts.map +1 -1
  10. package/dist/types/utils.d.ts +4 -5
  11. package/dist/types/utils.d.ts.map +1 -1
  12. package/docs/api/README.md +2 -0
  13. package/docs/api/functions/capitalizeString.md +1 -1
  14. package/docs/api/functions/convertJMdict.md +1 -1
  15. package/docs/api/functions/convertJawiktionary.md +1 -1
  16. package/docs/api/functions/convertKanjiDic.md +1 -1
  17. package/docs/api/functions/convertKradFile.md +1 -1
  18. package/docs/api/functions/convertRadkFile.md +1 -1
  19. package/docs/api/functions/convertTanakaCorpus.md +1 -1
  20. package/docs/api/functions/generateAnkiNote.md +1 -1
  21. package/docs/api/functions/generateAnkiNotesFile.md +1 -1
  22. package/docs/api/functions/getKanji.md +1 -1
  23. package/docs/api/functions/getKanjiExtended.md +1 -1
  24. package/docs/api/functions/getWord.md +3 -3
  25. package/docs/api/functions/getWordDefinitions.md +3 -9
  26. package/docs/api/functions/isStringArray.md +1 -1
  27. package/docs/api/functions/isValidArray.md +1 -1
  28. package/docs/api/functions/isValidArrayWithFirstElement.md +1 -1
  29. package/docs/api/functions/shuffleArray.md +1 -1
  30. package/docs/api/functions/synthesizeSpeech.md +1 -1
  31. package/docs/api/interfaces/Definition.md +4 -4
  32. package/docs/api/interfaces/DictKanji.md +5 -5
  33. package/docs/api/interfaces/DictKanjiForm.md +4 -4
  34. package/docs/api/interfaces/DictKanjiMisc.md +5 -5
  35. package/docs/api/interfaces/DictKanjiReading.md +3 -3
  36. package/docs/api/interfaces/DictKanjiReadingMeaning.md +3 -3
  37. package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +3 -3
  38. package/docs/api/interfaces/DictKanjiWithRadicals.md +3 -3
  39. package/docs/api/interfaces/DictMeaning.md +11 -11
  40. package/docs/api/interfaces/DictRadical.md +4 -4
  41. package/docs/api/interfaces/DictReading.md +5 -5
  42. package/docs/api/interfaces/DictWord.md +8 -8
  43. package/docs/api/interfaces/ExamplePart.md +7 -7
  44. package/docs/api/interfaces/GlossSpecificNumber.md +3 -3
  45. package/docs/api/interfaces/Grammar.md +15 -15
  46. package/docs/api/interfaces/GrammarMeaning.md +3 -3
  47. package/docs/api/interfaces/JaWiktionaryEntry.md +63 -0
  48. package/docs/api/interfaces/Kana.md +11 -11
  49. package/docs/api/interfaces/Kanji.md +23 -23
  50. package/docs/api/interfaces/KanjiComponent.md +3 -3
  51. package/docs/api/interfaces/KanjiForm.md +4 -4
  52. package/docs/api/interfaces/NoteAndTag.md +3 -3
  53. package/docs/api/interfaces/Phrase.md +5 -5
  54. package/docs/api/interfaces/Radical.md +16 -16
  55. package/docs/api/interfaces/Reading.md +5 -5
  56. package/docs/api/interfaces/ResultEntry.md +7 -7
  57. package/docs/api/interfaces/TanakaExample.md +7 -7
  58. package/docs/api/interfaces/Translation.md +3 -3
  59. package/docs/api/interfaces/UsefulRegExps.md +8 -8
  60. package/docs/api/interfaces/Word.md +15 -15
  61. package/docs/api/interfaces/WordDefinitionPair.md +3 -3
  62. package/docs/api/type-aliases/Dict.md +1 -1
  63. package/docs/api/type-aliases/DictName.md +1 -1
  64. package/docs/api/type-aliases/DictTranslation.md +1 -1
  65. package/docs/api/type-aliases/EntryType.md +1 -1
  66. package/docs/api/type-aliases/POS.md +13 -0
  67. package/docs/api/type-aliases/Result.md +1 -1
  68. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -47,22 +47,25 @@ var noteMap = /* @__PURE__ */ new Map([
47
47
  ["tsugaru-ben", ["dialect::tsugaru-ben", "Dialect: Tsugaru-ben"]],
48
48
  ["aichi dialect", ["dialect::aichi", "Dialect: Aichi"]],
49
49
  ["tochigi dialect", ["dialect::tochigi", "Dialect: Tochigi"]],
50
- ["adjective (keiyoushi)", ["adjective::i", "\u3044-adjective"]],
51
- ["'taru' adjective", ["adjective::taru", "\u305F\u308B-adjective"]],
52
- ["noun (common) (futsuumeishi)", ["common_noun", "Common noun"]],
50
+ ["adjective (keiyoushi)", ["adjective::i", "\u3044-adjective", "\u5F62\u5BB9\u8A5E"]],
51
+ ["'taru' adjective", ["adjective::taru", "\u305F\u308B-adjective", "\u5F62\u5BB9\u52D5\u8A5E"]],
52
+ [
53
+ "noun (common) (futsuumeishi)",
54
+ ["common_noun", "Common noun", ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206"]]
55
+ ],
53
56
  [
54
57
  "pre-noun adjectival (rentaishi)",
55
- ["pre-noun_adjectival", "Pre-noun adjectival"]
58
+ ["pre-noun_adjectival", "Pre-noun adjectival", "\u9023\u4F53\u8A5E"]
56
59
  ],
57
60
  [
58
61
  "noun or verb acting prenominally",
59
62
  ["noun_or_verb_acting_prenominally", "Noun or verb acting prenominally"]
60
63
  ],
61
- ["pronoun", ["pronoun", "Pronoun"]],
62
- ["adverb (fukushi)", ["adverb", "Adverb"]],
64
+ ["pronoun", ["pronoun", "Pronoun", ["\u4EE3\u540D\u8A5E", "\u4EBA\u79F0\u4EE3\u540D\u8A5E"]]],
65
+ ["adverb (fukushi)", ["adverb", "Adverb", "\u526F\u8A5E"]],
63
66
  [
64
67
  "adverb taking the 'to' particle",
65
- ["takes::to", "Adverb taking the '\u3068' particle"]
68
+ ["takes::to", "Adverb taking the '\u3068' particle", "\u526F\u8A5E"]
66
69
  ],
67
70
  [
68
71
  "onomatopoeic or mimetic word",
@@ -70,80 +73,100 @@ var noteMap = /* @__PURE__ */ new Map([
70
73
  ],
71
74
  [
72
75
  "nouns which may take the genitive case particle 'no'",
73
- ["takes::no", "May take the '\u306E' particle"]
76
+ ["takes::no", "May take the '\u306E' particle", ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206"]]
74
77
  ],
75
78
  [
76
79
  "noun or participle which takes the aux. verb suru",
77
- ["takes::suru", "Takes the aux. verb '\u3059\u308B'"]
80
+ ["takes::suru", "Takes the aux. verb '\u3059\u308B'", "\u52D5\u8A5E"]
78
81
  ],
79
- ["suru verb - irregular", ["suru_verb", "Irregular \u3059\u308B-verb"]],
80
- ["suru verb - special class", ["suru_verb", "Special \u3059\u308B-verb"]],
81
- ["ichidan verb", ["ichidan_verb", "Ichidan verb"]],
82
+ ["suru verb - irregular", ["suru_verb", "Irregular \u3059\u308B-verb", "\u52D5\u8A5E"]],
83
+ ["suru verb - special class", ["suru_verb", "Special \u3059\u308B-verb", "\u52D5\u8A5E"]],
84
+ ["ichidan verb", ["ichidan_verb", "Ichidan verb", "\u52D5\u8A5E"]],
82
85
  [
83
86
  "godan verb with 'ku' ending",
84
- ["godan::ku::verb", "Godan verb with '\u304F' ending"]
87
+ ["godan::ku::verb", "Godan verb with '\u304F' ending", "\u52D5\u8A5E"]
85
88
  ],
86
89
  [
87
90
  "godan verb with 'gu' ending",
88
- ["godan::gu::verb", "Godan verb with '\u3050' ending"]
91
+ ["godan::gu::verb", "Godan verb with '\u3050' ending", "\u52D5\u8A5E"]
89
92
  ],
90
93
  [
91
94
  "godan verb with 'u' ending",
92
- ["godan::u::verb", "Godan verb with '\u3046' ending"]
95
+ ["godan::u::verb", "Godan verb with '\u3046' ending", "\u52D5\u8A5E"]
93
96
  ],
94
97
  [
95
98
  "godan verb with 'tsu' ending",
96
- ["godan::tsu::verb", "Godan verb with '\u3064' ending"]
99
+ ["godan::tsu::verb", "Godan verb with '\u3064' ending", "\u52D5\u8A5E"]
97
100
  ],
98
101
  [
99
102
  "godan verb with 'ru' ending",
100
- ["godan::ru::verb", "Godan verb with '\u308B' ending"]
103
+ ["godan::ru::verb", "Godan verb with '\u308B' ending", "\u52D5\u8A5E"]
101
104
  ],
102
105
  [
103
106
  "godan verb with 'nu' ending",
104
- ["godan::nu::verb", "Godan verb with '\u306C' ending"]
107
+ ["godan::nu::verb", "Godan verb with '\u306C' ending", "\u52D5\u8A5E"]
105
108
  ],
106
109
  [
107
110
  "godan verb with 'mu' ending",
108
- ["godan::mu::verb", "Godan verb with '\u3080' ending"]
111
+ ["godan::mu::verb", "Godan verb with '\u3080' ending", "\u52D5\u8A5E"]
109
112
  ],
110
113
  [
111
114
  "godan verb with 'bu' ending",
112
- ["godan::bu::verb", "Godan verb with '\u3076' ending"]
115
+ ["godan::bu::verb", "Godan verb with '\u3076' ending", "\u52D5\u8A5E"]
113
116
  ],
114
117
  [
115
118
  "godan verb with 'su' ending",
116
- ["godan::su::verb", "Godan verb with '\u3059' ending"]
119
+ ["godan::su::verb", "Godan verb with '\u3059' ending", "\u52D5\u8A5E"]
117
120
  ],
118
121
  [
119
122
  "godan verb with 'u' ending (special class)",
120
- ["godan::u::irregular_verb", "Irregular godan verb with '\u3046' ending"]
123
+ [
124
+ "godan::u::irregular_verb",
125
+ "Irregular godan verb with '\u3046' ending",
126
+ "\u52D5\u8A5E"
127
+ ]
121
128
  ],
122
129
  [
123
130
  "godan verb with 'ru' ending (irregular verb)",
124
- ["godan::ru::irregular_verb", "Irregular godan verb with '\u308B' ending"]
131
+ [
132
+ "godan::ru::irregular_verb",
133
+ "Irregular godan verb with '\u308B' ending",
134
+ "\u52D5\u8A5E"
135
+ ]
125
136
  ],
126
137
  [
127
138
  "godan verb - -aru special class",
128
- ["godan::aru::irregular_verb", "Irregular godan verb with '-\u3042\u308B' ending"]
139
+ [
140
+ "godan::aru::irregular_verb",
141
+ "Irregular godan verb with '-\u3042\u308B' ending",
142
+ "\u52D5\u8A5E"
143
+ ]
129
144
  ],
130
145
  [
131
146
  "godan verb - iku/yuku special class",
132
147
  [
133
148
  "godan::iku_yuku::irregular_verb",
134
- "Irregular godan verb with '\u3044\u304F' or '\u3086\u304F' ending"
149
+ "Irregular godan verb with '\u3044\u304F' or '\u3086\u304F' ending",
150
+ "\u52D5\u8A5E"
135
151
  ]
136
152
  ],
137
153
  [
138
154
  "irregular nu verb",
139
- ["godan::nu::irregular_verb", "Irregular godan verb with '\u306C' ending"]
140
- ],
141
- ["kuru verb - special class", ["kuru_verb", "Special '\u304F\u308B' verb"]],
142
- ["transitive verb", ["transitive_verb", "Transitive verb"]],
143
- ["intransitive verb", ["intransitive_verb", "Intransitive verb"]],
144
- ["auxiliary verb", ["auxiliary_verb", "Auxiliary verb"]],
145
- ["auxiliary adjective", ["adjective::auxiliary", "Auxiliary adjective"]],
146
- ["auxiliary", ["auxiliary", "Auxiliary"]],
155
+ [
156
+ "godan::nu::irregular_verb",
157
+ "Irregular godan verb with '\u306C' ending",
158
+ "\u52D5\u8A5E"
159
+ ]
160
+ ],
161
+ ["kuru verb - special class", ["kuru_verb", "Special '\u304F\u308B' verb", "\u52D5\u8A5E"]],
162
+ ["transitive verb", ["transitive_verb", "Transitive verb", "\u52D5\u8A5E"]],
163
+ ["intransitive verb", ["intransitive_verb", "Intransitive verb", "\u52D5\u8A5E"]],
164
+ ["auxiliary verb", ["auxiliary_verb", "Auxiliary verb", ["\u52D5\u8A5E", "\u52A9\u52D5\u8A5E"]]],
165
+ [
166
+ "auxiliary adjective",
167
+ ["adjective::auxiliary", "Auxiliary adjective", ["\u52A9\u8A5E", "\u52A9\u52D5\u8A5E"]]
168
+ ],
169
+ ["auxiliary", ["auxiliary", "Auxiliary", ["\u52A9\u8A5E", "\u52A9\u52D5\u8A5E"]]],
147
170
  ["after a verb", ["after::verb", "After a verb"]],
148
171
  [
149
172
  "after the -te form of a verb",
@@ -239,19 +262,52 @@ var noteMap = /* @__PURE__ */ new Map([
239
262
  ],
240
263
  ["before an adjective", ["before::adjective", "Before an adjective"]],
241
264
  ["after a noun", ["after::noun", "After a noun"]],
242
- ["prefix", ["prefix", "Prefix"]],
243
- ["noun, used as a prefix", ["prefix_noun", "Noun, used as a prefix"]],
244
- ["suffix", ["suffix", "Suffix"]],
245
- ["noun, used as a suffix", ["suffix_noun", "Noun, used as a suffix"]],
246
- ["counter", ["counter", "Counter"]],
247
- ["numeric", ["numeric", "Numeric"]],
248
- ["particle", ["particle", "Particle"]],
249
- ["conjunction", ["conjunction", "Conjunction"]],
250
- ["expression", ["expression", "Expression"]],
251
- ["idiomatic expression", ["idiomatic_expression", "Idiomatic expression"]],
252
- ["interjection (kandoushi)", ["interjection", "Interjection"]],
253
- ["proverb", ["proverb", "Proverb"]],
254
- ["yojijukugo", ["yojijukugo", "Yojijukugo"]],
265
+ ["prefix", ["prefix", "Prefix", ["\u63A5\u982D\u8A9E", "\u63A5\u982D\u8F9E"]]],
266
+ [
267
+ "noun, used as a prefix",
268
+ [
269
+ "prefix_noun",
270
+ "Noun, used as a prefix",
271
+ ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206", "\u63A5\u982D\u8A9E", "\u63A5\u982D\u8F9E"]
272
+ ]
273
+ ],
274
+ ["suffix", ["suffix", "Suffix", ["\u63A5\u5C3E\u8A9E", "\u63A5\u5C3E\u8F9E"]]],
275
+ [
276
+ "noun, used as a suffix",
277
+ [
278
+ "suffix_noun",
279
+ "Noun, used as a suffix",
280
+ ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206", "\u63A5\u5C3E\u8A9E", "\u63A5\u5C3E\u8F9E"]
281
+ ]
282
+ ],
283
+ ["counter", ["counter", "Counter", "\u52A9\u6570\u8A5E"]],
284
+ ["numeric", ["numeric", "Numeric", "\u6570\u8A5E"]],
285
+ ["particle", ["particle", "Particle", ["\u52A9\u8A5E", "\u63A5\u7D9A\u52A9\u8A5E"]]],
286
+ ["conjunction", ["conjunction", "Conjunction", "\u63A5\u7D9A\u8A5E"]],
287
+ [
288
+ "expression",
289
+ ["expression", "Expression", ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]]
290
+ ],
291
+ [
292
+ "idiomatic expression",
293
+ [
294
+ "idiomatic_expression",
295
+ "Idiomatic expression",
296
+ ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]
297
+ ]
298
+ ],
299
+ [
300
+ "interjection (kandoushi)",
301
+ ["interjection", "Interjection", ["\u611F\u52D5\u8A5E", "\u9593\u6295\u8A5E"]]
302
+ ],
303
+ [
304
+ "proverb",
305
+ ["proverb", "Proverb", ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5", "\u3053\u3068\u308F\u3056"]]
306
+ ],
307
+ [
308
+ "yojijukugo",
309
+ ["yojijukugo", "Yojijukugo", ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]]
310
+ ],
255
311
  ["archaism", ["archaism", "Archaism"]],
256
312
  ["obsolete term", ["obsolete", "Obsolete"]],
257
313
  ["dated term", ["dated", "Dated"]],
@@ -264,7 +320,7 @@ var noteMap = /* @__PURE__ */ new Map([
264
320
  ["derogatory", ["derogatory", "Derogatory"]],
265
321
  ["sensitive", ["sensitive", "Sensitive"]],
266
322
  ["euphemistic", ["euphemistic", "Euphemistic"]],
267
- ["abbreviation", ["abbreviation", "Abbreviation"]],
323
+ ["abbreviation", ["abbreviation", "Abbreviation", ["\u7565\u8A9E", "\u982D\u5B57\u8A9E"]]],
268
324
  ["male term or language", ["male_language", "Male language"]],
269
325
  ["female term or language", ["female_language", "Female language"]],
270
326
  [
@@ -448,7 +504,7 @@ var noteMap = /* @__PURE__ */ new Map([
448
504
  ],
449
505
  [
450
506
  "adjective (keiyoushi) - yoi/ii class",
451
- ["adjective::yoi/ii", "\u3044-adjective - \u3088\u3044/\u3044\u3044 class"]
507
+ ["adjective::yoi/ii", "\u3044-adjective - \u3088\u3044/\u3044\u3044 class", "\u5F62\u5BB9\u8A5E"]
452
508
  ],
453
509
  [
454
510
  "'kari' adjective (archaic)",
@@ -457,11 +513,15 @@ var noteMap = /* @__PURE__ */ new Map([
457
513
  ["'ku' adjective (archaic)", ["adjective::ku", "'\u304F' adjective (archaic)"]],
458
514
  [
459
515
  "adjectival nouns or quasi-adjectives (keiyodoshi)",
460
- ["na-adjective", "\u306A-adjective"]
516
+ ["na-adjective", "\u306A-adjective", "\u5F62\u5BB9\u52D5\u8A5E"]
461
517
  ],
462
518
  [
463
519
  "archaic/formal form of na-adjective",
464
- ["na-adjective_archaic_or_formal", "archaic/formal form of \u306A-adjective"]
520
+ [
521
+ "na-adjective_archaic_or_formal",
522
+ "archaic/formal form of \u306A-adjective",
523
+ "\u5F62\u5BB9\u52D5\u8A5E"
524
+ ]
465
525
  ],
466
526
  [
467
527
  "'shiku' adjective (archaic)",
@@ -470,235 +530,264 @@ var noteMap = /* @__PURE__ */ new Map([
470
530
  ["copula", ["copula", "Copula"]],
471
531
  [
472
532
  "expressions (phrases, clauses, etc.)",
473
- ["expression", "Expression (phrase, clause, etc.)"]
533
+ [
534
+ "expression",
535
+ "Expression (phrase, clause, etc.)",
536
+ ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]
537
+ ]
474
538
  ],
475
539
  ["adverbial noun (fukushitekimeishi)", ["adverbial_noun", "Adverbial noun"]],
476
540
  ["proper noun", ["proper_noun", "Proper noun"]],
477
541
  ["noun (temporal) (jisoumeishi)", ["temporal_noun", "Temporal noun"]],
478
542
  ["unclassified", ["unclassified", "Unclassified"]],
479
- ["verb unspecified", ["unspecified_verb", "Unspecified verb"]],
543
+ ["verb unspecified", ["unspecified_verb", "Unspecified verb", "\u52D5\u8A5E"]],
480
544
  [
481
545
  "ichidan verb - kureru special class",
482
- ["ichidan_verb::kureru", "Ichidan verb - \u304F\u308C\u308B special class"]
546
+ ["ichidan_verb::kureru", "Ichidan verb - \u304F\u308C\u308B special class", "\u52D5\u8A5E"]
483
547
  ],
484
548
  [
485
549
  "nidan verb with 'u' ending (archaic)",
486
- ["nidan_verb::u", "Nidan verb with '\u3046' ending (archaic)"]
550
+ ["nidan_verb::u", "Nidan verb with '\u3046' ending (archaic)", "\u52D5\u8A5E"]
487
551
  ],
488
552
  [
489
553
  "nidan verb (upper class) with 'bu' ending (archaic)",
490
554
  [
491
555
  "nidan_verb::bu::upper_class",
492
- "Nidan verb (upper class) with '\u3076' ending (archaic)"
556
+ "Nidan verb (upper class) with '\u3076' ending (archaic)",
557
+ "\u52D5\u8A5E"
493
558
  ]
494
559
  ],
495
560
  [
496
561
  "nidan verb (lower class) with 'bu' ending (archaic)",
497
562
  [
498
563
  "nidan_verb::bu::lower_class",
499
- "Nidan verb (lower class) with '\u3076' ending (archaic)"
564
+ "Nidan verb (lower class) with '\u3076' ending (archaic)",
565
+ "\u52D5\u8A5E"
500
566
  ]
501
567
  ],
502
568
  [
503
569
  "nidan verb (upper class) with 'dzu' ending (archaic)",
504
570
  [
505
571
  "nidan_verb::dzu::upper_class",
506
- "Nidan verb (upper class) with '\u3065' ending (archaic)"
572
+ "Nidan verb (upper class) with '\u3065' ending (archaic)",
573
+ "\u52D5\u8A5E"
507
574
  ]
508
575
  ],
509
576
  [
510
577
  "nidan verb (lower class) with 'dzu' ending (archaic)",
511
578
  [
512
579
  "nidan_verb::dzu::lower_class",
513
- "Nidan verb (lower class) with '\u3065' ending (archaic)"
580
+ "Nidan verb (lower class) with '\u3065' ending (archaic)",
581
+ "\u52D5\u8A5E"
514
582
  ]
515
583
  ],
516
584
  [
517
585
  "nidan verb (upper class) with 'gu' ending (archaic)",
518
586
  [
519
587
  "nidan_verb::gu::upper_class",
520
- "Nidan verb (upper class) with '\u3050' ending (archaic)"
588
+ "Nidan verb (upper class) with '\u3050' ending (archaic)",
589
+ "\u52D5\u8A5E"
521
590
  ]
522
591
  ],
523
592
  [
524
593
  "nidan verb (lower class) with 'gu' ending (archaic)",
525
594
  [
526
595
  "nidan_verb::gu::lower_class",
527
- "Nidan verb (lower class) with '\u3050' ending (archaic)"
596
+ "Nidan verb (lower class) with '\u3050' ending (archaic)",
597
+ "\u52D5\u8A5E"
528
598
  ]
529
599
  ],
530
600
  [
531
601
  "nidan verb (upper class) with 'hu/fu' ending (archaic)",
532
602
  [
533
603
  "nidan_verb::hu/fu::upper_class",
534
- "Nidan verb (upper class) with '\u3075' ending (archaic)"
604
+ "Nidan verb (upper class) with '\u3075' ending (archaic)",
605
+ "\u52D5\u8A5E"
535
606
  ]
536
607
  ],
537
608
  [
538
609
  "nidan verb (lower class) with 'hu/fu' ending (archaic)",
539
610
  [
540
611
  "nidan_verb::hu/fu::lower_class",
541
- "Nidan verb (lower class) with '\u3075' ending (archaic)"
612
+ "Nidan verb (lower class) with '\u3075' ending (archaic)",
613
+ "\u52D5\u8A5E"
542
614
  ]
543
615
  ],
544
616
  [
545
617
  "nidan verb (upper class) with 'ku' ending (archaic)",
546
618
  [
547
619
  "nidan_verb::ku::upper_class",
548
- "Nidan verb (upper class) with '\u304F' ending (archaic)"
620
+ "Nidan verb (upper class) with '\u304F' ending (archaic)",
621
+ "\u52D5\u8A5E"
549
622
  ]
550
623
  ],
551
624
  [
552
625
  "nidan verb (lower class) with 'ku' ending (archaic)",
553
626
  [
554
627
  "nidan_verb::ku::lower_class",
555
- "Nidan verb (lower class) with '\u304F' ending (archaic)"
628
+ "Nidan verb (lower class) with '\u304F' ending (archaic)",
629
+ "\u52D5\u8A5E"
556
630
  ]
557
631
  ],
558
632
  [
559
633
  "nidan verb (upper class) with 'mu' ending (archaic)",
560
634
  [
561
635
  "nidan_verb::mu::upper_class",
562
- "Nidan verb (upper class) with '\u3080' ending (archaic)"
636
+ "Nidan verb (upper class) with '\u3080' ending (archaic)",
637
+ "\u52D5\u8A5E"
563
638
  ]
564
639
  ],
565
640
  [
566
641
  "nidan verb (lower class) with 'mu' ending (archaic)",
567
642
  [
568
643
  "nidan_verb::mu::lower_class",
569
- "Nidan verb (lower class) with '\u3080' ending (archaic)"
644
+ "Nidan verb (lower class) with '\u3080' ending (archaic)",
645
+ "\u52D5\u8A5E"
570
646
  ]
571
647
  ],
572
648
  [
573
649
  "nidan verb (lower class) with 'nu' ending (archaic)",
574
650
  [
575
651
  "nidan_verb::nu::lower_class",
576
- "Nidan verb (lower class) with '\u306C' ending (archaic)"
652
+ "Nidan verb (lower class) with '\u306C' ending (archaic)",
653
+ "\u52D5\u8A5E"
577
654
  ]
578
655
  ],
579
656
  [
580
657
  "nidan verb (upper class) with 'ru' ending (archaic)",
581
658
  [
582
659
  "nidan_verb::ru::upper_class",
583
- "Nidan verb (upper class) with '\u308B' ending (archaic)"
660
+ "Nidan verb (upper class) with '\u308B' ending (archaic)",
661
+ "\u52D5\u8A5E"
584
662
  ]
585
663
  ],
586
664
  [
587
665
  "nidan verb (lower class) with 'ru' ending (archaic)",
588
666
  [
589
667
  "nidan_verb::ru::lower_class",
590
- "Nidan verb (lower class) with '\u308B' ending (archaic)"
668
+ "Nidan verb (lower class) with '\u308B' ending (archaic)",
669
+ "\u52D5\u8A5E"
591
670
  ]
592
671
  ],
593
672
  [
594
673
  "nidan verb (lower class) with 'su' ending (archaic)",
595
674
  [
596
675
  "nidan_verb::su::lower_class",
597
- "Nidan verb (lower class) with '\u3059' ending (archaic)"
676
+ "Nidan verb (lower class) with '\u3059' ending (archaic)",
677
+ "\u52D5\u8A5E"
598
678
  ]
599
679
  ],
600
680
  [
601
681
  "nidan verb (upper class) with 'tsu' ending (archaic)",
602
682
  [
603
683
  "nidan_verb::tsu::upper_class",
604
- "Nidan verb (upper class) with '\u3064' ending (archaic)"
684
+ "Nidan verb (upper class) with '\u3064' ending (archaic)",
685
+ "\u52D5\u8A5E"
605
686
  ]
606
687
  ],
607
688
  [
608
689
  "nidan verb (lower class) with 'tsu' ending (archaic)",
609
690
  [
610
691
  "nidan_verb::tsu::lower_class",
611
- "Nidan verb (lower class) with '\u3064' ending (archaic)"
692
+ "Nidan verb (lower class) with '\u3064' ending (archaic)",
693
+ "\u52D5\u8A5E"
612
694
  ]
613
695
  ],
614
696
  [
615
697
  "nidan verb (lower class) with 'u' ending and 'we' conjugation (archaic)",
616
698
  [
617
699
  "nidan_verb::u_with_we_conjugation::lower_class",
618
- "Nidan verb (lower class) with '\u3046' ending and '\u3091' conjugation (archaic)"
700
+ "Nidan verb (lower class) with '\u3046' ending and '\u3091' conjugation (archaic)",
701
+ "\u52D5\u8A5E"
619
702
  ]
620
703
  ],
621
704
  [
622
705
  "nidan verb (upper class) with 'yu' ending (archaic)",
623
706
  [
624
707
  "nidan_verb::yu::upper_class",
625
- "Nidan verb (upper class) with '\u3086' ending (archaic)"
708
+ "Nidan verb (upper class) with '\u3086' ending (archaic)",
709
+ "\u52D5\u8A5E"
626
710
  ]
627
711
  ],
628
712
  [
629
713
  "nidan verb (lower class) with 'yu' ending (archaic)",
630
714
  [
631
715
  "nidan_verb::yu::lower_class",
632
- "Nidan verb (lower class) with '\u3086' ending (archaic)"
716
+ "Nidan verb (lower class) with '\u3086' ending (archaic)",
717
+ "\u52D5\u8A5E"
633
718
  ]
634
719
  ],
635
720
  [
636
721
  "nidan verb (lower class) with 'zu' ending (archaic)",
637
722
  [
638
723
  "nidan_verb::zu::lower_class",
639
- "Nidan verb (lower class) with '\u305A' ending (archaic)"
724
+ "Nidan verb (lower class) with '\u305A' ending (archaic)",
725
+ "\u52D5\u8A5E"
640
726
  ]
641
727
  ],
642
728
  [
643
729
  "yodan verb with 'bu' ending (archaic)",
644
- ["yodan_verb::bu", "Yodan verb with '\u3076' ending (archaic)"]
730
+ ["yodan_verb::bu", "Yodan verb with '\u3076' ending (archaic)", "\u52D5\u8A5E"]
645
731
  ],
646
732
  [
647
733
  "yodan verb with 'gu' ending (archaic)",
648
- ["yodan_verb::gu", "Yodan verb with '\u3050' ending (archaic)"]
734
+ ["yodan_verb::gu", "Yodan verb with '\u3050' ending (archaic)", "\u52D5\u8A5E"]
649
735
  ],
650
736
  [
651
737
  "yodan verb with 'hu/fu' ending (archaic)",
652
- ["yodan_verb::hu/fu", "Yodan verb with '\u3075' ending (archaic)"]
738
+ ["yodan_verb::hu/fu", "Yodan verb with '\u3075' ending (archaic)", "\u52D5\u8A5E"]
653
739
  ],
654
740
  [
655
741
  "yodan verb with 'ku' ending (archaic)",
656
- ["yodan_verb::ku", "Yodan verb with '\u304F' ending (archaic)"]
742
+ ["yodan_verb::ku", "Yodan verb with '\u304F' ending (archaic)", "\u52D5\u8A5E"]
657
743
  ],
658
744
  [
659
745
  "yodan verb with 'mu' ending (archaic)",
660
- ["yodan_verb::mu", "Yodan verb with '\u3080' ending (archaic)"]
746
+ ["yodan_verb::mu", "Yodan verb with '\u3080' ending (archaic)", "\u52D5\u8A5E"]
661
747
  ],
662
748
  [
663
749
  "yodan verb with 'nu' ending (archaic)",
664
- ["yodan_verb::nu", "Yodan verb with '\u306C' ending (archaic)"]
750
+ ["yodan_verb::nu", "Yodan verb with '\u306C' ending (archaic)", "\u52D5\u8A5E"]
665
751
  ],
666
752
  [
667
753
  "yodan verb with 'ru' ending (archaic)",
668
- ["yodan_verb::ru", "Yodan verb with '\u308B' ending (archaic)"]
754
+ ["yodan_verb::ru", "Yodan verb with '\u308B' ending (archaic)", "\u52D5\u8A5E"]
669
755
  ],
670
756
  [
671
757
  "yodan verb with 'su' ending (archaic)",
672
- ["yodan_verb::su", "Yodan verb with '\u3059' ending (archaic)"]
758
+ ["yodan_verb::su", "Yodan verb with '\u3059' ending (archaic)", "\u52D5\u8A5E"]
673
759
  ],
674
760
  [
675
761
  "yodan verb with 'tsu' ending (archaic)",
676
- ["yodan_verb::tsu", "Yodan verb with '\u3064' ending (archaic)"]
762
+ ["yodan_verb::tsu", "Yodan verb with '\u3064' ending (archaic)", "\u52D5\u8A5E"]
677
763
  ],
678
764
  [
679
765
  "godan verb - uru old class verb (old form of eru)",
680
766
  [
681
767
  "godan::uru::irregular_verb",
682
- "Godan verb - '\u3046\u308B' old class verb (old form of \u3048\u308B)"
768
+ "Godan verb - '\u3046\u308B' old class verb (old form of \u3048\u308B)",
769
+ "\u52D5\u8A5E"
683
770
  ]
684
771
  ],
685
772
  [
686
773
  "irregular ru verb, plain form ends with -ri",
687
774
  [
688
775
  "irregular_ru_verb_plain_form_ending_with_ri",
689
- "irregular '\u308B' verb, plain form ends with '-\u308A'"
776
+ "irregular '\u308B' verb, plain form ends with '-\u308A'",
777
+ "\u52D5\u8A5E"
690
778
  ]
691
779
  ],
692
780
  [
693
781
  "su verb - precursor to the modern suru",
694
- ["su_verb", "'\u3059' verb - precursor to the modern \u3059\u308B"]
782
+ ["su_verb", "'\u3059' verb - precursor to the modern \u3059\u308B", "\u52D5\u8A5E"]
695
783
  ],
696
- ["suru verb - included", ["suru_verb", "'\u3059\u308B' verb - included"]],
784
+ ["suru verb - included", ["suru_verb", "'\u3059\u308B' verb - included", "\u52D5\u8A5E"]],
697
785
  [
698
786
  "ichidan verb - zuru verb (alternative form of -jiru verbs)",
699
787
  [
700
788
  "ichidan_verb::zuru",
701
- "Ichidan verb - '\u305A\u308B' verb (alternative form of '-\u3058\u308B' verbs)"
789
+ "Ichidan verb - '\u305A\u308B' verb (alternative form of '-\u3058\u308B' verbs)",
790
+ "\u52D5\u8A5E"
702
791
  ]
703
792
  ],
704
793
  ["agriculture", ["agriculture", "Agriculture term"]],
@@ -1542,11 +1631,42 @@ async function convertJawiktionary(stream) {
1542
1631
  }
1543
1632
  );
1544
1633
  }
1634
+ function mapEntry(entry) {
1635
+ if (entry.word === void 0 || typeof entry.word !== "string")
1636
+ throw new Error("Invalid ja.wiktionary entry");
1637
+ return {
1638
+ word: entry.word,
1639
+ ...entry.pos_title && typeof entry.pos_title === "string" ? { pos_title: entry.pos_title } : {},
1640
+ ...isValidArray(entry.senses) ? {
1641
+ senses: entry.senses.filter(
1642
+ (sense) => isValidArray(sense.form_of) && sense.form_of.every(
1643
+ (form) => form.word && typeof form.word === "string"
1644
+ ) || isStringArray(sense.glosses)
1645
+ ).map((sense) => ({
1646
+ ...sense.form_of ? {
1647
+ form_of: sense.form_of.map((form) => ({
1648
+ word: form.word
1649
+ }))
1650
+ } : {},
1651
+ ...sense.glosses ? { glosses: sense.glosses } : {}
1652
+ }))
1653
+ } : {},
1654
+ ...isValidArray(entry.forms) && entry.forms.every((form) => typeof form.form === "string") ? { forms: entry.forms.map((form) => ({ form: form.form })) } : {}
1655
+ };
1656
+ }
1545
1657
  function parseEntry(entry, definitions, definitionMap) {
1546
1658
  if (isValidArray(entry.senses)) {
1547
1659
  for (const sense of entry.senses)
1548
1660
  if (isStringArray(sense.glosses)) {
1549
- const definition = sense.glosses.join("<br>");
1661
+ let definition = "";
1662
+ for (let i = 0; i < sense.glosses.length; i += 2) {
1663
+ if (i !== 0) {
1664
+ let prev = sense.glosses[i - 1];
1665
+ let cur = sense.glosses[i];
1666
+ if (prev && cur)
1667
+ definition += `${prev}${!prev.endsWith("\u3002") ? "\u3002" : ""}${cur}`;
1668
+ } else definition += sense.glosses[i];
1669
+ }
1550
1670
  if (!definitions.some((def) => def.definition === definition)) {
1551
1671
  if (!definitionMap.has(definition))
1552
1672
  definitionMap.set(definition, { count: 1 });
@@ -1556,9 +1676,16 @@ function parseEntry(entry, definitions, definitionMap) {
1556
1676
  }
1557
1677
  }
1558
1678
  }
1559
- async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1679
+ async function getWordDefinitions(entryList, jmDict, generateFurigana) {
1560
1680
  return await new Promise(async (resolve, reject) => {
1681
+ var _a, _b, _c, _d, _e;
1561
1682
  try {
1683
+ const entries = /* @__PURE__ */ new Map();
1684
+ for (const entry of entryList) {
1685
+ const ent = entries.get(entry.word);
1686
+ if (ent) ent.push(mapEntry(entry));
1687
+ else entries.set(entry.word, [mapEntry(entry)]);
1688
+ }
1562
1689
  const japaneseDefinitions = [];
1563
1690
  const definitionMap = /* @__PURE__ */ new Map();
1564
1691
  const validWords = [];
@@ -1578,18 +1705,16 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1578
1705
  if (!valid) valid = true;
1579
1706
  }
1580
1707
  }
1581
- if (valid)
1582
- validWords.push(
1583
- getWord(void 0, void 0, kanjiDic, void 0, void 0, word)
1584
- );
1708
+ if (valid) validWords.push(word);
1585
1709
  }
1586
- const validTitleEntries = [];
1587
- const entriesWithFormTitlesGlobal = [];
1588
- const entriesWithFormsGlobal = [];
1710
+ const validTitleEntries = /* @__PURE__ */ new Map();
1711
+ const entriesWithFormTitlesGlobal = /* @__PURE__ */ new Map();
1712
+ const entriesWithFormsGlobal = /* @__PURE__ */ new Map();
1589
1713
  const validFormOfEntries = /* @__PURE__ */ new Set();
1590
1714
  const validGlossesEntries = /* @__PURE__ */ new Set();
1591
1715
  const validFormsEntries = /* @__PURE__ */ new Set();
1592
- for (const entry of entries) {
1716
+ const ents = Array.from(entries.values()).flat();
1717
+ for (const entry of ents) {
1593
1718
  let valid = false;
1594
1719
  if (validKanjiForms && validKanjiForms.has(entry.word)) {
1595
1720
  valid = true;
@@ -1599,19 +1724,20 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1599
1724
  (form) => form.word && typeof form.word === "string" && validReadings.has(form.word)
1600
1725
  ))
1601
1726
  validFormOfEntries.add(entry.word);
1602
- else if (isValidArray(sense.glosses) && sense.glosses.length === 1) {
1603
- const gloss = sense.glosses[0];
1604
- let reading = void 0;
1605
- if (gloss !== void 0) {
1606
- if (gloss.trim().includes("\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u53C2\u7167\u3002")) {
1607
- for (const r of validReadings)
1608
- if (gloss.trim().includes(r)) {
1609
- reading = r;
1610
- break;
1611
- }
1727
+ else if (isStringArray(sense.glosses)) {
1728
+ for (const gloss of sense.glosses) {
1729
+ let reading = void 0;
1730
+ if (gloss !== void 0) {
1731
+ if (gloss.trim().includes("\u306E\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u3092\u53C2\u7167\u3002")) {
1732
+ for (const r of validReadings)
1733
+ if (gloss.trim().includes(r)) {
1734
+ reading = r;
1735
+ break;
1736
+ }
1737
+ }
1612
1738
  }
1739
+ if (reading) validGlossesEntries.add(entry.word);
1613
1740
  }
1614
- if (reading) validGlossesEntries.add(entry.word);
1615
1741
  }
1616
1742
  }
1617
1743
  if (isValidArray(entry.forms)) {
@@ -1619,57 +1745,260 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1619
1745
  if (form.form && typeof form.form === "string" && validReadings.has(form.form))
1620
1746
  validFormsEntries.add(entry.word);
1621
1747
  }
1622
- } else if (validReadings.has(entry.word) && isValidArray(entry.forms) && entry.forms.some((form) => validKanjiForms.has(form.form))) {
1623
- valid = true;
1624
- entriesWithFormTitlesGlobal.push(entry);
1625
1748
  } else if (validReadings.has(entry.word)) {
1626
1749
  valid = true;
1627
- entriesWithFormTitlesGlobal.push(entry);
1750
+ const ftEntry = entriesWithFormTitlesGlobal.get(entry.word);
1751
+ if (ftEntry) ftEntry.push(entry);
1752
+ else entriesWithFormTitlesGlobal.set(entry.word, [entry]);
1753
+ }
1754
+ if (valid) {
1755
+ const tEntry = validTitleEntries.get(entry.word);
1756
+ if (tEntry) tEntry.push(entry);
1757
+ else validTitleEntries.set(entry.word, [entry]);
1628
1758
  }
1629
- if (valid) validTitleEntries.push(entry);
1630
1759
  if (isValidArray(entry.forms) && (validKanjiForms.has(entry.word) || validReadings.has(entry.word)) && entry.forms.some(
1631
1760
  (form) => validKanjiForms.has(form.form) || validReadings.has(form.form)
1632
- ))
1633
- entriesWithFormsGlobal.push(entry);
1761
+ )) {
1762
+ const wfEntry = entriesWithFormsGlobal.get(entry.word);
1763
+ if (wfEntry) wfEntry.push(entry);
1764
+ else entriesWithFormsGlobal.set(entry.word, [entry]);
1765
+ }
1634
1766
  }
1767
+ ents.length = 0;
1768
+ const posMap = /* @__PURE__ */ new Map();
1769
+ const vte = Array.from(
1770
+ validTitleEntries.values()
1771
+ ).flat();
1772
+ const fge = Array.from(
1773
+ entriesWithFormTitlesGlobal.values()
1774
+ ).flat();
1775
+ const wfe = Array.from(
1776
+ entriesWithFormsGlobal.values()
1777
+ ).flat();
1778
+ for (const pos of [
1779
+ "\u540D\u8A5E",
1780
+ "\u52D5\u8A5E",
1781
+ "\u6210\u53E5",
1782
+ "\u526F\u8A5E",
1783
+ "\u5F62\u5BB9\u52D5\u8A5E",
1784
+ "\u52A9\u8A5E",
1785
+ "\u611F\u52D5\u8A5E",
1786
+ "\u4EE3\u540D\u8A5E",
1787
+ "\u63A5\u5C3E\u8F9E",
1788
+ "\u63A5\u982D\u8A9E",
1789
+ "\u9020\u8A9E\u6210\u5206",
1790
+ "\u7565\u8A9E",
1791
+ "\u56FA\u6709\u540D\u8A5E",
1792
+ "\u4EBA\u79F0\u4EE3\u540D\u8A5E",
1793
+ "\u63A5\u982D\u8F9E",
1794
+ "\u63A5\u7D9A\u52A9\u8A5E",
1795
+ "\u9593\u6295\u8A5E",
1796
+ "\u52A9\u52D5\u8A5E",
1797
+ "\u5F62\u5BB9\u8A5E",
1798
+ "\u7E2E\u7D04\u5F62",
1799
+ "\u63A5\u8F9E",
1800
+ "\u63A5\u7D9A\u8A5E",
1801
+ "\u9023\u4F53\u8A5E",
1802
+ "\u4EBA\u540D",
1803
+ "\u8A18\u53F7",
1804
+ "\u6570\u8A5E",
1805
+ "\u6163\u7528\u53E5",
1806
+ "\u3053\u3068\u308F\u3056",
1807
+ "\u52A9\u6570\u8A5E",
1808
+ "\u82F1\u6570\u5B57\u6DF7\u5408\u8868\u8A18",
1809
+ "\u52D5\u8A5E\u53E5",
1810
+ "\u6210\u8A9E",
1811
+ "\u610F\u7FA9",
1812
+ "\u982D\u5B57\u8A9E",
1813
+ "\u63A5\u5C3E\u8A9E"
1814
+ ]) {
1815
+ for (const te of vte)
1816
+ if (te.pos_title === pos || te.pos_title === "\u548C\u8A9E\u306E\u6F22\u5B57\u8868\u8A18") {
1817
+ if (!posMap.has(pos)) posMap.set(pos, {});
1818
+ const posEntries = posMap.get(pos);
1819
+ if (posEntries.title === void 0)
1820
+ posEntries.title = /* @__PURE__ */ new Map();
1821
+ const entryList2 = posEntries.title.get(te.word);
1822
+ if (entryList2) entryList2.push(te);
1823
+ else posEntries.title.set(te.word, [te]);
1824
+ }
1825
+ for (const ft of fge)
1826
+ if (ft.pos_title === pos) {
1827
+ if (!posMap.has(pos)) posMap.set(pos, {});
1828
+ const posEntries = posMap.get(pos);
1829
+ if (posEntries.formTitle === void 0)
1830
+ posEntries.formTitle = /* @__PURE__ */ new Map();
1831
+ const entryList2 = posEntries.formTitle.get(ft.word);
1832
+ if (entryList2) entryList2.push(ft);
1833
+ else posEntries.formTitle.set(ft.word, [ft]);
1834
+ }
1835
+ for (const wf of wfe)
1836
+ if (wf.pos_title === pos) {
1837
+ if (!posMap.has(pos)) posMap.set(pos, {});
1838
+ const posEntries = posMap.get(pos);
1839
+ if (posEntries.form === void 0)
1840
+ posEntries.form = /* @__PURE__ */ new Map();
1841
+ const entryList2 = posEntries.form.get(wf.word);
1842
+ if (entryList2) entryList2.push(wf);
1843
+ else posEntries.form.set(wf.word, [wf]);
1844
+ }
1845
+ }
1846
+ vte.length = 0;
1847
+ fge.length = 0;
1848
+ wfe.length = 0;
1849
+ const wordEntriesPairs = [];
1635
1850
  for (const word of validWords) {
1636
- const definitions = [];
1637
- const kanjiFormEntries = [];
1638
- const readingWithFormsEntries = [];
1639
- const readingEntries = [];
1640
- const titleFormMap = /* @__PURE__ */ new Map();
1641
- const readingForms = /* @__PURE__ */ new Set();
1851
+ const poses = /* @__PURE__ */ new Set();
1852
+ for (const m of word.meanings) {
1853
+ if (m.partOfSpeech)
1854
+ for (const note of m.partOfSpeech) {
1855
+ const noteEntry = noteMap.get(note);
1856
+ if (noteEntry && noteEntry.length === 3) {
1857
+ const notePos = noteEntry[2];
1858
+ if (Array.isArray(notePos))
1859
+ for (const pos of notePos) {
1860
+ if (!poses.has(pos)) poses.add(pos);
1861
+ }
1862
+ else if (typeof notePos === "string" && !poses.has(notePos))
1863
+ poses.add(notePos);
1864
+ }
1865
+ }
1866
+ }
1642
1867
  const validWordReadings = new Set(
1643
1868
  word.readings.filter(
1644
- (r) => r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note)) || r.common === true
1869
+ (r) => r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note)) || r.commonness !== void 0
1645
1870
  ).map((r) => r.reading)
1646
1871
  );
1647
1872
  const validWordKanjiForms = word.kanjiForms ? new Set(
1648
1873
  word.kanjiForms.filter(
1649
1874
  (kf) => kf.notes === void 0 || !kf.notes.some(
1650
1875
  (note) => notSearchedForms.has(note)
1651
- ) || kf.common === true
1652
- ).map((kf) => kf.kanjiForm)
1876
+ ) || kf.commonness !== void 0
1877
+ ).map((kf) => kf.form)
1653
1878
  ) : void 0;
1654
- const entriesWithFormTitles = entriesWithFormTitlesGlobal.filter(
1655
- (entry) => validWordReadings.has(entry.word)
1656
- );
1657
- const entriesWithForms = entriesWithFormsGlobal.filter(
1658
- (entry) => isValidArray(entry.forms) && (validWordKanjiForms && validWordKanjiForms.has(entry.word) || validWordReadings.has(entry.word)) && entry.forms.some(
1659
- (form) => validWordKanjiForms && validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1660
- )
1661
- );
1662
- for (const ent of validTitleEntries) {
1879
+ const entriesWithTitles = [];
1880
+ const entriesWithFormTitles = [];
1881
+ const entriesWithForms = [];
1882
+ if (poses.size > 0)
1883
+ for (const pos of poses) {
1884
+ const posEntries = posMap.get(pos);
1885
+ if (posEntries) {
1886
+ if (validWordKanjiForms && (posEntries.title || posEntries.form))
1887
+ for (const kf of validWordKanjiForms) {
1888
+ const te = (_a = posEntries.title) == null ? void 0 : _a.get(kf);
1889
+ const fe = (_b = posEntries.form) == null ? void 0 : _b.get(kf);
1890
+ if (te)
1891
+ entriesWithTitles.push(
1892
+ ...te.filter(
1893
+ (ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
1894
+ )
1895
+ );
1896
+ if (fe)
1897
+ entriesWithForms.push(
1898
+ ...fe.filter(
1899
+ (ent) => ent.forms && ent.forms.some(
1900
+ (form) => validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1901
+ )
1902
+ )
1903
+ );
1904
+ }
1905
+ if (posEntries.title || posEntries.formTitle || posEntries.form)
1906
+ for (const r of validWordReadings) {
1907
+ const te = (_c = posEntries.title) == null ? void 0 : _c.get(r);
1908
+ const fe = (_d = posEntries.form) == null ? void 0 : _d.get(r);
1909
+ const fte = (_e = posEntries.formTitle) == null ? void 0 : _e.get(r);
1910
+ if (te)
1911
+ entriesWithTitles.push(
1912
+ ...te.filter(
1913
+ (ent) => ent.forms && validWordKanjiForms && ent.forms.some(
1914
+ (form) => validWordKanjiForms.has(form.form)
1915
+ ) || validWordKanjiForms === void 0
1916
+ )
1917
+ );
1918
+ if (fe)
1919
+ entriesWithForms.push(
1920
+ ...fe.filter(
1921
+ (ent) => ent.forms && ent.forms.some(
1922
+ (form) => validWordKanjiForms && validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1923
+ )
1924
+ )
1925
+ );
1926
+ if (fte) entriesWithFormTitles.push(...fte);
1927
+ }
1928
+ }
1929
+ }
1930
+ if (entriesWithTitles.length === 0 && entriesWithFormTitles.length === 0 && entriesWithForms.length === 0) {
1931
+ if (validWordKanjiForms)
1932
+ for (const kf of validWordKanjiForms) {
1933
+ const te = validTitleEntries.get(kf);
1934
+ const fe = entriesWithFormsGlobal.get(kf);
1935
+ if (te)
1936
+ entriesWithTitles.push(
1937
+ ...te.filter(
1938
+ (ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
1939
+ )
1940
+ );
1941
+ if (fe)
1942
+ entriesWithForms.push(
1943
+ ...fe.filter(
1944
+ (ent) => ent.forms && ent.forms.some(
1945
+ (form) => validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1946
+ )
1947
+ )
1948
+ );
1949
+ }
1950
+ for (const r of validWordReadings) {
1951
+ const te = validTitleEntries.get(r);
1952
+ const fe = entriesWithFormsGlobal.get(r);
1953
+ const fte = entriesWithFormTitlesGlobal.get(r);
1954
+ if (te)
1955
+ entriesWithTitles.push(
1956
+ ...te.filter(
1957
+ (ent) => ent.forms && validWordKanjiForms && ent.forms.some(
1958
+ (form) => validWordKanjiForms.has(form.form)
1959
+ ) || validWordKanjiForms === void 0
1960
+ )
1961
+ );
1962
+ if (fe)
1963
+ entriesWithForms.push(
1964
+ ...fe.filter(
1965
+ (ent) => ent.forms && ent.forms.some(
1966
+ (form) => validWordKanjiForms && validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1967
+ )
1968
+ )
1969
+ );
1970
+ if (fte) entriesWithFormTitles.push(...fte);
1971
+ }
1972
+ }
1973
+ if (entriesWithTitles.length > 0 && (entriesWithFormTitles.length > 0 || entriesWithForms.length > 0))
1974
+ wordEntriesPairs.push({
1975
+ word,
1976
+ readings: validWordReadings,
1977
+ ...validWordKanjiForms ? { kanjiForms: validWordKanjiForms } : {},
1978
+ entriesWithTitles,
1979
+ entriesWithFormTitles,
1980
+ entriesWithForms
1981
+ });
1982
+ }
1983
+ for (const pair of wordEntriesPairs) {
1984
+ const definitions = [];
1985
+ const kanjiFormEntries = [];
1986
+ const readingWithFormsEntries = [];
1987
+ const readingEntries = [];
1988
+ const titleFormMap = /* @__PURE__ */ new Map();
1989
+ const refsMap = /* @__PURE__ */ new Map();
1990
+ const readingForms = /* @__PURE__ */ new Set();
1991
+ for (const ent of pair.entriesWithTitles) {
1663
1992
  const validFormOf = validFormOfEntries.has(ent.word);
1664
1993
  const validGlosses = validGlossesEntries.has(ent.word);
1665
1994
  const validForms = validFormsEntries.has(ent.word);
1666
- if (word.kanjiForms && validWordKanjiForms && validWordKanjiForms.has(ent.word) && (validFormOf || validGlosses || validForms)) {
1995
+ if (pair.kanjiForms && pair.kanjiForms.has(ent.word) && (validFormOf || validGlosses || validForms)) {
1667
1996
  kanjiFormEntries.push(ent);
1668
1997
  if ((validFormOf || validGlosses) && isValidArray(ent.senses))
1669
1998
  for (const sense of ent.senses) {
1670
1999
  if (validFormOf && isValidArray(sense.form_of)) {
1671
2000
  for (const form of sense.form_of)
1672
- if (form.word && typeof form.word === "string" && validWordReadings.has(form.word)) {
2001
+ if (form.word && typeof form.word === "string" && pair.readings.has(form.word)) {
1673
2002
  const elem = titleFormMap.get(
1674
2003
  form.word
1675
2004
  );
@@ -1680,43 +2009,53 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1680
2009
  );
1681
2010
  else elem.add(ent.word);
1682
2011
  }
1683
- } else if (validGlosses && isStringArray(sense.glosses) && sense.glosses.length === 1) {
1684
- const gloss = sense.glosses[0];
1685
- let reading = void 0;
1686
- if (gloss !== void 0) {
1687
- if (gloss.trim().includes("\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u53C2\u7167\u3002")) {
1688
- for (const r of validWordReadings)
1689
- if (gloss.trim().includes(r)) {
1690
- reading = r;
1691
- break;
1692
- }
2012
+ } else if (validGlosses && isStringArray(sense.glosses)) {
2013
+ for (const gloss of sense.glosses) {
2014
+ let reading = void 0;
2015
+ if (gloss !== void 0) {
2016
+ if (gloss.trim().includes("\u306E\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u3092\u53C2\u7167\u3002")) {
2017
+ for (const r of pair.readings)
2018
+ if (gloss.trim().includes(r)) {
2019
+ reading = r;
2020
+ break;
2021
+ }
2022
+ }
2023
+ }
2024
+ if (reading) {
2025
+ const elem = refsMap.get(reading);
2026
+ if (!elem)
2027
+ refsMap.set(reading, /* @__PURE__ */ new Set([ent.word]));
2028
+ else elem.add(ent.word);
1693
2029
  }
1694
- }
1695
- if (reading) {
1696
- const elem = titleFormMap.get(reading);
1697
- if (!elem)
1698
- titleFormMap.set(reading, /* @__PURE__ */ new Set([ent.word]));
1699
- else elem.add(ent.word);
1700
2030
  }
1701
2031
  }
1702
2032
  }
1703
2033
  if (validForms && isValidArray(ent.forms)) {
1704
2034
  for (const form of ent.forms)
1705
- if (form.form && typeof form.form === "string" && validWordReadings.has(form.form))
2035
+ if (form.form && typeof form.form === "string" && pair.readings.has(form.form))
1706
2036
  readingForms.add(form.form);
1707
2037
  }
1708
- } else if (validWordReadings.has(ent.word) && isValidArray(ent.forms) && word.kanjiForms && validWordKanjiForms && ent.forms.some((form) => validWordKanjiForms.has(form.form)))
2038
+ } else if (pair.readings.has(ent.word) && isValidArray(ent.forms) && pair.kanjiForms && ent.forms.some((form) => pair.kanjiForms.has(form.form)))
1709
2039
  readingWithFormsEntries.push(ent);
1710
- else if (word.kanjiForms === void 0 && validWordReadings.has(ent.word))
2040
+ else if (pair.kanjiForms === void 0 && pair.readings.has(ent.word))
1711
2041
  readingEntries.push(ent);
1712
2042
  }
1713
- for (const entry of entriesWithForms) {
2043
+ for (const entry of pair.entriesWithForms) {
1714
2044
  const elem = titleFormMap.get(entry.word);
1715
2045
  if (elem && entry.forms.some((form) => elem.has(form.form)))
1716
2046
  readingWithFormsEntries.push(entry);
1717
2047
  }
1718
- for (const entry of entriesWithFormTitles)
1719
- if (readingForms.has(entry.word)) readingWithFormsEntries.push(entry);
2048
+ for (const entry of pair.entriesWithFormTitles) {
2049
+ if (readingForms.has(entry.word)) {
2050
+ readingWithFormsEntries.push(entry);
2051
+ continue;
2052
+ }
2053
+ if (pair.kanjiForms) {
2054
+ const ft = refsMap.get(entry.word);
2055
+ if (ft && ft.intersection(pair.kanjiForms).size > 0)
2056
+ readingWithFormsEntries.push(entry);
2057
+ }
2058
+ }
1720
2059
  let parsedReadingWithFormsEntries = false;
1721
2060
  for (const entry of kanjiFormEntries)
1722
2061
  if (entry.pos_title === "\u548C\u8A9E\u306E\u6F22\u5B57\u8868\u8A18" && readingWithFormsEntries.length > 0) {
@@ -1735,7 +2074,7 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1735
2074
  parseEntry(readingEntry, definitions, definitionMap);
1736
2075
  if (definitions.length > 0)
1737
2076
  japaneseDefinitions.push({
1738
- wordID: word.id,
2077
+ wordID: pair.word.id,
1739
2078
  definitions
1740
2079
  });
1741
2080
  }
@@ -1768,9 +2107,7 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1768
2107
  });
1769
2108
  }
1770
2109
  function lookupWordNote(key, notes, tags, required, fallback) {
1771
- const info = noteMap.get(
1772
- key.toLowerCase()
1773
- );
2110
+ const info = noteMap.get(key.toLowerCase());
1774
2111
  if (!info) {
1775
2112
  if (required) throw new Error(`Invalid note info for ${key}`);
1776
2113
  if (notes) notes.push(fallback ?? key);
@@ -1786,6 +2123,7 @@ var wordAddNoteArray = (arr, cb) => {
1786
2123
  for (const v of arr) cb(v);
1787
2124
  };
1788
2125
  function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeName, deckPath) {
2126
+ var _a;
1789
2127
  try {
1790
2128
  if (!dictWord && id && dict)
1791
2129
  dictWord = dict.find((entry) => entry.id === id);
@@ -2041,10 +2379,10 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2041
2379
  }
2042
2380
  }
2043
2381
  if (definitions) {
2044
- const pair = definitions.find(
2382
+ const defs = Array.isArray(definitions) ? (_a = definitions.find(
2045
2383
  (wdp) => wdp.wordID === word.id
2046
- );
2047
- if (pair) word.definitions = pair.definitions;
2384
+ )) == null ? void 0 : _a.definitions : definitions.get(word.id);
2385
+ if (defs) word.definitions = defs;
2048
2386
  }
2049
2387
  return word;
2050
2388
  } else throw new Error(`Word${id ? ` ${id}` : ""} not found`);
@@ -2361,7 +2699,7 @@ function generateAnkiNote(entry) {
2361
2699
  ).join("") : '<span class="word word-phrase">(no phrases) (Search on dictionaries!)</span>',
2362
2700
  entry.definitions ? entry.definitions.map(
2363
2701
  (definitionEntry) => createEntry(
2364
- `<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}>"<span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${definitionEntry.furigana ?? definitionEntry.definition}</span></span>`
2702
+ `<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${definitionEntry.furigana ?? definitionEntry.definition}</span></span>`
2365
2703
  )
2366
2704
  ).join("") : '<span class="word word-definition">(no definitions)</span>',
2367
2705
  entry.kanji ? entry.kanji.map(