henkan 2.4.2 → 2.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -101,7 +101,17 @@ var notSearchedForms = /* @__PURE__ */ new Set([
101
101
  "Out-dated kanji form",
102
102
  "out-dated kanji or kanji usage",
103
103
  "word containing out-dated kanji or kanji usage",
104
- "Out-dated kanji or kanji usage"
104
+ "Out-dated kanji or kanji usage",
105
+ "irregular kanji",
106
+ "Irregular kanji form",
107
+ "irregular kanji usage",
108
+ "Irregular kanji usage",
109
+ "word containing irregular kanji usage",
110
+ "irregular okurigana usage",
111
+ "Irregular okurigana usage",
112
+ "irregular kana usage",
113
+ "Irregular kana usage",
114
+ "word containing irregular kana usage"
105
115
  ]);
106
116
  var posList = [
107
117
  "\u540D\u8A5E",
@@ -577,6 +587,10 @@ var noteMap = /* @__PURE__ */ new Map([
577
587
  ["deity", ["deity", "Deity"]],
578
588
  ["document", ["document", "Document"]],
579
589
  ["event", ["event", "Event"]],
590
+ [
591
+ "female given name or forename",
592
+ ["female_given_name_or_forename", "Female given name or forename"]
593
+ ],
580
594
  ["female term, language, or name", ["female_language", "Female language"]],
581
595
  ["fiction", ["fiction", "Fiction"]],
582
596
  [
@@ -585,6 +599,10 @@ var noteMap = /* @__PURE__ */ new Map([
585
599
  ],
586
600
  ["group", ["group", "Group"]],
587
601
  ["legend", ["legend", "Legend"]],
602
+ [
603
+ "male given name or forename",
604
+ ["male_given_name_or_forename", "Male given name or forename"]
605
+ ],
588
606
  ["manga slang", ["manga_slang", "Manga slang"]],
589
607
  ["male term, language, or name", ["male_language", "Male language"]],
590
608
  ["mythology", ["mythology", "Mythology"]],
@@ -1780,44 +1798,34 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
1780
1798
  for (const ex of tanakaExamples)
1781
1799
  for (const part of ex.parts) {
1782
1800
  if (entryParts.has(part.baseForm)) {
1783
- let exList = partExamplesMap.get(
1801
+ const exList = partExamplesMap.get(
1784
1802
  part.baseForm
1785
1803
  );
1786
- if (exList === void 0) {
1787
- exList = [];
1788
- partExamplesMap.set(part.baseForm, exList);
1789
- }
1790
- exList.push(ex);
1804
+ if (exList === void 0) partExamplesMap.set(part.baseForm, [ex]);
1805
+ else exList.push(ex);
1791
1806
  }
1792
1807
  if (part.reading !== void 0 && entryParts.has(part.reading)) {
1793
- let exList = partExamplesMap.get(
1808
+ const exList = partExamplesMap.get(
1794
1809
  part.reading
1795
1810
  );
1796
- if (exList === void 0) {
1797
- exList = [];
1798
- partExamplesMap.set(part.reading, exList);
1799
- }
1800
- exList.push(ex);
1811
+ if (exList === void 0) partExamplesMap.set(part.reading, [ex]);
1812
+ else exList.push(ex);
1801
1813
  }
1802
1814
  if (part.inflectedForm !== void 0 && entryParts.has(part.inflectedForm)) {
1803
- let exList = partExamplesMap.get(
1815
+ const exList = partExamplesMap.get(
1804
1816
  part.inflectedForm
1805
1817
  );
1806
- if (exList === void 0) {
1807
- exList = [];
1808
- partExamplesMap.set(part.inflectedForm, exList);
1809
- }
1810
- exList.push(ex);
1818
+ if (exList === void 0)
1819
+ partExamplesMap.set(part.inflectedForm, [ex]);
1820
+ else exList.push(ex);
1811
1821
  }
1812
1822
  if (part.referenceID !== void 0 && entryParts.has(part.referenceID)) {
1813
- let exList = partExamplesMap.get(
1823
+ const exList = partExamplesMap.get(
1814
1824
  part.referenceID
1815
1825
  );
1816
- if (exList === void 0) {
1817
- exList = [];
1818
- partExamplesMap.set(part.referenceID, exList);
1819
- }
1820
- exList.push(ex);
1826
+ if (exList === void 0)
1827
+ partExamplesMap.set(part.referenceID, [ex]);
1828
+ else exList.push(ex);
1821
1829
  }
1822
1830
  }
1823
1831
  for (const word of jmDict) {
@@ -2611,8 +2619,8 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
2611
2619
  const readingAsReadingMatch = part.reading !== void 0 && readings.has(part.reading);
2612
2620
  const readingAsInflectedFormMatch = part.inflectedForm !== void 0 && readings.has(part.inflectedForm);
2613
2621
  const referenceIDMatch = part.referenceID === dictWord.id;
2614
- if (kanjiForms !== void 0 && kanjiForms.has(part.baseForm) || referenceIDMatch) {
2615
- if (readingAsReadingMatch || readingAsInflectedFormMatch) {
2622
+ if (kanjiForms !== void 0 && kanjiForms.has(part.baseForm)) {
2623
+ if (readingAsReadingMatch || readingAsInflectedFormMatch || referenceIDMatch) {
2616
2624
  readingMatchingKanjiFormExamples.push({
2617
2625
  ex: example,
2618
2626
  partIndex: i
@@ -2628,7 +2636,7 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
2628
2636
  break;
2629
2637
  }
2630
2638
  const readingAsBaseFormMatch = readings.has(part.baseForm);
2631
- if (readingAsBaseFormMatch && kanjiForms === void 0) {
2639
+ if ((readingAsBaseFormMatch || referenceIDMatch) && kanjiForms === void 0) {
2632
2640
  readingExamples.push({ ex: example, partIndex: i });
2633
2641
  seenPhrases.add(example.phrase);
2634
2642
  break;
@@ -2733,6 +2741,17 @@ function generateAnkiNote(entry) {
2733
2741
  )
2734
2742
  ).join("")}</details>` : "";
2735
2743
  const readingsField = `${firstReading}${otherReadings}`;
2744
+ const firstReadingWithoutAudio = createEntry(
2745
+ `<span class="word word-reading">${entry.readings[0].reading}</span>`,
2746
+ entry.readings[0].notes
2747
+ );
2748
+ const otherReadingsWithoutAudio = entry.readings.length > 1 ? `<details><summary>Show other readings</summary>${entry.readings.slice(1).map(
2749
+ (readingEntry) => createEntry(
2750
+ `<span class="word word-reading">${readingEntry.reading}</span>`,
2751
+ readingEntry.notes
2752
+ )
2753
+ ).join("")}</details>` : "";
2754
+ const readingsFieldWithoutAudio = `${firstReadingWithoutAudio}${otherReadingsWithoutAudio}`;
2736
2755
  const firstKanjiForm = entry.kanjiForms !== void 0 ? createEntry(
2737
2756
  `<span class="word word-kanjiform"><ruby><rb>${entry.kanjiForms[0].kanjiForm}</rb><rt>${entry.readings[0].reading}</rt></ruby></span>`,
2738
2757
  entry.kanjiForms[0].notes
@@ -2804,8 +2823,13 @@ function generateAnkiNote(entry) {
2804
2823
  ) : "null"
2805
2824
  ).filter((definition) => definition !== "null").join("")}</details>` : "";
2806
2825
  const definitionsField = firstThreeDefinitions !== void 0 ? `${firstThreeDefinitions}${otherDefinitions}` : '<span class="word word-definition">(no definitions)</span>';
2826
+ const searchField = [
2827
+ entry.readings.map((r) => r.reading),
2828
+ entry.kanjiForms?.map((kf) => kf.kanjiForm) ?? []
2829
+ ].join(" ");
2807
2830
  fields.push(
2808
- ...entry.kanjiForms !== void 0 && !entry.usuallyInKana ? [kanjiFormsField, readingsField] : [readingsField, kanjiFormsField],
2831
+ ...entry.kanjiForms !== void 0 && !entry.usuallyInKana ? [kanjiFormsField, readingsFieldWithoutAudio] : [readingsFieldWithoutAudio, kanjiFormsField],
2832
+ readingsField,
2809
2833
  translationsField,
2810
2834
  phrasesField,
2811
2835
  definitionsField,
@@ -2815,6 +2839,7 @@ function generateAnkiNote(entry) {
2815
2839
  kanjiEntry.meanings
2816
2840
  )
2817
2841
  ).join("") : '<span class="word word-kanji">(no kanji)</span>',
2842
+ searchField,
2818
2843
  ...entry.tags !== void 0 && entry.tags.length > 0 ? [
2819
2844
  entry.tags.map(
2820
2845
  (tag) => tag.trim().toLowerCase().replaceAll(" ", "::")