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.cjs.js CHANGED
@@ -101,22 +101,25 @@ var noteMap = /* @__PURE__ */ new Map([
101
101
  ["tsugaru-ben", ["dialect::tsugaru-ben", "Dialect: Tsugaru-ben"]],
102
102
  ["aichi dialect", ["dialect::aichi", "Dialect: Aichi"]],
103
103
  ["tochigi dialect", ["dialect::tochigi", "Dialect: Tochigi"]],
104
- ["adjective (keiyoushi)", ["adjective::i", "\u3044-adjective"]],
105
- ["'taru' adjective", ["adjective::taru", "\u305F\u308B-adjective"]],
106
- ["noun (common) (futsuumeishi)", ["common_noun", "Common noun"]],
104
+ ["adjective (keiyoushi)", ["adjective::i", "\u3044-adjective", "\u5F62\u5BB9\u8A5E"]],
105
+ ["'taru' adjective", ["adjective::taru", "\u305F\u308B-adjective", "\u5F62\u5BB9\u52D5\u8A5E"]],
106
+ [
107
+ "noun (common) (futsuumeishi)",
108
+ ["common_noun", "Common noun", ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206"]]
109
+ ],
107
110
  [
108
111
  "pre-noun adjectival (rentaishi)",
109
- ["pre-noun_adjectival", "Pre-noun adjectival"]
112
+ ["pre-noun_adjectival", "Pre-noun adjectival", "\u9023\u4F53\u8A5E"]
110
113
  ],
111
114
  [
112
115
  "noun or verb acting prenominally",
113
116
  ["noun_or_verb_acting_prenominally", "Noun or verb acting prenominally"]
114
117
  ],
115
- ["pronoun", ["pronoun", "Pronoun"]],
116
- ["adverb (fukushi)", ["adverb", "Adverb"]],
118
+ ["pronoun", ["pronoun", "Pronoun", ["\u4EE3\u540D\u8A5E", "\u4EBA\u79F0\u4EE3\u540D\u8A5E"]]],
119
+ ["adverb (fukushi)", ["adverb", "Adverb", "\u526F\u8A5E"]],
117
120
  [
118
121
  "adverb taking the 'to' particle",
119
- ["takes::to", "Adverb taking the '\u3068' particle"]
122
+ ["takes::to", "Adverb taking the '\u3068' particle", "\u526F\u8A5E"]
120
123
  ],
121
124
  [
122
125
  "onomatopoeic or mimetic word",
@@ -124,80 +127,100 @@ var noteMap = /* @__PURE__ */ new Map([
124
127
  ],
125
128
  [
126
129
  "nouns which may take the genitive case particle 'no'",
127
- ["takes::no", "May take the '\u306E' particle"]
130
+ ["takes::no", "May take the '\u306E' particle", ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206"]]
128
131
  ],
129
132
  [
130
133
  "noun or participle which takes the aux. verb suru",
131
- ["takes::suru", "Takes the aux. verb '\u3059\u308B'"]
134
+ ["takes::suru", "Takes the aux. verb '\u3059\u308B'", "\u52D5\u8A5E"]
132
135
  ],
133
- ["suru verb - irregular", ["suru_verb", "Irregular \u3059\u308B-verb"]],
134
- ["suru verb - special class", ["suru_verb", "Special \u3059\u308B-verb"]],
135
- ["ichidan verb", ["ichidan_verb", "Ichidan verb"]],
136
+ ["suru verb - irregular", ["suru_verb", "Irregular \u3059\u308B-verb", "\u52D5\u8A5E"]],
137
+ ["suru verb - special class", ["suru_verb", "Special \u3059\u308B-verb", "\u52D5\u8A5E"]],
138
+ ["ichidan verb", ["ichidan_verb", "Ichidan verb", "\u52D5\u8A5E"]],
136
139
  [
137
140
  "godan verb with 'ku' ending",
138
- ["godan::ku::verb", "Godan verb with '\u304F' ending"]
141
+ ["godan::ku::verb", "Godan verb with '\u304F' ending", "\u52D5\u8A5E"]
139
142
  ],
140
143
  [
141
144
  "godan verb with 'gu' ending",
142
- ["godan::gu::verb", "Godan verb with '\u3050' ending"]
145
+ ["godan::gu::verb", "Godan verb with '\u3050' ending", "\u52D5\u8A5E"]
143
146
  ],
144
147
  [
145
148
  "godan verb with 'u' ending",
146
- ["godan::u::verb", "Godan verb with '\u3046' ending"]
149
+ ["godan::u::verb", "Godan verb with '\u3046' ending", "\u52D5\u8A5E"]
147
150
  ],
148
151
  [
149
152
  "godan verb with 'tsu' ending",
150
- ["godan::tsu::verb", "Godan verb with '\u3064' ending"]
153
+ ["godan::tsu::verb", "Godan verb with '\u3064' ending", "\u52D5\u8A5E"]
151
154
  ],
152
155
  [
153
156
  "godan verb with 'ru' ending",
154
- ["godan::ru::verb", "Godan verb with '\u308B' ending"]
157
+ ["godan::ru::verb", "Godan verb with '\u308B' ending", "\u52D5\u8A5E"]
155
158
  ],
156
159
  [
157
160
  "godan verb with 'nu' ending",
158
- ["godan::nu::verb", "Godan verb with '\u306C' ending"]
161
+ ["godan::nu::verb", "Godan verb with '\u306C' ending", "\u52D5\u8A5E"]
159
162
  ],
160
163
  [
161
164
  "godan verb with 'mu' ending",
162
- ["godan::mu::verb", "Godan verb with '\u3080' ending"]
165
+ ["godan::mu::verb", "Godan verb with '\u3080' ending", "\u52D5\u8A5E"]
163
166
  ],
164
167
  [
165
168
  "godan verb with 'bu' ending",
166
- ["godan::bu::verb", "Godan verb with '\u3076' ending"]
169
+ ["godan::bu::verb", "Godan verb with '\u3076' ending", "\u52D5\u8A5E"]
167
170
  ],
168
171
  [
169
172
  "godan verb with 'su' ending",
170
- ["godan::su::verb", "Godan verb with '\u3059' ending"]
173
+ ["godan::su::verb", "Godan verb with '\u3059' ending", "\u52D5\u8A5E"]
171
174
  ],
172
175
  [
173
176
  "godan verb with 'u' ending (special class)",
174
- ["godan::u::irregular_verb", "Irregular godan verb with '\u3046' ending"]
177
+ [
178
+ "godan::u::irregular_verb",
179
+ "Irregular godan verb with '\u3046' ending",
180
+ "\u52D5\u8A5E"
181
+ ]
175
182
  ],
176
183
  [
177
184
  "godan verb with 'ru' ending (irregular verb)",
178
- ["godan::ru::irregular_verb", "Irregular godan verb with '\u308B' ending"]
185
+ [
186
+ "godan::ru::irregular_verb",
187
+ "Irregular godan verb with '\u308B' ending",
188
+ "\u52D5\u8A5E"
189
+ ]
179
190
  ],
180
191
  [
181
192
  "godan verb - -aru special class",
182
- ["godan::aru::irregular_verb", "Irregular godan verb with '-\u3042\u308B' ending"]
193
+ [
194
+ "godan::aru::irregular_verb",
195
+ "Irregular godan verb with '-\u3042\u308B' ending",
196
+ "\u52D5\u8A5E"
197
+ ]
183
198
  ],
184
199
  [
185
200
  "godan verb - iku/yuku special class",
186
201
  [
187
202
  "godan::iku_yuku::irregular_verb",
188
- "Irregular godan verb with '\u3044\u304F' or '\u3086\u304F' ending"
203
+ "Irregular godan verb with '\u3044\u304F' or '\u3086\u304F' ending",
204
+ "\u52D5\u8A5E"
189
205
  ]
190
206
  ],
191
207
  [
192
208
  "irregular nu verb",
193
- ["godan::nu::irregular_verb", "Irregular godan verb with '\u306C' ending"]
194
- ],
195
- ["kuru verb - special class", ["kuru_verb", "Special '\u304F\u308B' verb"]],
196
- ["transitive verb", ["transitive_verb", "Transitive verb"]],
197
- ["intransitive verb", ["intransitive_verb", "Intransitive verb"]],
198
- ["auxiliary verb", ["auxiliary_verb", "Auxiliary verb"]],
199
- ["auxiliary adjective", ["adjective::auxiliary", "Auxiliary adjective"]],
200
- ["auxiliary", ["auxiliary", "Auxiliary"]],
209
+ [
210
+ "godan::nu::irregular_verb",
211
+ "Irregular godan verb with '\u306C' ending",
212
+ "\u52D5\u8A5E"
213
+ ]
214
+ ],
215
+ ["kuru verb - special class", ["kuru_verb", "Special '\u304F\u308B' verb", "\u52D5\u8A5E"]],
216
+ ["transitive verb", ["transitive_verb", "Transitive verb", "\u52D5\u8A5E"]],
217
+ ["intransitive verb", ["intransitive_verb", "Intransitive verb", "\u52D5\u8A5E"]],
218
+ ["auxiliary verb", ["auxiliary_verb", "Auxiliary verb", ["\u52D5\u8A5E", "\u52A9\u52D5\u8A5E"]]],
219
+ [
220
+ "auxiliary adjective",
221
+ ["adjective::auxiliary", "Auxiliary adjective", ["\u52A9\u8A5E", "\u52A9\u52D5\u8A5E"]]
222
+ ],
223
+ ["auxiliary", ["auxiliary", "Auxiliary", ["\u52A9\u8A5E", "\u52A9\u52D5\u8A5E"]]],
201
224
  ["after a verb", ["after::verb", "After a verb"]],
202
225
  [
203
226
  "after the -te form of a verb",
@@ -293,19 +316,52 @@ var noteMap = /* @__PURE__ */ new Map([
293
316
  ],
294
317
  ["before an adjective", ["before::adjective", "Before an adjective"]],
295
318
  ["after a noun", ["after::noun", "After a noun"]],
296
- ["prefix", ["prefix", "Prefix"]],
297
- ["noun, used as a prefix", ["prefix_noun", "Noun, used as a prefix"]],
298
- ["suffix", ["suffix", "Suffix"]],
299
- ["noun, used as a suffix", ["suffix_noun", "Noun, used as a suffix"]],
300
- ["counter", ["counter", "Counter"]],
301
- ["numeric", ["numeric", "Numeric"]],
302
- ["particle", ["particle", "Particle"]],
303
- ["conjunction", ["conjunction", "Conjunction"]],
304
- ["expression", ["expression", "Expression"]],
305
- ["idiomatic expression", ["idiomatic_expression", "Idiomatic expression"]],
306
- ["interjection (kandoushi)", ["interjection", "Interjection"]],
307
- ["proverb", ["proverb", "Proverb"]],
308
- ["yojijukugo", ["yojijukugo", "Yojijukugo"]],
319
+ ["prefix", ["prefix", "Prefix", ["\u63A5\u982D\u8A9E", "\u63A5\u982D\u8F9E"]]],
320
+ [
321
+ "noun, used as a prefix",
322
+ [
323
+ "prefix_noun",
324
+ "Noun, used as a prefix",
325
+ ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206", "\u63A5\u982D\u8A9E", "\u63A5\u982D\u8F9E"]
326
+ ]
327
+ ],
328
+ ["suffix", ["suffix", "Suffix", ["\u63A5\u5C3E\u8A9E", "\u63A5\u5C3E\u8F9E"]]],
329
+ [
330
+ "noun, used as a suffix",
331
+ [
332
+ "suffix_noun",
333
+ "Noun, used as a suffix",
334
+ ["\u540D\u8A5E", "\u9020\u8A9E\u6210\u5206", "\u63A5\u5C3E\u8A9E", "\u63A5\u5C3E\u8F9E"]
335
+ ]
336
+ ],
337
+ ["counter", ["counter", "Counter", "\u52A9\u6570\u8A5E"]],
338
+ ["numeric", ["numeric", "Numeric", "\u6570\u8A5E"]],
339
+ ["particle", ["particle", "Particle", ["\u52A9\u8A5E", "\u63A5\u7D9A\u52A9\u8A5E"]]],
340
+ ["conjunction", ["conjunction", "Conjunction", "\u63A5\u7D9A\u8A5E"]],
341
+ [
342
+ "expression",
343
+ ["expression", "Expression", ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]]
344
+ ],
345
+ [
346
+ "idiomatic expression",
347
+ [
348
+ "idiomatic_expression",
349
+ "Idiomatic expression",
350
+ ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]
351
+ ]
352
+ ],
353
+ [
354
+ "interjection (kandoushi)",
355
+ ["interjection", "Interjection", ["\u611F\u52D5\u8A5E", "\u9593\u6295\u8A5E"]]
356
+ ],
357
+ [
358
+ "proverb",
359
+ ["proverb", "Proverb", ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5", "\u3053\u3068\u308F\u3056"]]
360
+ ],
361
+ [
362
+ "yojijukugo",
363
+ ["yojijukugo", "Yojijukugo", ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]]
364
+ ],
309
365
  ["archaism", ["archaism", "Archaism"]],
310
366
  ["obsolete term", ["obsolete", "Obsolete"]],
311
367
  ["dated term", ["dated", "Dated"]],
@@ -318,7 +374,7 @@ var noteMap = /* @__PURE__ */ new Map([
318
374
  ["derogatory", ["derogatory", "Derogatory"]],
319
375
  ["sensitive", ["sensitive", "Sensitive"]],
320
376
  ["euphemistic", ["euphemistic", "Euphemistic"]],
321
- ["abbreviation", ["abbreviation", "Abbreviation"]],
377
+ ["abbreviation", ["abbreviation", "Abbreviation", ["\u7565\u8A9E", "\u982D\u5B57\u8A9E"]]],
322
378
  ["male term or language", ["male_language", "Male language"]],
323
379
  ["female term or language", ["female_language", "Female language"]],
324
380
  [
@@ -502,7 +558,7 @@ var noteMap = /* @__PURE__ */ new Map([
502
558
  ],
503
559
  [
504
560
  "adjective (keiyoushi) - yoi/ii class",
505
- ["adjective::yoi/ii", "\u3044-adjective - \u3088\u3044/\u3044\u3044 class"]
561
+ ["adjective::yoi/ii", "\u3044-adjective - \u3088\u3044/\u3044\u3044 class", "\u5F62\u5BB9\u8A5E"]
506
562
  ],
507
563
  [
508
564
  "'kari' adjective (archaic)",
@@ -511,11 +567,15 @@ var noteMap = /* @__PURE__ */ new Map([
511
567
  ["'ku' adjective (archaic)", ["adjective::ku", "'\u304F' adjective (archaic)"]],
512
568
  [
513
569
  "adjectival nouns or quasi-adjectives (keiyodoshi)",
514
- ["na-adjective", "\u306A-adjective"]
570
+ ["na-adjective", "\u306A-adjective", "\u5F62\u5BB9\u52D5\u8A5E"]
515
571
  ],
516
572
  [
517
573
  "archaic/formal form of na-adjective",
518
- ["na-adjective_archaic_or_formal", "archaic/formal form of \u306A-adjective"]
574
+ [
575
+ "na-adjective_archaic_or_formal",
576
+ "archaic/formal form of \u306A-adjective",
577
+ "\u5F62\u5BB9\u52D5\u8A5E"
578
+ ]
519
579
  ],
520
580
  [
521
581
  "'shiku' adjective (archaic)",
@@ -524,235 +584,264 @@ var noteMap = /* @__PURE__ */ new Map([
524
584
  ["copula", ["copula", "Copula"]],
525
585
  [
526
586
  "expressions (phrases, clauses, etc.)",
527
- ["expression", "Expression (phrase, clause, etc.)"]
587
+ [
588
+ "expression",
589
+ "Expression (phrase, clause, etc.)",
590
+ ["\u6210\u8A9E", "\u6210\u53E5", "\u6163\u7528\u53E5", "\u52D5\u8A5E\u53E5"]
591
+ ]
528
592
  ],
529
593
  ["adverbial noun (fukushitekimeishi)", ["adverbial_noun", "Adverbial noun"]],
530
594
  ["proper noun", ["proper_noun", "Proper noun"]],
531
595
  ["noun (temporal) (jisoumeishi)", ["temporal_noun", "Temporal noun"]],
532
596
  ["unclassified", ["unclassified", "Unclassified"]],
533
- ["verb unspecified", ["unspecified_verb", "Unspecified verb"]],
597
+ ["verb unspecified", ["unspecified_verb", "Unspecified verb", "\u52D5\u8A5E"]],
534
598
  [
535
599
  "ichidan verb - kureru special class",
536
- ["ichidan_verb::kureru", "Ichidan verb - \u304F\u308C\u308B special class"]
600
+ ["ichidan_verb::kureru", "Ichidan verb - \u304F\u308C\u308B special class", "\u52D5\u8A5E"]
537
601
  ],
538
602
  [
539
603
  "nidan verb with 'u' ending (archaic)",
540
- ["nidan_verb::u", "Nidan verb with '\u3046' ending (archaic)"]
604
+ ["nidan_verb::u", "Nidan verb with '\u3046' ending (archaic)", "\u52D5\u8A5E"]
541
605
  ],
542
606
  [
543
607
  "nidan verb (upper class) with 'bu' ending (archaic)",
544
608
  [
545
609
  "nidan_verb::bu::upper_class",
546
- "Nidan verb (upper class) with '\u3076' ending (archaic)"
610
+ "Nidan verb (upper class) with '\u3076' ending (archaic)",
611
+ "\u52D5\u8A5E"
547
612
  ]
548
613
  ],
549
614
  [
550
615
  "nidan verb (lower class) with 'bu' ending (archaic)",
551
616
  [
552
617
  "nidan_verb::bu::lower_class",
553
- "Nidan verb (lower class) with '\u3076' ending (archaic)"
618
+ "Nidan verb (lower class) with '\u3076' ending (archaic)",
619
+ "\u52D5\u8A5E"
554
620
  ]
555
621
  ],
556
622
  [
557
623
  "nidan verb (upper class) with 'dzu' ending (archaic)",
558
624
  [
559
625
  "nidan_verb::dzu::upper_class",
560
- "Nidan verb (upper class) with '\u3065' ending (archaic)"
626
+ "Nidan verb (upper class) with '\u3065' ending (archaic)",
627
+ "\u52D5\u8A5E"
561
628
  ]
562
629
  ],
563
630
  [
564
631
  "nidan verb (lower class) with 'dzu' ending (archaic)",
565
632
  [
566
633
  "nidan_verb::dzu::lower_class",
567
- "Nidan verb (lower class) with '\u3065' ending (archaic)"
634
+ "Nidan verb (lower class) with '\u3065' ending (archaic)",
635
+ "\u52D5\u8A5E"
568
636
  ]
569
637
  ],
570
638
  [
571
639
  "nidan verb (upper class) with 'gu' ending (archaic)",
572
640
  [
573
641
  "nidan_verb::gu::upper_class",
574
- "Nidan verb (upper class) with '\u3050' ending (archaic)"
642
+ "Nidan verb (upper class) with '\u3050' ending (archaic)",
643
+ "\u52D5\u8A5E"
575
644
  ]
576
645
  ],
577
646
  [
578
647
  "nidan verb (lower class) with 'gu' ending (archaic)",
579
648
  [
580
649
  "nidan_verb::gu::lower_class",
581
- "Nidan verb (lower class) with '\u3050' ending (archaic)"
650
+ "Nidan verb (lower class) with '\u3050' ending (archaic)",
651
+ "\u52D5\u8A5E"
582
652
  ]
583
653
  ],
584
654
  [
585
655
  "nidan verb (upper class) with 'hu/fu' ending (archaic)",
586
656
  [
587
657
  "nidan_verb::hu/fu::upper_class",
588
- "Nidan verb (upper class) with '\u3075' ending (archaic)"
658
+ "Nidan verb (upper class) with '\u3075' ending (archaic)",
659
+ "\u52D5\u8A5E"
589
660
  ]
590
661
  ],
591
662
  [
592
663
  "nidan verb (lower class) with 'hu/fu' ending (archaic)",
593
664
  [
594
665
  "nidan_verb::hu/fu::lower_class",
595
- "Nidan verb (lower class) with '\u3075' ending (archaic)"
666
+ "Nidan verb (lower class) with '\u3075' ending (archaic)",
667
+ "\u52D5\u8A5E"
596
668
  ]
597
669
  ],
598
670
  [
599
671
  "nidan verb (upper class) with 'ku' ending (archaic)",
600
672
  [
601
673
  "nidan_verb::ku::upper_class",
602
- "Nidan verb (upper class) with '\u304F' ending (archaic)"
674
+ "Nidan verb (upper class) with '\u304F' ending (archaic)",
675
+ "\u52D5\u8A5E"
603
676
  ]
604
677
  ],
605
678
  [
606
679
  "nidan verb (lower class) with 'ku' ending (archaic)",
607
680
  [
608
681
  "nidan_verb::ku::lower_class",
609
- "Nidan verb (lower class) with '\u304F' ending (archaic)"
682
+ "Nidan verb (lower class) with '\u304F' ending (archaic)",
683
+ "\u52D5\u8A5E"
610
684
  ]
611
685
  ],
612
686
  [
613
687
  "nidan verb (upper class) with 'mu' ending (archaic)",
614
688
  [
615
689
  "nidan_verb::mu::upper_class",
616
- "Nidan verb (upper class) with '\u3080' ending (archaic)"
690
+ "Nidan verb (upper class) with '\u3080' ending (archaic)",
691
+ "\u52D5\u8A5E"
617
692
  ]
618
693
  ],
619
694
  [
620
695
  "nidan verb (lower class) with 'mu' ending (archaic)",
621
696
  [
622
697
  "nidan_verb::mu::lower_class",
623
- "Nidan verb (lower class) with '\u3080' ending (archaic)"
698
+ "Nidan verb (lower class) with '\u3080' ending (archaic)",
699
+ "\u52D5\u8A5E"
624
700
  ]
625
701
  ],
626
702
  [
627
703
  "nidan verb (lower class) with 'nu' ending (archaic)",
628
704
  [
629
705
  "nidan_verb::nu::lower_class",
630
- "Nidan verb (lower class) with '\u306C' ending (archaic)"
706
+ "Nidan verb (lower class) with '\u306C' ending (archaic)",
707
+ "\u52D5\u8A5E"
631
708
  ]
632
709
  ],
633
710
  [
634
711
  "nidan verb (upper class) with 'ru' ending (archaic)",
635
712
  [
636
713
  "nidan_verb::ru::upper_class",
637
- "Nidan verb (upper class) with '\u308B' ending (archaic)"
714
+ "Nidan verb (upper class) with '\u308B' ending (archaic)",
715
+ "\u52D5\u8A5E"
638
716
  ]
639
717
  ],
640
718
  [
641
719
  "nidan verb (lower class) with 'ru' ending (archaic)",
642
720
  [
643
721
  "nidan_verb::ru::lower_class",
644
- "Nidan verb (lower class) with '\u308B' ending (archaic)"
722
+ "Nidan verb (lower class) with '\u308B' ending (archaic)",
723
+ "\u52D5\u8A5E"
645
724
  ]
646
725
  ],
647
726
  [
648
727
  "nidan verb (lower class) with 'su' ending (archaic)",
649
728
  [
650
729
  "nidan_verb::su::lower_class",
651
- "Nidan verb (lower class) with '\u3059' ending (archaic)"
730
+ "Nidan verb (lower class) with '\u3059' ending (archaic)",
731
+ "\u52D5\u8A5E"
652
732
  ]
653
733
  ],
654
734
  [
655
735
  "nidan verb (upper class) with 'tsu' ending (archaic)",
656
736
  [
657
737
  "nidan_verb::tsu::upper_class",
658
- "Nidan verb (upper class) with '\u3064' ending (archaic)"
738
+ "Nidan verb (upper class) with '\u3064' ending (archaic)",
739
+ "\u52D5\u8A5E"
659
740
  ]
660
741
  ],
661
742
  [
662
743
  "nidan verb (lower class) with 'tsu' ending (archaic)",
663
744
  [
664
745
  "nidan_verb::tsu::lower_class",
665
- "Nidan verb (lower class) with '\u3064' ending (archaic)"
746
+ "Nidan verb (lower class) with '\u3064' ending (archaic)",
747
+ "\u52D5\u8A5E"
666
748
  ]
667
749
  ],
668
750
  [
669
751
  "nidan verb (lower class) with 'u' ending and 'we' conjugation (archaic)",
670
752
  [
671
753
  "nidan_verb::u_with_we_conjugation::lower_class",
672
- "Nidan verb (lower class) with '\u3046' ending and '\u3091' conjugation (archaic)"
754
+ "Nidan verb (lower class) with '\u3046' ending and '\u3091' conjugation (archaic)",
755
+ "\u52D5\u8A5E"
673
756
  ]
674
757
  ],
675
758
  [
676
759
  "nidan verb (upper class) with 'yu' ending (archaic)",
677
760
  [
678
761
  "nidan_verb::yu::upper_class",
679
- "Nidan verb (upper class) with '\u3086' ending (archaic)"
762
+ "Nidan verb (upper class) with '\u3086' ending (archaic)",
763
+ "\u52D5\u8A5E"
680
764
  ]
681
765
  ],
682
766
  [
683
767
  "nidan verb (lower class) with 'yu' ending (archaic)",
684
768
  [
685
769
  "nidan_verb::yu::lower_class",
686
- "Nidan verb (lower class) with '\u3086' ending (archaic)"
770
+ "Nidan verb (lower class) with '\u3086' ending (archaic)",
771
+ "\u52D5\u8A5E"
687
772
  ]
688
773
  ],
689
774
  [
690
775
  "nidan verb (lower class) with 'zu' ending (archaic)",
691
776
  [
692
777
  "nidan_verb::zu::lower_class",
693
- "Nidan verb (lower class) with '\u305A' ending (archaic)"
778
+ "Nidan verb (lower class) with '\u305A' ending (archaic)",
779
+ "\u52D5\u8A5E"
694
780
  ]
695
781
  ],
696
782
  [
697
783
  "yodan verb with 'bu' ending (archaic)",
698
- ["yodan_verb::bu", "Yodan verb with '\u3076' ending (archaic)"]
784
+ ["yodan_verb::bu", "Yodan verb with '\u3076' ending (archaic)", "\u52D5\u8A5E"]
699
785
  ],
700
786
  [
701
787
  "yodan verb with 'gu' ending (archaic)",
702
- ["yodan_verb::gu", "Yodan verb with '\u3050' ending (archaic)"]
788
+ ["yodan_verb::gu", "Yodan verb with '\u3050' ending (archaic)", "\u52D5\u8A5E"]
703
789
  ],
704
790
  [
705
791
  "yodan verb with 'hu/fu' ending (archaic)",
706
- ["yodan_verb::hu/fu", "Yodan verb with '\u3075' ending (archaic)"]
792
+ ["yodan_verb::hu/fu", "Yodan verb with '\u3075' ending (archaic)", "\u52D5\u8A5E"]
707
793
  ],
708
794
  [
709
795
  "yodan verb with 'ku' ending (archaic)",
710
- ["yodan_verb::ku", "Yodan verb with '\u304F' ending (archaic)"]
796
+ ["yodan_verb::ku", "Yodan verb with '\u304F' ending (archaic)", "\u52D5\u8A5E"]
711
797
  ],
712
798
  [
713
799
  "yodan verb with 'mu' ending (archaic)",
714
- ["yodan_verb::mu", "Yodan verb with '\u3080' ending (archaic)"]
800
+ ["yodan_verb::mu", "Yodan verb with '\u3080' ending (archaic)", "\u52D5\u8A5E"]
715
801
  ],
716
802
  [
717
803
  "yodan verb with 'nu' ending (archaic)",
718
- ["yodan_verb::nu", "Yodan verb with '\u306C' ending (archaic)"]
804
+ ["yodan_verb::nu", "Yodan verb with '\u306C' ending (archaic)", "\u52D5\u8A5E"]
719
805
  ],
720
806
  [
721
807
  "yodan verb with 'ru' ending (archaic)",
722
- ["yodan_verb::ru", "Yodan verb with '\u308B' ending (archaic)"]
808
+ ["yodan_verb::ru", "Yodan verb with '\u308B' ending (archaic)", "\u52D5\u8A5E"]
723
809
  ],
724
810
  [
725
811
  "yodan verb with 'su' ending (archaic)",
726
- ["yodan_verb::su", "Yodan verb with '\u3059' ending (archaic)"]
812
+ ["yodan_verb::su", "Yodan verb with '\u3059' ending (archaic)", "\u52D5\u8A5E"]
727
813
  ],
728
814
  [
729
815
  "yodan verb with 'tsu' ending (archaic)",
730
- ["yodan_verb::tsu", "Yodan verb with '\u3064' ending (archaic)"]
816
+ ["yodan_verb::tsu", "Yodan verb with '\u3064' ending (archaic)", "\u52D5\u8A5E"]
731
817
  ],
732
818
  [
733
819
  "godan verb - uru old class verb (old form of eru)",
734
820
  [
735
821
  "godan::uru::irregular_verb",
736
- "Godan verb - '\u3046\u308B' old class verb (old form of \u3048\u308B)"
822
+ "Godan verb - '\u3046\u308B' old class verb (old form of \u3048\u308B)",
823
+ "\u52D5\u8A5E"
737
824
  ]
738
825
  ],
739
826
  [
740
827
  "irregular ru verb, plain form ends with -ri",
741
828
  [
742
829
  "irregular_ru_verb_plain_form_ending_with_ri",
743
- "irregular '\u308B' verb, plain form ends with '-\u308A'"
830
+ "irregular '\u308B' verb, plain form ends with '-\u308A'",
831
+ "\u52D5\u8A5E"
744
832
  ]
745
833
  ],
746
834
  [
747
835
  "su verb - precursor to the modern suru",
748
- ["su_verb", "'\u3059' verb - precursor to the modern \u3059\u308B"]
836
+ ["su_verb", "'\u3059' verb - precursor to the modern \u3059\u308B", "\u52D5\u8A5E"]
749
837
  ],
750
- ["suru verb - included", ["suru_verb", "'\u3059\u308B' verb - included"]],
838
+ ["suru verb - included", ["suru_verb", "'\u3059\u308B' verb - included", "\u52D5\u8A5E"]],
751
839
  [
752
840
  "ichidan verb - zuru verb (alternative form of -jiru verbs)",
753
841
  [
754
842
  "ichidan_verb::zuru",
755
- "Ichidan verb - '\u305A\u308B' verb (alternative form of '-\u3058\u308B' verbs)"
843
+ "Ichidan verb - '\u305A\u308B' verb (alternative form of '-\u3058\u308B' verbs)",
844
+ "\u52D5\u8A5E"
756
845
  ]
757
846
  ],
758
847
  ["agriculture", ["agriculture", "Agriculture term"]],
@@ -1594,11 +1683,42 @@ async function convertJawiktionary(stream) {
1594
1683
  }
1595
1684
  );
1596
1685
  }
1686
+ function mapEntry(entry) {
1687
+ if (entry.word === void 0 || typeof entry.word !== "string")
1688
+ throw new Error("Invalid ja.wiktionary entry");
1689
+ return {
1690
+ word: entry.word,
1691
+ ...entry.pos_title && typeof entry.pos_title === "string" ? { pos_title: entry.pos_title } : {},
1692
+ ...isValidArray(entry.senses) ? {
1693
+ senses: entry.senses.filter(
1694
+ (sense) => isValidArray(sense.form_of) && sense.form_of.every(
1695
+ (form) => form.word && typeof form.word === "string"
1696
+ ) || isStringArray(sense.glosses)
1697
+ ).map((sense) => ({
1698
+ ...sense.form_of ? {
1699
+ form_of: sense.form_of.map((form) => ({
1700
+ word: form.word
1701
+ }))
1702
+ } : {},
1703
+ ...sense.glosses ? { glosses: sense.glosses } : {}
1704
+ }))
1705
+ } : {},
1706
+ ...isValidArray(entry.forms) && entry.forms.every((form) => typeof form.form === "string") ? { forms: entry.forms.map((form) => ({ form: form.form })) } : {}
1707
+ };
1708
+ }
1597
1709
  function parseEntry(entry, definitions, definitionMap) {
1598
1710
  if (isValidArray(entry.senses)) {
1599
1711
  for (const sense of entry.senses)
1600
1712
  if (isStringArray(sense.glosses)) {
1601
- const definition = sense.glosses.join("<br>");
1713
+ let definition = "";
1714
+ for (let i = 0; i < sense.glosses.length; i += 2) {
1715
+ if (i !== 0) {
1716
+ let prev = sense.glosses[i - 1];
1717
+ let cur = sense.glosses[i];
1718
+ if (prev && cur)
1719
+ definition += `${prev}${!prev.endsWith("\u3002") ? "\u3002" : ""}${cur}`;
1720
+ } else definition += sense.glosses[i];
1721
+ }
1602
1722
  if (!definitions.some((def) => def.definition === definition)) {
1603
1723
  if (!definitionMap.has(definition))
1604
1724
  definitionMap.set(definition, { count: 1 });
@@ -1608,9 +1728,16 @@ function parseEntry(entry, definitions, definitionMap) {
1608
1728
  }
1609
1729
  }
1610
1730
  }
1611
- async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1731
+ async function getWordDefinitions(entryList, jmDict, generateFurigana) {
1612
1732
  return await new Promise(async (resolve, reject) => {
1733
+ var _a, _b, _c, _d, _e;
1613
1734
  try {
1735
+ const entries = /* @__PURE__ */ new Map();
1736
+ for (const entry of entryList) {
1737
+ const ent = entries.get(entry.word);
1738
+ if (ent) ent.push(mapEntry(entry));
1739
+ else entries.set(entry.word, [mapEntry(entry)]);
1740
+ }
1614
1741
  const japaneseDefinitions = [];
1615
1742
  const definitionMap = /* @__PURE__ */ new Map();
1616
1743
  const validWords = [];
@@ -1630,18 +1757,16 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1630
1757
  if (!valid) valid = true;
1631
1758
  }
1632
1759
  }
1633
- if (valid)
1634
- validWords.push(
1635
- getWord(void 0, void 0, kanjiDic, void 0, void 0, word)
1636
- );
1760
+ if (valid) validWords.push(word);
1637
1761
  }
1638
- const validTitleEntries = [];
1639
- const entriesWithFormTitlesGlobal = [];
1640
- const entriesWithFormsGlobal = [];
1762
+ const validTitleEntries = /* @__PURE__ */ new Map();
1763
+ const entriesWithFormTitlesGlobal = /* @__PURE__ */ new Map();
1764
+ const entriesWithFormsGlobal = /* @__PURE__ */ new Map();
1641
1765
  const validFormOfEntries = /* @__PURE__ */ new Set();
1642
1766
  const validGlossesEntries = /* @__PURE__ */ new Set();
1643
1767
  const validFormsEntries = /* @__PURE__ */ new Set();
1644
- for (const entry of entries) {
1768
+ const ents = Array.from(entries.values()).flat();
1769
+ for (const entry of ents) {
1645
1770
  let valid = false;
1646
1771
  if (validKanjiForms && validKanjiForms.has(entry.word)) {
1647
1772
  valid = true;
@@ -1651,19 +1776,20 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1651
1776
  (form) => form.word && typeof form.word === "string" && validReadings.has(form.word)
1652
1777
  ))
1653
1778
  validFormOfEntries.add(entry.word);
1654
- else if (isValidArray(sense.glosses) && sense.glosses.length === 1) {
1655
- const gloss = sense.glosses[0];
1656
- let reading = void 0;
1657
- if (gloss !== void 0) {
1658
- if (gloss.trim().includes("\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u53C2\u7167\u3002")) {
1659
- for (const r of validReadings)
1660
- if (gloss.trim().includes(r)) {
1661
- reading = r;
1662
- break;
1663
- }
1779
+ else if (isStringArray(sense.glosses)) {
1780
+ for (const gloss of sense.glosses) {
1781
+ let reading = void 0;
1782
+ if (gloss !== void 0) {
1783
+ if (gloss.trim().includes("\u306E\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u3092\u53C2\u7167\u3002")) {
1784
+ for (const r of validReadings)
1785
+ if (gloss.trim().includes(r)) {
1786
+ reading = r;
1787
+ break;
1788
+ }
1789
+ }
1664
1790
  }
1791
+ if (reading) validGlossesEntries.add(entry.word);
1665
1792
  }
1666
- if (reading) validGlossesEntries.add(entry.word);
1667
1793
  }
1668
1794
  }
1669
1795
  if (isValidArray(entry.forms)) {
@@ -1671,57 +1797,260 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1671
1797
  if (form.form && typeof form.form === "string" && validReadings.has(form.form))
1672
1798
  validFormsEntries.add(entry.word);
1673
1799
  }
1674
- } else if (validReadings.has(entry.word) && isValidArray(entry.forms) && entry.forms.some((form) => validKanjiForms.has(form.form))) {
1675
- valid = true;
1676
- entriesWithFormTitlesGlobal.push(entry);
1677
1800
  } else if (validReadings.has(entry.word)) {
1678
1801
  valid = true;
1679
- entriesWithFormTitlesGlobal.push(entry);
1802
+ const ftEntry = entriesWithFormTitlesGlobal.get(entry.word);
1803
+ if (ftEntry) ftEntry.push(entry);
1804
+ else entriesWithFormTitlesGlobal.set(entry.word, [entry]);
1805
+ }
1806
+ if (valid) {
1807
+ const tEntry = validTitleEntries.get(entry.word);
1808
+ if (tEntry) tEntry.push(entry);
1809
+ else validTitleEntries.set(entry.word, [entry]);
1680
1810
  }
1681
- if (valid) validTitleEntries.push(entry);
1682
1811
  if (isValidArray(entry.forms) && (validKanjiForms.has(entry.word) || validReadings.has(entry.word)) && entry.forms.some(
1683
1812
  (form) => validKanjiForms.has(form.form) || validReadings.has(form.form)
1684
- ))
1685
- entriesWithFormsGlobal.push(entry);
1813
+ )) {
1814
+ const wfEntry = entriesWithFormsGlobal.get(entry.word);
1815
+ if (wfEntry) wfEntry.push(entry);
1816
+ else entriesWithFormsGlobal.set(entry.word, [entry]);
1817
+ }
1686
1818
  }
1819
+ ents.length = 0;
1820
+ const posMap = /* @__PURE__ */ new Map();
1821
+ const vte = Array.from(
1822
+ validTitleEntries.values()
1823
+ ).flat();
1824
+ const fge = Array.from(
1825
+ entriesWithFormTitlesGlobal.values()
1826
+ ).flat();
1827
+ const wfe = Array.from(
1828
+ entriesWithFormsGlobal.values()
1829
+ ).flat();
1830
+ for (const pos of [
1831
+ "\u540D\u8A5E",
1832
+ "\u52D5\u8A5E",
1833
+ "\u6210\u53E5",
1834
+ "\u526F\u8A5E",
1835
+ "\u5F62\u5BB9\u52D5\u8A5E",
1836
+ "\u52A9\u8A5E",
1837
+ "\u611F\u52D5\u8A5E",
1838
+ "\u4EE3\u540D\u8A5E",
1839
+ "\u63A5\u5C3E\u8F9E",
1840
+ "\u63A5\u982D\u8A9E",
1841
+ "\u9020\u8A9E\u6210\u5206",
1842
+ "\u7565\u8A9E",
1843
+ "\u56FA\u6709\u540D\u8A5E",
1844
+ "\u4EBA\u79F0\u4EE3\u540D\u8A5E",
1845
+ "\u63A5\u982D\u8F9E",
1846
+ "\u63A5\u7D9A\u52A9\u8A5E",
1847
+ "\u9593\u6295\u8A5E",
1848
+ "\u52A9\u52D5\u8A5E",
1849
+ "\u5F62\u5BB9\u8A5E",
1850
+ "\u7E2E\u7D04\u5F62",
1851
+ "\u63A5\u8F9E",
1852
+ "\u63A5\u7D9A\u8A5E",
1853
+ "\u9023\u4F53\u8A5E",
1854
+ "\u4EBA\u540D",
1855
+ "\u8A18\u53F7",
1856
+ "\u6570\u8A5E",
1857
+ "\u6163\u7528\u53E5",
1858
+ "\u3053\u3068\u308F\u3056",
1859
+ "\u52A9\u6570\u8A5E",
1860
+ "\u82F1\u6570\u5B57\u6DF7\u5408\u8868\u8A18",
1861
+ "\u52D5\u8A5E\u53E5",
1862
+ "\u6210\u8A9E",
1863
+ "\u610F\u7FA9",
1864
+ "\u982D\u5B57\u8A9E",
1865
+ "\u63A5\u5C3E\u8A9E"
1866
+ ]) {
1867
+ for (const te of vte)
1868
+ if (te.pos_title === pos || te.pos_title === "\u548C\u8A9E\u306E\u6F22\u5B57\u8868\u8A18") {
1869
+ if (!posMap.has(pos)) posMap.set(pos, {});
1870
+ const posEntries = posMap.get(pos);
1871
+ if (posEntries.title === void 0)
1872
+ posEntries.title = /* @__PURE__ */ new Map();
1873
+ const entryList2 = posEntries.title.get(te.word);
1874
+ if (entryList2) entryList2.push(te);
1875
+ else posEntries.title.set(te.word, [te]);
1876
+ }
1877
+ for (const ft of fge)
1878
+ if (ft.pos_title === pos) {
1879
+ if (!posMap.has(pos)) posMap.set(pos, {});
1880
+ const posEntries = posMap.get(pos);
1881
+ if (posEntries.formTitle === void 0)
1882
+ posEntries.formTitle = /* @__PURE__ */ new Map();
1883
+ const entryList2 = posEntries.formTitle.get(ft.word);
1884
+ if (entryList2) entryList2.push(ft);
1885
+ else posEntries.formTitle.set(ft.word, [ft]);
1886
+ }
1887
+ for (const wf of wfe)
1888
+ if (wf.pos_title === pos) {
1889
+ if (!posMap.has(pos)) posMap.set(pos, {});
1890
+ const posEntries = posMap.get(pos);
1891
+ if (posEntries.form === void 0)
1892
+ posEntries.form = /* @__PURE__ */ new Map();
1893
+ const entryList2 = posEntries.form.get(wf.word);
1894
+ if (entryList2) entryList2.push(wf);
1895
+ else posEntries.form.set(wf.word, [wf]);
1896
+ }
1897
+ }
1898
+ vte.length = 0;
1899
+ fge.length = 0;
1900
+ wfe.length = 0;
1901
+ const wordEntriesPairs = [];
1687
1902
  for (const word of validWords) {
1688
- const definitions = [];
1689
- const kanjiFormEntries = [];
1690
- const readingWithFormsEntries = [];
1691
- const readingEntries = [];
1692
- const titleFormMap = /* @__PURE__ */ new Map();
1693
- const readingForms = /* @__PURE__ */ new Set();
1903
+ const poses = /* @__PURE__ */ new Set();
1904
+ for (const m of word.meanings) {
1905
+ if (m.partOfSpeech)
1906
+ for (const note of m.partOfSpeech) {
1907
+ const noteEntry = noteMap.get(note);
1908
+ if (noteEntry && noteEntry.length === 3) {
1909
+ const notePos = noteEntry[2];
1910
+ if (Array.isArray(notePos))
1911
+ for (const pos of notePos) {
1912
+ if (!poses.has(pos)) poses.add(pos);
1913
+ }
1914
+ else if (typeof notePos === "string" && !poses.has(notePos))
1915
+ poses.add(notePos);
1916
+ }
1917
+ }
1918
+ }
1694
1919
  const validWordReadings = new Set(
1695
1920
  word.readings.filter(
1696
- (r) => r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note)) || r.common === true
1921
+ (r) => r.notes === void 0 || !r.notes.some((note) => notSearchedForms.has(note)) || r.commonness !== void 0
1697
1922
  ).map((r) => r.reading)
1698
1923
  );
1699
1924
  const validWordKanjiForms = word.kanjiForms ? new Set(
1700
1925
  word.kanjiForms.filter(
1701
1926
  (kf) => kf.notes === void 0 || !kf.notes.some(
1702
1927
  (note) => notSearchedForms.has(note)
1703
- ) || kf.common === true
1704
- ).map((kf) => kf.kanjiForm)
1928
+ ) || kf.commonness !== void 0
1929
+ ).map((kf) => kf.form)
1705
1930
  ) : void 0;
1706
- const entriesWithFormTitles = entriesWithFormTitlesGlobal.filter(
1707
- (entry) => validWordReadings.has(entry.word)
1708
- );
1709
- const entriesWithForms = entriesWithFormsGlobal.filter(
1710
- (entry) => isValidArray(entry.forms) && (validWordKanjiForms && validWordKanjiForms.has(entry.word) || validWordReadings.has(entry.word)) && entry.forms.some(
1711
- (form) => validWordKanjiForms && validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1712
- )
1713
- );
1714
- for (const ent of validTitleEntries) {
1931
+ const entriesWithTitles = [];
1932
+ const entriesWithFormTitles = [];
1933
+ const entriesWithForms = [];
1934
+ if (poses.size > 0)
1935
+ for (const pos of poses) {
1936
+ const posEntries = posMap.get(pos);
1937
+ if (posEntries) {
1938
+ if (validWordKanjiForms && (posEntries.title || posEntries.form))
1939
+ for (const kf of validWordKanjiForms) {
1940
+ const te = (_a = posEntries.title) == null ? void 0 : _a.get(kf);
1941
+ const fe = (_b = posEntries.form) == null ? void 0 : _b.get(kf);
1942
+ if (te)
1943
+ entriesWithTitles.push(
1944
+ ...te.filter(
1945
+ (ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
1946
+ )
1947
+ );
1948
+ if (fe)
1949
+ entriesWithForms.push(
1950
+ ...fe.filter(
1951
+ (ent) => ent.forms && ent.forms.some(
1952
+ (form) => validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1953
+ )
1954
+ )
1955
+ );
1956
+ }
1957
+ if (posEntries.title || posEntries.formTitle || posEntries.form)
1958
+ for (const r of validWordReadings) {
1959
+ const te = (_c = posEntries.title) == null ? void 0 : _c.get(r);
1960
+ const fe = (_d = posEntries.form) == null ? void 0 : _d.get(r);
1961
+ const fte = (_e = posEntries.formTitle) == null ? void 0 : _e.get(r);
1962
+ if (te)
1963
+ entriesWithTitles.push(
1964
+ ...te.filter(
1965
+ (ent) => ent.forms && validWordKanjiForms && ent.forms.some(
1966
+ (form) => validWordKanjiForms.has(form.form)
1967
+ ) || validWordKanjiForms === void 0
1968
+ )
1969
+ );
1970
+ if (fe)
1971
+ entriesWithForms.push(
1972
+ ...fe.filter(
1973
+ (ent) => ent.forms && ent.forms.some(
1974
+ (form) => validWordKanjiForms && validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1975
+ )
1976
+ )
1977
+ );
1978
+ if (fte) entriesWithFormTitles.push(...fte);
1979
+ }
1980
+ }
1981
+ }
1982
+ if (entriesWithTitles.length === 0 && entriesWithFormTitles.length === 0 && entriesWithForms.length === 0) {
1983
+ if (validWordKanjiForms)
1984
+ for (const kf of validWordKanjiForms) {
1985
+ const te = validTitleEntries.get(kf);
1986
+ const fe = entriesWithFormsGlobal.get(kf);
1987
+ if (te)
1988
+ entriesWithTitles.push(
1989
+ ...te.filter(
1990
+ (ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
1991
+ )
1992
+ );
1993
+ if (fe)
1994
+ entriesWithForms.push(
1995
+ ...fe.filter(
1996
+ (ent) => ent.forms && ent.forms.some(
1997
+ (form) => validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
1998
+ )
1999
+ )
2000
+ );
2001
+ }
2002
+ for (const r of validWordReadings) {
2003
+ const te = validTitleEntries.get(r);
2004
+ const fe = entriesWithFormsGlobal.get(r);
2005
+ const fte = entriesWithFormTitlesGlobal.get(r);
2006
+ if (te)
2007
+ entriesWithTitles.push(
2008
+ ...te.filter(
2009
+ (ent) => ent.forms && validWordKanjiForms && ent.forms.some(
2010
+ (form) => validWordKanjiForms.has(form.form)
2011
+ ) || validWordKanjiForms === void 0
2012
+ )
2013
+ );
2014
+ if (fe)
2015
+ entriesWithForms.push(
2016
+ ...fe.filter(
2017
+ (ent) => ent.forms && ent.forms.some(
2018
+ (form) => validWordKanjiForms && validWordKanjiForms.has(form.form) || validWordReadings.has(form.form)
2019
+ )
2020
+ )
2021
+ );
2022
+ if (fte) entriesWithFormTitles.push(...fte);
2023
+ }
2024
+ }
2025
+ if (entriesWithTitles.length > 0 && (entriesWithFormTitles.length > 0 || entriesWithForms.length > 0))
2026
+ wordEntriesPairs.push({
2027
+ word,
2028
+ readings: validWordReadings,
2029
+ ...validWordKanjiForms ? { kanjiForms: validWordKanjiForms } : {},
2030
+ entriesWithTitles,
2031
+ entriesWithFormTitles,
2032
+ entriesWithForms
2033
+ });
2034
+ }
2035
+ for (const pair of wordEntriesPairs) {
2036
+ const definitions = [];
2037
+ const kanjiFormEntries = [];
2038
+ const readingWithFormsEntries = [];
2039
+ const readingEntries = [];
2040
+ const titleFormMap = /* @__PURE__ */ new Map();
2041
+ const refsMap = /* @__PURE__ */ new Map();
2042
+ const readingForms = /* @__PURE__ */ new Set();
2043
+ for (const ent of pair.entriesWithTitles) {
1715
2044
  const validFormOf = validFormOfEntries.has(ent.word);
1716
2045
  const validGlosses = validGlossesEntries.has(ent.word);
1717
2046
  const validForms = validFormsEntries.has(ent.word);
1718
- if (word.kanjiForms && validWordKanjiForms && validWordKanjiForms.has(ent.word) && (validFormOf || validGlosses || validForms)) {
2047
+ if (pair.kanjiForms && pair.kanjiForms.has(ent.word) && (validFormOf || validGlosses || validForms)) {
1719
2048
  kanjiFormEntries.push(ent);
1720
2049
  if ((validFormOf || validGlosses) && isValidArray(ent.senses))
1721
2050
  for (const sense of ent.senses) {
1722
2051
  if (validFormOf && isValidArray(sense.form_of)) {
1723
2052
  for (const form of sense.form_of)
1724
- if (form.word && typeof form.word === "string" && validWordReadings.has(form.word)) {
2053
+ if (form.word && typeof form.word === "string" && pair.readings.has(form.word)) {
1725
2054
  const elem = titleFormMap.get(
1726
2055
  form.word
1727
2056
  );
@@ -1732,43 +2061,53 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1732
2061
  );
1733
2062
  else elem.add(ent.word);
1734
2063
  }
1735
- } else if (validGlosses && isStringArray(sense.glosses) && sense.glosses.length === 1) {
1736
- const gloss = sense.glosses[0];
1737
- let reading = void 0;
1738
- if (gloss !== void 0) {
1739
- if (gloss.trim().includes("\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u53C2\u7167\u3002")) {
1740
- for (const r of validWordReadings)
1741
- if (gloss.trim().includes(r)) {
1742
- reading = r;
1743
- break;
1744
- }
2064
+ } else if (validGlosses && isStringArray(sense.glosses)) {
2065
+ for (const gloss of sense.glosses) {
2066
+ let reading = void 0;
2067
+ if (gloss !== void 0) {
2068
+ if (gloss.trim().includes("\u306E\u6F22\u5B57\u8868\u8A18\u3002") || gloss.trim().includes("\u3092\u53C2\u7167\u3002")) {
2069
+ for (const r of pair.readings)
2070
+ if (gloss.trim().includes(r)) {
2071
+ reading = r;
2072
+ break;
2073
+ }
2074
+ }
2075
+ }
2076
+ if (reading) {
2077
+ const elem = refsMap.get(reading);
2078
+ if (!elem)
2079
+ refsMap.set(reading, /* @__PURE__ */ new Set([ent.word]));
2080
+ else elem.add(ent.word);
1745
2081
  }
1746
- }
1747
- if (reading) {
1748
- const elem = titleFormMap.get(reading);
1749
- if (!elem)
1750
- titleFormMap.set(reading, /* @__PURE__ */ new Set([ent.word]));
1751
- else elem.add(ent.word);
1752
2082
  }
1753
2083
  }
1754
2084
  }
1755
2085
  if (validForms && isValidArray(ent.forms)) {
1756
2086
  for (const form of ent.forms)
1757
- if (form.form && typeof form.form === "string" && validWordReadings.has(form.form))
2087
+ if (form.form && typeof form.form === "string" && pair.readings.has(form.form))
1758
2088
  readingForms.add(form.form);
1759
2089
  }
1760
- } else if (validWordReadings.has(ent.word) && isValidArray(ent.forms) && word.kanjiForms && validWordKanjiForms && ent.forms.some((form) => validWordKanjiForms.has(form.form)))
2090
+ } else if (pair.readings.has(ent.word) && isValidArray(ent.forms) && pair.kanjiForms && ent.forms.some((form) => pair.kanjiForms.has(form.form)))
1761
2091
  readingWithFormsEntries.push(ent);
1762
- else if (word.kanjiForms === void 0 && validWordReadings.has(ent.word))
2092
+ else if (pair.kanjiForms === void 0 && pair.readings.has(ent.word))
1763
2093
  readingEntries.push(ent);
1764
2094
  }
1765
- for (const entry of entriesWithForms) {
2095
+ for (const entry of pair.entriesWithForms) {
1766
2096
  const elem = titleFormMap.get(entry.word);
1767
2097
  if (elem && entry.forms.some((form) => elem.has(form.form)))
1768
2098
  readingWithFormsEntries.push(entry);
1769
2099
  }
1770
- for (const entry of entriesWithFormTitles)
1771
- if (readingForms.has(entry.word)) readingWithFormsEntries.push(entry);
2100
+ for (const entry of pair.entriesWithFormTitles) {
2101
+ if (readingForms.has(entry.word)) {
2102
+ readingWithFormsEntries.push(entry);
2103
+ continue;
2104
+ }
2105
+ if (pair.kanjiForms) {
2106
+ const ft = refsMap.get(entry.word);
2107
+ if (ft && ft.intersection(pair.kanjiForms).size > 0)
2108
+ readingWithFormsEntries.push(entry);
2109
+ }
2110
+ }
1772
2111
  let parsedReadingWithFormsEntries = false;
1773
2112
  for (const entry of kanjiFormEntries)
1774
2113
  if (entry.pos_title === "\u548C\u8A9E\u306E\u6F22\u5B57\u8868\u8A18" && readingWithFormsEntries.length > 0) {
@@ -1787,7 +2126,7 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1787
2126
  parseEntry(readingEntry, definitions, definitionMap);
1788
2127
  if (definitions.length > 0)
1789
2128
  japaneseDefinitions.push({
1790
- wordID: word.id,
2129
+ wordID: pair.word.id,
1791
2130
  definitions
1792
2131
  });
1793
2132
  }
@@ -1820,9 +2159,7 @@ async function getWordDefinitions(entries, jmDict, kanjiDic, generateFurigana) {
1820
2159
  });
1821
2160
  }
1822
2161
  function lookupWordNote(key, notes, tags, required, fallback) {
1823
- const info = noteMap.get(
1824
- key.toLowerCase()
1825
- );
2162
+ const info = noteMap.get(key.toLowerCase());
1826
2163
  if (!info) {
1827
2164
  if (required) throw new Error(`Invalid note info for ${key}`);
1828
2165
  if (notes) notes.push(fallback != null ? fallback : key);
@@ -1838,6 +2175,7 @@ var wordAddNoteArray = (arr, cb) => {
1838
2175
  for (const v of arr) cb(v);
1839
2176
  };
1840
2177
  function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeName, deckPath) {
2178
+ var _a;
1841
2179
  try {
1842
2180
  if (!dictWord && id && dict)
1843
2181
  dictWord = dict.find((entry) => entry.id === id);
@@ -1861,7 +2199,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
1861
2199
  kanjiForm: dictKanjiForm.form,
1862
2200
  ...dictKanjiForm.notes ? {
1863
2201
  notes: dictKanjiForm.notes.map((note) => {
1864
- var _a;
2202
+ var _a2;
1865
2203
  const noteAndTag = lookupWordNote(
1866
2204
  note,
1867
2205
  void 0,
@@ -1869,7 +2207,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
1869
2207
  false,
1870
2208
  note
1871
2209
  );
1872
- return capitalizeString((_a = noteAndTag.note) != null ? _a : note);
2210
+ return capitalizeString((_a2 = noteAndTag.note) != null ? _a2 : note);
1873
2211
  })
1874
2212
  } : {},
1875
2213
  ...dictKanjiForm.commonness && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
@@ -1883,7 +2221,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
1883
2221
  (restriction) => `Reading restricted to ${restriction}`
1884
2222
  ) : [],
1885
2223
  ...dictReading.notes ? dictReading.notes.map((note) => {
1886
- var _a;
2224
+ var _a2;
1887
2225
  const noteAndTag = lookupWordNote(
1888
2226
  note,
1889
2227
  void 0,
@@ -1891,7 +2229,7 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
1891
2229
  false,
1892
2230
  note
1893
2231
  );
1894
- return capitalizeString((_a = noteAndTag.note) != null ? _a : note);
2232
+ return capitalizeString((_a2 = noteAndTag.note) != null ? _a2 : note);
1895
2233
  }) : []
1896
2234
  ]
1897
2235
  } : {},
@@ -2084,9 +2422,9 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2084
2422
  ];
2085
2423
  if (wordExamples.length > 0) {
2086
2424
  word.phrases = (wordExamples.length > 5 ? wordExamples.slice(0, 5) : wordExamples).map((ex) => {
2087
- var _a;
2425
+ var _a2;
2088
2426
  return {
2089
- phrase: (_a = ex.ex.furigana) != null ? _a : ex.ex.phrase,
2427
+ phrase: (_a2 = ex.ex.furigana) != null ? _a2 : ex.ex.phrase,
2090
2428
  translation: ex.ex.translation,
2091
2429
  originalPhrase: ex.ex.phrase,
2092
2430
  ...ex.ex.glossNumber ? { glossNumber: ex.ex.glossNumber } : {}
@@ -2098,10 +2436,10 @@ function getWord(dict, id, kanjiDic, examples, definitions, dictWord, noteTypeNa
2098
2436
  }
2099
2437
  }
2100
2438
  if (definitions) {
2101
- const pair = definitions.find(
2439
+ const defs = Array.isArray(definitions) ? (_a = definitions.find(
2102
2440
  (wdp) => wdp.wordID === word.id
2103
- );
2104
- if (pair) word.definitions = pair.definitions;
2441
+ )) == null ? void 0 : _a.definitions : definitions.get(word.id);
2442
+ if (defs) word.definitions = defs;
2105
2443
  }
2106
2444
  return word;
2107
2445
  } else throw new Error(`Word${id ? ` ${id}` : ""} not found`);
@@ -2420,7 +2758,7 @@ function generateAnkiNote(entry) {
2420
2758
  (definitionEntry) => {
2421
2759
  var _a;
2422
2760
  return createEntry(
2423
- `<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}>"<span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a = definitionEntry.furigana) != null ? _a : definitionEntry.definition}</span></span>`
2761
+ `<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a = definitionEntry.furigana) != null ? _a : definitionEntry.definition}</span></span>`
2424
2762
  );
2425
2763
  }
2426
2764
  ).join("") : '<span class="word word-definition">(no definitions)</span>',