henkan 0.1.2 → 0.1.3
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 +19 -14
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +19 -14
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/capitalizeString.md +1 -1
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertKanjiDic.md +1 -1
- package/docs/api/functions/convertKradFile.md +1 -1
- package/docs/api/functions/convertRadkFile.md +1 -1
- package/docs/api/functions/convertTanakaCorpus.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/isStringArray.md +1 -1
- package/docs/api/functions/isValidArray.md +1 -1
- package/docs/api/functions/isValidArrayWithFirstElement.md +1 -1
- package/docs/api/functions/makeSSML.md +1 -1
- package/docs/api/functions/shuffleArray.md +1 -1
- package/docs/api/functions/synthesizeSpeech.md +1 -1
- package/docs/api/interfaces/DictKanji.md +4 -4
- package/docs/api/interfaces/DictKanjiForm.md +4 -4
- package/docs/api/interfaces/DictKanjiMisc.md +5 -5
- package/docs/api/interfaces/DictKanjiReading.md +3 -3
- package/docs/api/interfaces/DictKanjiReadingMeaning.md +3 -3
- package/docs/api/interfaces/DictKanjiReadingMeaningGroup.md +3 -3
- package/docs/api/interfaces/DictKanjiWithRadicals.md +3 -3
- package/docs/api/interfaces/DictMeaning.md +11 -11
- package/docs/api/interfaces/DictRadical.md +4 -4
- package/docs/api/interfaces/DictReading.md +5 -5
- package/docs/api/interfaces/DictWord.md +7 -7
- package/docs/api/interfaces/ExamplePart.md +7 -7
- package/docs/api/interfaces/Grammar.md +15 -15
- package/docs/api/interfaces/GrammarMeaning.md +3 -3
- package/docs/api/interfaces/Kana.md +11 -11
- package/docs/api/interfaces/Kanji.md +21 -21
- package/docs/api/interfaces/KanjiComponent.md +3 -3
- package/docs/api/interfaces/KanjiForm.md +3 -3
- package/docs/api/interfaces/Phrase.md +4 -4
- package/docs/api/interfaces/Radical.md +16 -16
- package/docs/api/interfaces/Reading.md +4 -4
- package/docs/api/interfaces/ResultEntry.md +7 -7
- package/docs/api/interfaces/TanakaExample.md +5 -5
- package/docs/api/interfaces/Translation.md +3 -3
- package/docs/api/interfaces/UsefulRegExps.md +9 -9
- package/docs/api/interfaces/Word.md +14 -14
- package/docs/api/type-aliases/Dict.md +1 -1
- package/docs/api/type-aliases/DictName.md +1 -1
- package/docs/api/type-aliases/EntryType.md +1 -1
- package/docs/api/type-aliases/JLPT.md +1 -1
- package/docs/api/type-aliases/Result.md +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1160,6 +1160,13 @@ function convertJMdict(xmlString, examples) {
|
|
|
1160
1160
|
const dict = [];
|
|
1161
1161
|
xml.parseString(dictParsed, (err, result) => {
|
|
1162
1162
|
if (err) throw err;
|
|
1163
|
+
let tanakaBaseParts = void 0;
|
|
1164
|
+
if (examples)
|
|
1165
|
+
tanakaBaseParts = new Set(
|
|
1166
|
+
examples.map(
|
|
1167
|
+
(example) => example.parts.map((part) => part.baseForm)
|
|
1168
|
+
).flat()
|
|
1169
|
+
);
|
|
1163
1170
|
if (result.JMdict && typeof result.JMdict === "object" && isValidArray(result.JMdict.entry))
|
|
1164
1171
|
for (const entry of result.JMdict.entry) {
|
|
1165
1172
|
const entryObj = {
|
|
@@ -1255,21 +1262,19 @@ function convertJMdict(xmlString, examples) {
|
|
|
1255
1262
|
) : void 0;
|
|
1256
1263
|
let kanjiFormExamples = false;
|
|
1257
1264
|
let readingExamples = false;
|
|
1258
|
-
if (kanjiForms2) {
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
}
|
|
1265
|
+
if (kanjiForms2 && kanjiForms2.size > 0 && tanakaBaseParts) {
|
|
1266
|
+
for (const kf of kanjiForms2)
|
|
1267
|
+
if (tanakaBaseParts.has(kf)) {
|
|
1268
|
+
kanjiFormExamples = true;
|
|
1269
|
+
break;
|
|
1270
|
+
}
|
|
1265
1271
|
}
|
|
1266
|
-
if (!kanjiFormExamples) {
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
}
|
|
1272
|
+
if (!kanjiFormExamples && readings2.size > 0 && tanakaBaseParts) {
|
|
1273
|
+
for (const r of readings2)
|
|
1274
|
+
if (tanakaBaseParts.has(r)) {
|
|
1275
|
+
readingExamples = true;
|
|
1276
|
+
break;
|
|
1277
|
+
}
|
|
1273
1278
|
}
|
|
1274
1279
|
if (kanjiFormExamples || readingExamples)
|
|
1275
1280
|
entryObj.hasPhrases = true;
|