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 +54 -29
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +54 -29
- package/dist/index.mjs.map +2 -2
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/convertJawiktionaryAsync.md +1 -1
- package/docs/api/functions/convertJawiktionarySync.md +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getKanji.md +1 -1
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getWord.md +1 -1
- package/docs/api/functions/getWordDefinitions.md +1 -1
- package/docs/api/functions/getWordDefinitionsWithFurigana.md +1 -1
- package/package.json +11 -7
- package/src/constants.ts +18 -0
- package/src/utils.ts +51 -32
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,17 @@ var notSearchedForms = /* @__PURE__ */ new Set([
|
|
|
38
38
|
"Out-dated kanji form",
|
|
39
39
|
"out-dated kanji or kanji usage",
|
|
40
40
|
"word containing out-dated kanji or kanji usage",
|
|
41
|
-
"Out-dated kanji or kanji usage"
|
|
41
|
+
"Out-dated kanji or kanji usage",
|
|
42
|
+
"irregular kanji",
|
|
43
|
+
"Irregular kanji form",
|
|
44
|
+
"irregular kanji usage",
|
|
45
|
+
"Irregular kanji usage",
|
|
46
|
+
"word containing irregular kanji usage",
|
|
47
|
+
"irregular okurigana usage",
|
|
48
|
+
"Irregular okurigana usage",
|
|
49
|
+
"irregular kana usage",
|
|
50
|
+
"Irregular kana usage",
|
|
51
|
+
"word containing irregular kana usage"
|
|
42
52
|
]);
|
|
43
53
|
var posList = [
|
|
44
54
|
"\u540D\u8A5E",
|
|
@@ -514,6 +524,10 @@ var noteMap = /* @__PURE__ */ new Map([
|
|
|
514
524
|
["deity", ["deity", "Deity"]],
|
|
515
525
|
["document", ["document", "Document"]],
|
|
516
526
|
["event", ["event", "Event"]],
|
|
527
|
+
[
|
|
528
|
+
"female given name or forename",
|
|
529
|
+
["female_given_name_or_forename", "Female given name or forename"]
|
|
530
|
+
],
|
|
517
531
|
["female term, language, or name", ["female_language", "Female language"]],
|
|
518
532
|
["fiction", ["fiction", "Fiction"]],
|
|
519
533
|
[
|
|
@@ -522,6 +536,10 @@ var noteMap = /* @__PURE__ */ new Map([
|
|
|
522
536
|
],
|
|
523
537
|
["group", ["group", "Group"]],
|
|
524
538
|
["legend", ["legend", "Legend"]],
|
|
539
|
+
[
|
|
540
|
+
"male given name or forename",
|
|
541
|
+
["male_given_name_or_forename", "Male given name or forename"]
|
|
542
|
+
],
|
|
525
543
|
["manga slang", ["manga_slang", "Manga slang"]],
|
|
526
544
|
["male term, language, or name", ["male_language", "Male language"]],
|
|
527
545
|
["mythology", ["mythology", "Mythology"]],
|
|
@@ -1717,44 +1735,34 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
|
|
|
1717
1735
|
for (const ex of tanakaExamples)
|
|
1718
1736
|
for (const part of ex.parts) {
|
|
1719
1737
|
if (entryParts.has(part.baseForm)) {
|
|
1720
|
-
|
|
1738
|
+
const exList = partExamplesMap.get(
|
|
1721
1739
|
part.baseForm
|
|
1722
1740
|
);
|
|
1723
|
-
if (exList === void 0)
|
|
1724
|
-
|
|
1725
|
-
partExamplesMap.set(part.baseForm, exList);
|
|
1726
|
-
}
|
|
1727
|
-
exList.push(ex);
|
|
1741
|
+
if (exList === void 0) partExamplesMap.set(part.baseForm, [ex]);
|
|
1742
|
+
else exList.push(ex);
|
|
1728
1743
|
}
|
|
1729
1744
|
if (part.reading !== void 0 && entryParts.has(part.reading)) {
|
|
1730
|
-
|
|
1745
|
+
const exList = partExamplesMap.get(
|
|
1731
1746
|
part.reading
|
|
1732
1747
|
);
|
|
1733
|
-
if (exList === void 0)
|
|
1734
|
-
|
|
1735
|
-
partExamplesMap.set(part.reading, exList);
|
|
1736
|
-
}
|
|
1737
|
-
exList.push(ex);
|
|
1748
|
+
if (exList === void 0) partExamplesMap.set(part.reading, [ex]);
|
|
1749
|
+
else exList.push(ex);
|
|
1738
1750
|
}
|
|
1739
1751
|
if (part.inflectedForm !== void 0 && entryParts.has(part.inflectedForm)) {
|
|
1740
|
-
|
|
1752
|
+
const exList = partExamplesMap.get(
|
|
1741
1753
|
part.inflectedForm
|
|
1742
1754
|
);
|
|
1743
|
-
if (exList === void 0)
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
}
|
|
1747
|
-
exList.push(ex);
|
|
1755
|
+
if (exList === void 0)
|
|
1756
|
+
partExamplesMap.set(part.inflectedForm, [ex]);
|
|
1757
|
+
else exList.push(ex);
|
|
1748
1758
|
}
|
|
1749
1759
|
if (part.referenceID !== void 0 && entryParts.has(part.referenceID)) {
|
|
1750
|
-
|
|
1760
|
+
const exList = partExamplesMap.get(
|
|
1751
1761
|
part.referenceID
|
|
1752
1762
|
);
|
|
1753
|
-
if (exList === void 0)
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
}
|
|
1757
|
-
exList.push(ex);
|
|
1763
|
+
if (exList === void 0)
|
|
1764
|
+
partExamplesMap.set(part.referenceID, [ex]);
|
|
1765
|
+
else exList.push(ex);
|
|
1758
1766
|
}
|
|
1759
1767
|
}
|
|
1760
1768
|
for (const word of jmDict) {
|
|
@@ -2548,8 +2556,8 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
|
|
|
2548
2556
|
const readingAsReadingMatch = part.reading !== void 0 && readings.has(part.reading);
|
|
2549
2557
|
const readingAsInflectedFormMatch = part.inflectedForm !== void 0 && readings.has(part.inflectedForm);
|
|
2550
2558
|
const referenceIDMatch = part.referenceID === dictWord.id;
|
|
2551
|
-
if (kanjiForms !== void 0 && kanjiForms.has(part.baseForm)
|
|
2552
|
-
if (readingAsReadingMatch || readingAsInflectedFormMatch) {
|
|
2559
|
+
if (kanjiForms !== void 0 && kanjiForms.has(part.baseForm)) {
|
|
2560
|
+
if (readingAsReadingMatch || readingAsInflectedFormMatch || referenceIDMatch) {
|
|
2553
2561
|
readingMatchingKanjiFormExamples.push({
|
|
2554
2562
|
ex: example,
|
|
2555
2563
|
partIndex: i
|
|
@@ -2565,7 +2573,7 @@ function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeNa
|
|
|
2565
2573
|
break;
|
|
2566
2574
|
}
|
|
2567
2575
|
const readingAsBaseFormMatch = readings.has(part.baseForm);
|
|
2568
|
-
if (readingAsBaseFormMatch && kanjiForms === void 0) {
|
|
2576
|
+
if ((readingAsBaseFormMatch || referenceIDMatch) && kanjiForms === void 0) {
|
|
2569
2577
|
readingExamples.push({ ex: example, partIndex: i });
|
|
2570
2578
|
seenPhrases.add(example.phrase);
|
|
2571
2579
|
break;
|
|
@@ -2670,6 +2678,17 @@ function generateAnkiNote(entry) {
|
|
|
2670
2678
|
)
|
|
2671
2679
|
).join("")}</details>` : "";
|
|
2672
2680
|
const readingsField = `${firstReading}${otherReadings}`;
|
|
2681
|
+
const firstReadingWithoutAudio = createEntry(
|
|
2682
|
+
`<span class="word word-reading">${entry.readings[0].reading}</span>`,
|
|
2683
|
+
entry.readings[0].notes
|
|
2684
|
+
);
|
|
2685
|
+
const otherReadingsWithoutAudio = entry.readings.length > 1 ? `<details><summary>Show other readings</summary>${entry.readings.slice(1).map(
|
|
2686
|
+
(readingEntry) => createEntry(
|
|
2687
|
+
`<span class="word word-reading">${readingEntry.reading}</span>`,
|
|
2688
|
+
readingEntry.notes
|
|
2689
|
+
)
|
|
2690
|
+
).join("")}</details>` : "";
|
|
2691
|
+
const readingsFieldWithoutAudio = `${firstReadingWithoutAudio}${otherReadingsWithoutAudio}`;
|
|
2673
2692
|
const firstKanjiForm = entry.kanjiForms !== void 0 ? createEntry(
|
|
2674
2693
|
`<span class="word word-kanjiform"><ruby><rb>${entry.kanjiForms[0].kanjiForm}</rb><rt>${entry.readings[0].reading}</rt></ruby></span>`,
|
|
2675
2694
|
entry.kanjiForms[0].notes
|
|
@@ -2741,8 +2760,13 @@ function generateAnkiNote(entry) {
|
|
|
2741
2760
|
) : "null"
|
|
2742
2761
|
).filter((definition) => definition !== "null").join("")}</details>` : "";
|
|
2743
2762
|
const definitionsField = firstThreeDefinitions !== void 0 ? `${firstThreeDefinitions}${otherDefinitions}` : '<span class="word word-definition">(no definitions)</span>';
|
|
2763
|
+
const searchField = [
|
|
2764
|
+
entry.readings.map((r) => r.reading),
|
|
2765
|
+
entry.kanjiForms?.map((kf) => kf.kanjiForm) ?? []
|
|
2766
|
+
].join(" ");
|
|
2744
2767
|
fields.push(
|
|
2745
|
-
...entry.kanjiForms !== void 0 && !entry.usuallyInKana ? [kanjiFormsField,
|
|
2768
|
+
...entry.kanjiForms !== void 0 && !entry.usuallyInKana ? [kanjiFormsField, readingsFieldWithoutAudio] : [readingsFieldWithoutAudio, kanjiFormsField],
|
|
2769
|
+
readingsField,
|
|
2746
2770
|
translationsField,
|
|
2747
2771
|
phrasesField,
|
|
2748
2772
|
definitionsField,
|
|
@@ -2752,6 +2776,7 @@ function generateAnkiNote(entry) {
|
|
|
2752
2776
|
kanjiEntry.meanings
|
|
2753
2777
|
)
|
|
2754
2778
|
).join("") : '<span class="word word-kanji">(no kanji)</span>',
|
|
2779
|
+
searchField,
|
|
2755
2780
|
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2756
2781
|
entry.tags.map(
|
|
2757
2782
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|