henkan 2.2.4 → 2.3.0
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 +671 -592
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +659 -589
- package/dist/index.mjs.map +3 -3
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/types.d.ts +22 -12
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +34 -22
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/README.md +2 -0
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertJawiktionaryAsync.md +1 -1
- package/docs/api/functions/convertJawiktionarySync.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/convertTanakaCorpusWithFurigana.md +1 -1
- package/docs/api/functions/createEntryMaps.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 +4 -4
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getValidForms.md +1 -1
- package/docs/api/functions/getWord.md +4 -4
- package/docs/api/functions/getWordDefinitions.md +4 -4
- package/docs/api/functions/getWordDefinitionsWithFurigana.md +1 -1
- package/docs/api/functions/hiraganaToKatakana.md +27 -0
- package/docs/api/functions/katakanaToHiragana.md +27 -0
- package/docs/api/interfaces/DefaultNoteInfo.md +4 -4
- package/docs/api/interfaces/Definition.md +6 -2
- package/docs/api/interfaces/DictKanjiMisc.md +1 -1
- package/docs/api/interfaces/DictWord.md +3 -3
- package/docs/api/interfaces/Grammar.md +16 -16
- package/docs/api/interfaces/GrammarMeaning.md +3 -3
- package/docs/api/interfaces/JaWiktionaryEntry.md +2 -2
- package/docs/api/interfaces/Kana.md +11 -11
- package/docs/api/interfaces/Kanji.md +24 -24
- package/docs/api/interfaces/KanjiComponent.md +3 -3
- package/docs/api/interfaces/KanjiForm.md +4 -4
- package/docs/api/interfaces/NoteAndTag.md +3 -3
- package/docs/api/interfaces/NoteHeaderKeys.md +7 -7
- package/docs/api/interfaces/Phrase.md +5 -5
- package/docs/api/interfaces/Radical.md +16 -16
- package/docs/api/interfaces/Reading.md +5 -5
- package/docs/api/interfaces/ResultEntry.md +10 -10
- package/docs/api/interfaces/Translation.md +3 -3
- package/docs/api/interfaces/UsefulRegExps.md +8 -8
- package/docs/api/interfaces/Word.md +15 -15
- package/docs/api/interfaces/WordDefinitionPair.md +15 -3
- package/docs/api/type-aliases/Dict.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 +7 -4
- package/src/constants.ts +1225 -0
- package/src/index.ts +3 -0
- package/src/types.ts +1056 -0
- package/src/utils.ts +3018 -0
package/dist/index.cjs.js
CHANGED
|
@@ -48,6 +48,7 @@ __export(index_exports, {
|
|
|
48
48
|
getWord: () => getWord,
|
|
49
49
|
getWordDefinitions: () => getWordDefinitions,
|
|
50
50
|
getWordDefinitionsWithFurigana: () => getWordDefinitionsWithFurigana,
|
|
51
|
+
hiraganaToKatakana: () => hiraganaToKatakana,
|
|
51
52
|
isGrammar: () => isGrammar,
|
|
52
53
|
isKana: () => isKana,
|
|
53
54
|
isKanji: () => isKanji,
|
|
@@ -56,9 +57,11 @@ __export(index_exports, {
|
|
|
56
57
|
isStringArray: () => isStringArray,
|
|
57
58
|
isValidArrayWithFirstElement: () => isValidArrayWithFirstElement,
|
|
58
59
|
isWord: () => isWord,
|
|
60
|
+
katakanaToHiragana: () => katakanaToHiragana,
|
|
59
61
|
notSearchedForms: () => notSearchedForms,
|
|
60
62
|
noteHeaderKeys: () => noteHeaderKeys,
|
|
61
63
|
noteMap: () => noteMap,
|
|
64
|
+
posList: () => posList,
|
|
62
65
|
regexps: () => regexps,
|
|
63
66
|
shuffleArray: () => shuffleArray
|
|
64
67
|
});
|
|
@@ -99,6 +102,43 @@ var notSearchedForms = /* @__PURE__ */ new Set([
|
|
|
99
102
|
"word containing out-dated kanji or kanji usage",
|
|
100
103
|
"Out-dated kanji or kanji usage"
|
|
101
104
|
]);
|
|
105
|
+
var posList = [
|
|
106
|
+
"\u540D\u8A5E",
|
|
107
|
+
"\u52D5\u8A5E",
|
|
108
|
+
"\u6210\u53E5",
|
|
109
|
+
"\u526F\u8A5E",
|
|
110
|
+
"\u5F62\u5BB9\u52D5\u8A5E",
|
|
111
|
+
"\u52A9\u8A5E",
|
|
112
|
+
"\u611F\u52D5\u8A5E",
|
|
113
|
+
"\u4EE3\u540D\u8A5E",
|
|
114
|
+
"\u63A5\u5C3E\u8F9E",
|
|
115
|
+
"\u63A5\u982D\u8A9E",
|
|
116
|
+
"\u9020\u8A9E\u6210\u5206",
|
|
117
|
+
"\u7565\u8A9E",
|
|
118
|
+
"\u56FA\u6709\u540D\u8A5E",
|
|
119
|
+
"\u4EBA\u79F0\u4EE3\u540D\u8A5E",
|
|
120
|
+
"\u63A5\u982D\u8F9E",
|
|
121
|
+
"\u63A5\u7D9A\u52A9\u8A5E",
|
|
122
|
+
"\u9593\u6295\u8A5E",
|
|
123
|
+
"\u52A9\u52D5\u8A5E",
|
|
124
|
+
"\u5F62\u5BB9\u8A5E",
|
|
125
|
+
"\u7E2E\u7D04\u5F62",
|
|
126
|
+
"\u63A5\u8F9E",
|
|
127
|
+
"\u63A5\u7D9A\u8A5E",
|
|
128
|
+
"\u9023\u4F53\u8A5E",
|
|
129
|
+
"\u4EBA\u540D",
|
|
130
|
+
"\u8A18\u53F7",
|
|
131
|
+
"\u6570\u8A5E",
|
|
132
|
+
"\u6163\u7528\u53E5",
|
|
133
|
+
"\u3053\u3068\u308F\u3056",
|
|
134
|
+
"\u52A9\u6570\u8A5E",
|
|
135
|
+
"\u82F1\u6570\u5B57\u6DF7\u5408\u8868\u8A18",
|
|
136
|
+
"\u52D5\u8A5E\u53E5",
|
|
137
|
+
"\u6210\u8A9E",
|
|
138
|
+
"\u610F\u7FA9",
|
|
139
|
+
"\u982D\u5B57\u8A9E",
|
|
140
|
+
"\u63A5\u5C3E\u8A9E"
|
|
141
|
+
];
|
|
102
142
|
var noteMap = /* @__PURE__ */ new Map([
|
|
103
143
|
["brazilian", ["dialect::brazilian", "Dialect: Brazilian"]],
|
|
104
144
|
["hokkaido-ben", ["dialect::hokkaido-ben", "Dialect: Hokkaid\u014D-ben"]],
|
|
@@ -1242,10 +1282,10 @@ var noteMap = /* @__PURE__ */ new Map([
|
|
|
1242
1282
|
]);
|
|
1243
1283
|
|
|
1244
1284
|
// src/utils.ts
|
|
1285
|
+
var import_readline = require("readline");
|
|
1245
1286
|
var import_libxmljs2 = __toESM(require("libxmljs2"));
|
|
1246
1287
|
var import_xml2js = __toESM(require("xml2js"));
|
|
1247
1288
|
var import_iconv_lite = __toESM(require("iconv-lite"));
|
|
1248
|
-
var import_readline = require("readline");
|
|
1249
1289
|
var Kuroshiro = require("kuroshiro");
|
|
1250
1290
|
var KuromojiAnalyzer = require("kuroshiro-analyzer-kuromoji");
|
|
1251
1291
|
function capitalizeString(value) {
|
|
@@ -1261,7 +1301,7 @@ function isObjectArray(arg) {
|
|
|
1261
1301
|
return isValidArrayWithFirstElement(arg) && arg.every((element) => typeof element === "object");
|
|
1262
1302
|
}
|
|
1263
1303
|
function shuffleArray(arr) {
|
|
1264
|
-
const a =
|
|
1304
|
+
const a = Array.from(arr);
|
|
1265
1305
|
for (let i = a.length - 1; i > 0; i--) {
|
|
1266
1306
|
const j = Math.floor(Math.random() * (i + 1));
|
|
1267
1307
|
const tmp = a[i];
|
|
@@ -1270,13 +1310,43 @@ function shuffleArray(arr) {
|
|
|
1270
1310
|
}
|
|
1271
1311
|
return a;
|
|
1272
1312
|
}
|
|
1313
|
+
function hiraganaToKatakana(input) {
|
|
1314
|
+
const decomposed = input.normalize("NFD");
|
|
1315
|
+
const output = [];
|
|
1316
|
+
for (const ch of decomposed.split("")) {
|
|
1317
|
+
const cp = ch.codePointAt(0);
|
|
1318
|
+
if (cp === 12441 || cp === 12442) {
|
|
1319
|
+
output.push(ch);
|
|
1320
|
+
continue;
|
|
1321
|
+
}
|
|
1322
|
+
if (cp >= 12352 && cp <= 12447)
|
|
1323
|
+
output.push(String.fromCodePoint(cp + 96));
|
|
1324
|
+
else output.push(ch);
|
|
1325
|
+
}
|
|
1326
|
+
return output.join("").normalize("NFC");
|
|
1327
|
+
}
|
|
1328
|
+
function katakanaToHiragana(input) {
|
|
1329
|
+
const decomposed = input.normalize("NFD");
|
|
1330
|
+
const output = [];
|
|
1331
|
+
for (const ch of decomposed.split("")) {
|
|
1332
|
+
const cp = ch.codePointAt(0);
|
|
1333
|
+
if (cp === 12441 || cp === 12442) {
|
|
1334
|
+
output.push(ch);
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1337
|
+
if (cp >= 12448 && cp <= 12543)
|
|
1338
|
+
output.push(String.fromCodePoint(cp - 96));
|
|
1339
|
+
else output.push(ch);
|
|
1340
|
+
}
|
|
1341
|
+
return output.join("").normalize("NFC");
|
|
1342
|
+
}
|
|
1273
1343
|
function getValidForms(readings, kanjiForms, wordIsCommon) {
|
|
1274
1344
|
const kanjiFormRestrictions = /* @__PURE__ */ new Set();
|
|
1275
1345
|
const validReadings = readings.filter(
|
|
1276
1346
|
(reading, index) => {
|
|
1277
1347
|
if (index === 0) return true;
|
|
1278
1348
|
if (reading.notes === void 0 || !reading.notes.some((note) => notSearchedForms.has(note))) {
|
|
1279
|
-
if (reading.kanjiFormRestrictions) {
|
|
1349
|
+
if (reading.kanjiFormRestrictions !== void 0) {
|
|
1280
1350
|
for (const kfr of reading.kanjiFormRestrictions)
|
|
1281
1351
|
kanjiFormRestrictions.add(kfr);
|
|
1282
1352
|
return true;
|
|
@@ -1287,20 +1357,22 @@ function getValidForms(readings, kanjiForms, wordIsCommon) {
|
|
|
1287
1357
|
return false;
|
|
1288
1358
|
}
|
|
1289
1359
|
);
|
|
1290
|
-
const existValidKf = kanjiForms
|
|
1291
|
-
(kf, index) => index !== 0 && (
|
|
1292
|
-
)
|
|
1293
|
-
const validKanjiForms = kanjiForms
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1360
|
+
const existValidKf = kanjiForms == null ? void 0 : kanjiForms.some(
|
|
1361
|
+
(kf, index) => index !== 0 && (kf.notes === void 0 || !kf.notes.some((note) => notSearchedForms.has(note)) && (wordIsCommon === void 0 || kf.commonness !== void 0) || kanjiFormRestrictions.has(kf.form))
|
|
1362
|
+
);
|
|
1363
|
+
const validKanjiForms = kanjiForms == null ? void 0 : kanjiForms.filter(
|
|
1364
|
+
(kanjiForm, index) => {
|
|
1365
|
+
if (index === 0) return true;
|
|
1366
|
+
if (existValidKf === true)
|
|
1367
|
+
return kanjiForm.notes === void 0 || !kanjiForm.notes.some(
|
|
1368
|
+
(note) => notSearchedForms.has(note)
|
|
1369
|
+
) && (wordIsCommon === void 0 || kanjiForm.commonness !== void 0) || kanjiFormRestrictions.has(kanjiForm.form);
|
|
1370
|
+
else return true;
|
|
1371
|
+
}
|
|
1372
|
+
);
|
|
1301
1373
|
return {
|
|
1302
1374
|
readings: validReadings,
|
|
1303
|
-
...validKanjiForms ? { kanjiForms: validKanjiForms } : {}
|
|
1375
|
+
...validKanjiForms !== void 0 ? { kanjiForms: validKanjiForms } : {}
|
|
1304
1376
|
};
|
|
1305
1377
|
}
|
|
1306
1378
|
function convertJMdict(xmlString, examples) {
|
|
@@ -1312,13 +1384,13 @@ function convertJMdict(xmlString, examples) {
|
|
|
1312
1384
|
});
|
|
1313
1385
|
const dict = [];
|
|
1314
1386
|
import_xml2js.default.parseString(dictParsed, (_err, result) => {
|
|
1315
|
-
const tanakaParts = examples && examples.length > 0 ? new Set(
|
|
1387
|
+
const tanakaParts = examples !== void 0 && examples.length > 0 ? new Set(
|
|
1316
1388
|
examples.flatMap(
|
|
1317
1389
|
(example) => example.parts.flatMap((part) => [
|
|
1318
1390
|
part.baseForm,
|
|
1319
|
-
...part.reading ? [part.reading] : [],
|
|
1320
|
-
...part.inflectedForm ? [part.inflectedForm] : [],
|
|
1321
|
-
...part.referenceID ? [part.referenceID] : []
|
|
1391
|
+
...part.reading !== void 0 ? [part.reading] : [],
|
|
1392
|
+
...part.inflectedForm !== void 0 ? [part.inflectedForm] : [],
|
|
1393
|
+
...part.referenceID !== void 0 ? [part.referenceID] : []
|
|
1322
1394
|
])
|
|
1323
1395
|
)
|
|
1324
1396
|
) : void 0;
|
|
@@ -1365,7 +1437,7 @@ function convertJMdict(xmlString, examples) {
|
|
|
1365
1437
|
meaningObj.translations = [];
|
|
1366
1438
|
for (const gloss of meaning.gloss)
|
|
1367
1439
|
if (typeof gloss === "string") meaningObj.translations.push(gloss);
|
|
1368
|
-
else if (typeof gloss === "object" &&
|
|
1440
|
+
else if (typeof gloss === "object" && typeof gloss._ === "string" && typeof gloss.$ === "object" && (gloss.$.g_type === "lit" || gloss.$.g_type === "expl" || gloss.$.g_type === "tm"))
|
|
1369
1441
|
meaningObj.translations.push({
|
|
1370
1442
|
translation: gloss._,
|
|
1371
1443
|
type: gloss.$.g_type
|
|
@@ -1380,7 +1452,7 @@ function convertJMdict(xmlString, examples) {
|
|
|
1380
1452
|
if (isStringArray(meaning.s_inf)) meaningObj.info = meaning.s_inf;
|
|
1381
1453
|
if (isStringArray(meaning.misc)) {
|
|
1382
1454
|
meaningObj.misc = meaning.misc;
|
|
1383
|
-
if (meaningObj.misc && meaningObj.misc.includes("word usually written using kana alone"))
|
|
1455
|
+
if (meaningObj.misc !== void 0 && meaningObj.misc.includes("word usually written using kana alone"))
|
|
1384
1456
|
usuallyInKanaMeanings++;
|
|
1385
1457
|
}
|
|
1386
1458
|
if (isStringArray(meaning.dial)) meaningObj.dialects = meaning.dial;
|
|
@@ -1388,30 +1460,31 @@ function convertJMdict(xmlString, examples) {
|
|
|
1388
1460
|
}
|
|
1389
1461
|
if (entryObj.meanings.length === usuallyInKanaMeanings)
|
|
1390
1462
|
entryObj.usuallyInKana = true;
|
|
1391
|
-
if (examples) {
|
|
1463
|
+
if (examples !== void 0) {
|
|
1392
1464
|
let existsExample = false;
|
|
1393
|
-
if (tanakaParts && tanakaParts.has(entryObj.id))
|
|
1465
|
+
if (tanakaParts !== void 0 && tanakaParts.has(entryObj.id))
|
|
1466
|
+
existsExample = true;
|
|
1394
1467
|
if (!existsExample) {
|
|
1395
1468
|
const rkf = getValidForms(
|
|
1396
1469
|
entryObj.readings,
|
|
1397
1470
|
entryObj.kanjiForms,
|
|
1398
1471
|
entryObj.isCommon
|
|
1399
1472
|
);
|
|
1400
|
-
const
|
|
1473
|
+
const validReadings = new Set(
|
|
1401
1474
|
rkf.readings.map((r) => r.reading)
|
|
1402
1475
|
);
|
|
1403
|
-
const
|
|
1476
|
+
const validKanjiForms = rkf.kanjiForms !== void 0 ? new Set(
|
|
1404
1477
|
rkf.kanjiForms.map((kf) => kf.form)
|
|
1405
1478
|
) : void 0;
|
|
1406
|
-
if (
|
|
1407
|
-
for (const kf of
|
|
1479
|
+
if (validKanjiForms !== void 0 && validKanjiForms.size > 0 && tanakaParts !== void 0) {
|
|
1480
|
+
for (const kf of validKanjiForms)
|
|
1408
1481
|
if (tanakaParts.has(kf)) {
|
|
1409
1482
|
existsExample = true;
|
|
1410
1483
|
break;
|
|
1411
1484
|
}
|
|
1412
1485
|
}
|
|
1413
|
-
if (entryObj.kanjiForms === void 0 &&
|
|
1414
|
-
for (const r of
|
|
1486
|
+
if (entryObj.kanjiForms === void 0 && validReadings.size > 0 && tanakaParts !== void 0) {
|
|
1487
|
+
for (const r of validReadings)
|
|
1415
1488
|
if (tanakaParts.has(r)) {
|
|
1416
1489
|
existsExample = true;
|
|
1417
1490
|
break;
|
|
@@ -1445,7 +1518,7 @@ function convertKanjiDic(xmlString) {
|
|
|
1445
1518
|
if (isStringArray(misc.grade)) kanjiObj.misc.grade = misc.grade[0];
|
|
1446
1519
|
if (isStringArray(misc.freq)) kanjiObj.misc.frequency = misc.freq[0];
|
|
1447
1520
|
if (isStringArray(misc.jlpt) && ["5", "4", "3", "2", "1"].includes(misc.jlpt[0]))
|
|
1448
|
-
kanjiObj.misc.jlpt = `N${misc.jlpt[0]}`;
|
|
1521
|
+
kanjiObj.misc.jlpt = `N${Number(String(misc.jlpt[0]))}`;
|
|
1449
1522
|
if (isObjectArray(entry.reading_meaning))
|
|
1450
1523
|
for (const rm of entry.reading_meaning) {
|
|
1451
1524
|
const rmObj = { groups: [] };
|
|
@@ -1456,7 +1529,7 @@ function convertKanjiDic(xmlString) {
|
|
|
1456
1529
|
};
|
|
1457
1530
|
if (isObjectArray(group.reading)) {
|
|
1458
1531
|
for (const reading of group.reading)
|
|
1459
|
-
if (
|
|
1532
|
+
if (typeof reading._ === "string" && typeof reading.$ === "object" && (reading.$.r_type === "ja_on" || reading.$.r_type === "ja_kun"))
|
|
1460
1533
|
groupObj.readings.push({
|
|
1461
1534
|
reading: reading._,
|
|
1462
1535
|
type: reading.$.r_type
|
|
@@ -1480,7 +1553,7 @@ function convertKanjiDic(xmlString) {
|
|
|
1480
1553
|
}
|
|
1481
1554
|
if (isStringArray(rm.nanori) && rm.nanori.length > 0)
|
|
1482
1555
|
rmObj.nanori = rm.nanori;
|
|
1483
|
-
if (rmObj.groups.length > 0 || rmObj.nanori)
|
|
1556
|
+
if (rmObj.groups.length > 0 || rmObj.nanori !== void 0)
|
|
1484
1557
|
kanjiObj.readingMeaning.push(rmObj);
|
|
1485
1558
|
}
|
|
1486
1559
|
dict.push(kanjiObj);
|
|
@@ -1490,16 +1563,18 @@ function convertKanjiDic(xmlString) {
|
|
|
1490
1563
|
return dict;
|
|
1491
1564
|
}
|
|
1492
1565
|
function convertTanakaCorpus(tanakaString) {
|
|
1493
|
-
var _a;
|
|
1566
|
+
var _a, _b;
|
|
1494
1567
|
const tanakaArray = [];
|
|
1495
1568
|
const tanakaParsed = tanakaString.split("\n");
|
|
1496
1569
|
for (let i = 0; i <= tanakaParsed.length; i += 2) {
|
|
1497
1570
|
let a = tanakaParsed[i];
|
|
1498
1571
|
let b = tanakaParsed[i + 1];
|
|
1499
|
-
if (a && b && a.startsWith("A: ") && b.startsWith("B: ")) {
|
|
1572
|
+
if (a !== void 0 && b !== void 0 && a.startsWith("A: ") && b.startsWith("B: ")) {
|
|
1500
1573
|
a = a.replace("A: ", "");
|
|
1501
1574
|
b = b.replace("B: ", "");
|
|
1502
|
-
const idMatch = regexps.tanakaID.exec(a);
|
|
1575
|
+
const idMatch = (_b = (_a = regexps.tanakaID.exec(a)) == null ? void 0 : _a.groups["id"]) == null ? void 0 : _b.trim();
|
|
1576
|
+
const idParts = String(idMatch).split("_");
|
|
1577
|
+
const id = `${Number(idParts[0])}_${Number(idParts[1])}`;
|
|
1503
1578
|
const aParts = a.replace(regexps.tanakaID, "").split(" ");
|
|
1504
1579
|
const bRawParts = b.split(" ").filter((part) => part.trim().length !== 0);
|
|
1505
1580
|
const bParts = [];
|
|
@@ -1510,14 +1585,17 @@ function convertTanakaCorpus(tanakaString) {
|
|
|
1510
1585
|
const reading = partMatches == null ? void 0 : partMatches.groups["reading"];
|
|
1511
1586
|
const glossNumber = partMatches == null ? void 0 : partMatches.groups["glossnum"];
|
|
1512
1587
|
const inflectedForm = partMatches == null ? void 0 : partMatches.groups["inflection"];
|
|
1513
|
-
if (reading)
|
|
1588
|
+
if (reading !== void 0)
|
|
1514
1589
|
if (regexps.tanakaReferenceID.test(reading)) {
|
|
1515
1590
|
const referenceID = regexps.tanakaReferenceID.exec(reading);
|
|
1516
|
-
examplePart.referenceID =
|
|
1591
|
+
examplePart.referenceID = `${Number(
|
|
1592
|
+
referenceID == null ? void 0 : referenceID.groups["entryid"]
|
|
1593
|
+
)}`;
|
|
1517
1594
|
} else examplePart.reading = reading;
|
|
1518
|
-
if (glossNumber)
|
|
1595
|
+
if (glossNumber !== void 0)
|
|
1519
1596
|
examplePart.glossNumber = glossNumber.startsWith("0") ? Number.parseInt(glossNumber.substring(1)) : Number.parseInt(glossNumber);
|
|
1520
|
-
if (inflectedForm
|
|
1597
|
+
if (inflectedForm !== void 0)
|
|
1598
|
+
examplePart.inflectedForm = inflectedForm;
|
|
1521
1599
|
if (baseForm.endsWith("~")) {
|
|
1522
1600
|
examplePart.edited = true;
|
|
1523
1601
|
examplePart.baseForm = examplePart.baseForm.replace("~", "");
|
|
@@ -1527,7 +1605,7 @@ function convertTanakaCorpus(tanakaString) {
|
|
|
1527
1605
|
const phrase = aParts[0];
|
|
1528
1606
|
const translation = aParts[1];
|
|
1529
1607
|
tanakaArray.push({
|
|
1530
|
-
id
|
|
1608
|
+
id,
|
|
1531
1609
|
phrase: phrase.trim(),
|
|
1532
1610
|
translation: translation.trim(),
|
|
1533
1611
|
parts: bParts
|
|
@@ -1537,34 +1615,26 @@ function convertTanakaCorpus(tanakaString) {
|
|
|
1537
1615
|
return tanakaArray;
|
|
1538
1616
|
}
|
|
1539
1617
|
async function convertTanakaCorpusWithFurigana(tanakaString) {
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
tanakaArray =
|
|
1547
|
-
tanakaArray.
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
furigana = await convert(ex.phrase, {
|
|
1551
|
-
to: "hiragana",
|
|
1552
|
-
mode: "furigana"
|
|
1553
|
-
});
|
|
1554
|
-
if (furigana) ex.furigana = furigana;
|
|
1555
|
-
return ex;
|
|
1618
|
+
const tanakaArray = convertTanakaCorpus(tanakaString);
|
|
1619
|
+
const kuroshiro = new Kuroshiro.default();
|
|
1620
|
+
await kuroshiro.init(new KuromojiAnalyzer());
|
|
1621
|
+
const convert = kuroshiro.convert.bind(kuroshiro);
|
|
1622
|
+
for (let i = 0; i < tanakaArray.length; i++)
|
|
1623
|
+
if (!tanakaArray[i].phrase.includes("\u30FB"))
|
|
1624
|
+
tanakaArray[i].furigana = String(
|
|
1625
|
+
await convert(tanakaArray[i].phrase, {
|
|
1626
|
+
to: "hiragana",
|
|
1627
|
+
mode: "furigana"
|
|
1556
1628
|
})
|
|
1557
1629
|
);
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
);
|
|
1630
|
+
return tanakaArray;
|
|
1561
1631
|
}
|
|
1562
1632
|
function convertRadkFile(radkBuffer, kanjiDic) {
|
|
1563
1633
|
const fileParsed = import_iconv_lite.default.decode(radkBuffer, "euc-jp").split("\n").filter((line) => !line.startsWith("#"));
|
|
1564
1634
|
const radicals = [];
|
|
1565
1635
|
for (let i = 0; i < fileParsed.length; i++) {
|
|
1566
1636
|
const line = fileParsed[i];
|
|
1567
|
-
if (line && line.startsWith("$ ")) {
|
|
1637
|
+
if (line !== void 0 && line.startsWith("$ ")) {
|
|
1568
1638
|
const radical = {
|
|
1569
1639
|
radical: line.charAt(2).trim(),
|
|
1570
1640
|
strokes: line.substring(4).trim()
|
|
@@ -1572,7 +1642,7 @@ function convertRadkFile(radkBuffer, kanjiDic) {
|
|
|
1572
1642
|
let j = i + 1;
|
|
1573
1643
|
let kanjiLine = fileParsed[j];
|
|
1574
1644
|
const kanjiList = [];
|
|
1575
|
-
while (kanjiLine && !kanjiLine.startsWith("$ ")) {
|
|
1645
|
+
while (kanjiLine !== void 0 && !kanjiLine.startsWith("$ ")) {
|
|
1576
1646
|
const kanjis = kanjiLine.split("");
|
|
1577
1647
|
for (const kanji of kanjis) {
|
|
1578
1648
|
const foundKanji = kanjiDic.find(
|
|
@@ -1583,7 +1653,7 @@ function convertRadkFile(radkBuffer, kanjiDic) {
|
|
|
1583
1653
|
kanjiList.push(kanjiObj);
|
|
1584
1654
|
}
|
|
1585
1655
|
kanjiLine = fileParsed[++j];
|
|
1586
|
-
if (
|
|
1656
|
+
if (kanjiLine === void 0) continue;
|
|
1587
1657
|
if (kanjiLine.startsWith("$ ")) i = j - 1;
|
|
1588
1658
|
}
|
|
1589
1659
|
if (kanjiList.length > 0) radical.kanji = kanjiList;
|
|
@@ -1595,7 +1665,7 @@ function convertRadkFile(radkBuffer, kanjiDic) {
|
|
|
1595
1665
|
function convertKradFile(kradBuffer, kanjiDic, katakanaList) {
|
|
1596
1666
|
const fileParsed = import_iconv_lite.default.decode(kradBuffer, "euc-jp").split("\n").filter((line) => !line.startsWith("#"));
|
|
1597
1667
|
const kanjiWithRadicals = [];
|
|
1598
|
-
for (const line of fileParsed)
|
|
1668
|
+
for (const line of fileParsed)
|
|
1599
1669
|
if (line.length > 0) {
|
|
1600
1670
|
const split = line.split(" : ");
|
|
1601
1671
|
const kanjiChar = split[0];
|
|
@@ -1610,11 +1680,11 @@ function convertKradFile(kradBuffer, kanjiDic, katakanaList) {
|
|
|
1610
1680
|
(dictKanji) => dictKanji.kanji === radical
|
|
1611
1681
|
);
|
|
1612
1682
|
let radicalObj = foundRadical != null ? foundRadical : { kanji: radical };
|
|
1613
|
-
if (
|
|
1683
|
+
if (foundRadical === void 0) {
|
|
1614
1684
|
const katakanaChar = katakanaList.find(
|
|
1615
1685
|
(kana) => kana.kana === radical
|
|
1616
1686
|
);
|
|
1617
|
-
if (
|
|
1687
|
+
if (katakanaChar === void 0) continue;
|
|
1618
1688
|
radicalObj = {
|
|
1619
1689
|
kanji: katakanaChar.kana,
|
|
1620
1690
|
readingMeaning: [
|
|
@@ -1634,7 +1704,6 @@ function convertKradFile(kradBuffer, kanjiDic, katakanaList) {
|
|
|
1634
1704
|
if (kanji.kanji.length === 1 && kanji.radicals.length > 0)
|
|
1635
1705
|
kanjiWithRadicals.push(kanji);
|
|
1636
1706
|
}
|
|
1637
|
-
}
|
|
1638
1707
|
return kanjiWithRadicals;
|
|
1639
1708
|
}
|
|
1640
1709
|
function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs, svgList) {
|
|
@@ -1648,42 +1717,40 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
|
|
|
1648
1717
|
const wordPartsMap = /* @__PURE__ */ new Map();
|
|
1649
1718
|
const partExamplesMap = /* @__PURE__ */ new Map();
|
|
1650
1719
|
const entryParts = /* @__PURE__ */ new Set();
|
|
1651
|
-
if (kanjiDic)
|
|
1720
|
+
if (kanjiDic !== void 0)
|
|
1652
1721
|
for (const kanji of kanjiDic) kanjiEntryMap.set(kanji.kanji, kanji);
|
|
1653
|
-
if (wordDefinitionPairs)
|
|
1722
|
+
if (wordDefinitionPairs !== void 0)
|
|
1654
1723
|
for (const pair of wordDefinitionPairs)
|
|
1655
1724
|
wordDefinitionsMap.set(pair.wordID, pair.definitions);
|
|
1656
|
-
if (kanjiDic && svgList)
|
|
1725
|
+
if (kanjiDic !== void 0 && svgList !== void 0)
|
|
1657
1726
|
for (const kanji of kanjiDic) {
|
|
1658
1727
|
const codePoint = kanji.kanji.codePointAt(0).toString(16).toLowerCase();
|
|
1659
1728
|
const svg = svgList.find((file) => {
|
|
1660
1729
|
const baseName = file.split(".")[0].toLowerCase();
|
|
1661
1730
|
return baseName === codePoint || baseName === `0${codePoint}`;
|
|
1662
1731
|
});
|
|
1663
|
-
if (svg) kanjiSVGMap.set(kanji.kanji, svg);
|
|
1732
|
+
if (svg !== void 0) kanjiSVGMap.set(kanji.kanji, svg);
|
|
1664
1733
|
}
|
|
1665
|
-
if (jmDict) {
|
|
1734
|
+
if (jmDict !== void 0) {
|
|
1666
1735
|
for (const word of jmDict) {
|
|
1667
1736
|
wordIDEntryMap.set(word.id, word);
|
|
1668
|
-
if (word.kanjiForms)
|
|
1737
|
+
if (word.kanjiForms !== void 0)
|
|
1669
1738
|
for (const kf of word.kanjiForms)
|
|
1670
|
-
for (const char of kf.form.split("").filter((c) => regexps.kanji.test(c)))
|
|
1739
|
+
for (const char of kf.form.split("").filter((c) => regexps.kanji.test(c)))
|
|
1671
1740
|
if (!kanjiWordsMap.has(char)) kanjiWordsMap.set(char, [word]);
|
|
1672
1741
|
else kanjiWordsMap.get(char).push(word);
|
|
1673
|
-
|
|
1674
|
-
if (tanakaExamples) {
|
|
1742
|
+
if (tanakaExamples !== void 0) {
|
|
1675
1743
|
const rkf = getValidForms(
|
|
1676
1744
|
word.readings,
|
|
1677
1745
|
word.kanjiForms,
|
|
1678
1746
|
word.isCommon
|
|
1679
1747
|
);
|
|
1680
1748
|
const localPartParts = /* @__PURE__ */ new Set();
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
if (rkf.kanjiForms && rkf.kanjiForms.length > 0)
|
|
1749
|
+
for (const reading of rkf.readings) {
|
|
1750
|
+
entryParts.add(reading.reading);
|
|
1751
|
+
localPartParts.add(reading.reading);
|
|
1752
|
+
}
|
|
1753
|
+
if (rkf.kanjiForms !== void 0 && rkf.kanjiForms.length > 0)
|
|
1687
1754
|
for (const kanjiForm of rkf.kanjiForms) {
|
|
1688
1755
|
entryParts.add(kanjiForm.form);
|
|
1689
1756
|
localPartParts.add(kanjiForm.form);
|
|
@@ -1693,58 +1760,56 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
|
|
|
1693
1760
|
wordPartsMap.set(word.id, localPartParts);
|
|
1694
1761
|
}
|
|
1695
1762
|
}
|
|
1696
|
-
if (tanakaExamples) {
|
|
1697
|
-
for (const ex of tanakaExamples)
|
|
1763
|
+
if (tanakaExamples !== void 0) {
|
|
1764
|
+
for (const ex of tanakaExamples)
|
|
1698
1765
|
for (const part of ex.parts) {
|
|
1699
1766
|
if (entryParts.has(part.baseForm)) {
|
|
1700
1767
|
let exList = partExamplesMap.get(
|
|
1701
1768
|
part.baseForm
|
|
1702
1769
|
);
|
|
1703
|
-
if (
|
|
1770
|
+
if (exList === void 0) {
|
|
1704
1771
|
exList = [];
|
|
1705
1772
|
partExamplesMap.set(part.baseForm, exList);
|
|
1706
1773
|
}
|
|
1707
1774
|
exList.push(ex);
|
|
1708
1775
|
}
|
|
1709
|
-
if (part.reading && entryParts.has(part.reading)) {
|
|
1776
|
+
if (part.reading !== void 0 && entryParts.has(part.reading)) {
|
|
1710
1777
|
let exList = partExamplesMap.get(
|
|
1711
1778
|
part.reading
|
|
1712
1779
|
);
|
|
1713
|
-
if (
|
|
1780
|
+
if (exList === void 0) {
|
|
1714
1781
|
exList = [];
|
|
1715
1782
|
partExamplesMap.set(part.reading, exList);
|
|
1716
1783
|
}
|
|
1717
1784
|
exList.push(ex);
|
|
1718
1785
|
}
|
|
1719
|
-
if (part.inflectedForm && entryParts.has(part.inflectedForm)) {
|
|
1786
|
+
if (part.inflectedForm !== void 0 && entryParts.has(part.inflectedForm)) {
|
|
1720
1787
|
let exList = partExamplesMap.get(
|
|
1721
1788
|
part.inflectedForm
|
|
1722
1789
|
);
|
|
1723
|
-
if (
|
|
1790
|
+
if (exList === void 0) {
|
|
1724
1791
|
exList = [];
|
|
1725
1792
|
partExamplesMap.set(part.inflectedForm, exList);
|
|
1726
1793
|
}
|
|
1727
1794
|
exList.push(ex);
|
|
1728
1795
|
}
|
|
1729
|
-
if (part.referenceID && entryParts.has(part.referenceID)) {
|
|
1796
|
+
if (part.referenceID !== void 0 && entryParts.has(part.referenceID)) {
|
|
1730
1797
|
let exList = partExamplesMap.get(
|
|
1731
1798
|
part.referenceID
|
|
1732
1799
|
);
|
|
1733
|
-
if (
|
|
1800
|
+
if (exList === void 0) {
|
|
1734
1801
|
exList = [];
|
|
1735
1802
|
partExamplesMap.set(part.referenceID, exList);
|
|
1736
1803
|
}
|
|
1737
1804
|
exList.push(ex);
|
|
1738
1805
|
}
|
|
1739
1806
|
}
|
|
1740
|
-
}
|
|
1741
1807
|
for (const word of jmDict) {
|
|
1742
|
-
const entryParts2 = wordPartsMap.get(word.id);
|
|
1743
1808
|
const seenEx = /* @__PURE__ */ new Set();
|
|
1744
1809
|
const validExamples = [];
|
|
1745
|
-
for (const p of
|
|
1810
|
+
for (const p of wordPartsMap.get(word.id)) {
|
|
1746
1811
|
const examplesForPart = (_a = partExamplesMap.get(p)) == null ? void 0 : _a.filter((ex) => !seenEx.has(ex.id));
|
|
1747
|
-
if (
|
|
1812
|
+
if (examplesForPart === void 0) continue;
|
|
1748
1813
|
for (const ex of examplesForPart) {
|
|
1749
1814
|
seenEx.add(ex.id);
|
|
1750
1815
|
validExamples.push(ex);
|
|
@@ -1769,49 +1834,44 @@ function mapEntry(entry) {
|
|
|
1769
1834
|
word: entry.word,
|
|
1770
1835
|
pos_title: entry.pos_title,
|
|
1771
1836
|
senses: entry.senses.filter(
|
|
1772
|
-
(sense) => isObjectArray(sense.form_of)
|
|
1773
|
-
(form) => form.word && typeof form.word === "string"
|
|
1774
|
-
) || isStringArray(sense.glosses)
|
|
1837
|
+
(sense) => (isObjectArray(sense.form_of) ? sense.form_of.every((form) => typeof form.word === "string") : isStringArray(sense.glosses)) === true || isStringArray(sense.glosses)
|
|
1775
1838
|
).map((sense) => ({
|
|
1776
|
-
...sense.form_of ? {
|
|
1777
|
-
form_of: sense.form_of.map((form) => form.word)
|
|
1839
|
+
...isObjectArray(sense.form_of) ? {
|
|
1840
|
+
form_of: sense.form_of.map((form) => String(form.word))
|
|
1778
1841
|
} : {},
|
|
1779
1842
|
glosses: sense.glosses
|
|
1780
1843
|
})),
|
|
1781
|
-
...isObjectArray(entry.forms) && entry.forms.every((form) => typeof form.form === "string") ? { forms: entry.forms.map((form) => form.form) } : {}
|
|
1844
|
+
...isObjectArray(entry.forms) && entry.forms.every((form) => typeof form.form === "string") === true ? { forms: entry.forms.map((form) => String(form.form)) } : {}
|
|
1782
1845
|
};
|
|
1783
1846
|
}
|
|
1784
1847
|
function convertJawiktionarySync(buffer) {
|
|
1848
|
+
var _a;
|
|
1785
1849
|
const lines = buffer.toString("utf-8").split("\n");
|
|
1786
1850
|
const entries = [];
|
|
1787
1851
|
for (let i = 0; i < lines.length; i++) {
|
|
1788
|
-
const line = lines[i];
|
|
1789
|
-
if (
|
|
1852
|
+
const line = (_a = lines[i]) == null ? void 0 : _a.trim();
|
|
1853
|
+
if (line === void 0 || line.length === 0) continue;
|
|
1790
1854
|
const obj = JSON.parse(line);
|
|
1791
|
-
if (
|
|
1855
|
+
if (typeof obj === "object" && (obj.lang === "\u65E5\u672C\u8A9E" || obj.lang === "\u53E4\u5178\u65E5\u672C\u8A9E"))
|
|
1792
1856
|
entries.push(mapEntry(obj));
|
|
1793
1857
|
}
|
|
1794
1858
|
return entries;
|
|
1795
1859
|
}
|
|
1796
1860
|
async function convertJawiktionaryAsync(stream) {
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
stream.destroy();
|
|
1812
|
-
resolve(entries);
|
|
1813
|
-
}
|
|
1814
|
-
);
|
|
1861
|
+
const rl = (0, import_readline.createInterface)({
|
|
1862
|
+
input: stream,
|
|
1863
|
+
crlfDelay: Infinity
|
|
1864
|
+
});
|
|
1865
|
+
const entries = [];
|
|
1866
|
+
for await (const line of rl) {
|
|
1867
|
+
const obj = JSON.parse(line.trim());
|
|
1868
|
+
if (typeof obj === "object" && (obj.lang === "\u65E5\u672C\u8A9E" || obj.lang === "\u53E4\u5178\u65E5\u672C\u8A9E"))
|
|
1869
|
+
entries.push(mapEntry(obj));
|
|
1870
|
+
}
|
|
1871
|
+
rl.close();
|
|
1872
|
+
stream.close();
|
|
1873
|
+
stream.destroy();
|
|
1874
|
+
return entries;
|
|
1815
1875
|
}
|
|
1816
1876
|
function parseEntry(entry, definitions, definitionMap) {
|
|
1817
1877
|
for (const sense of entry.senses) {
|
|
@@ -1824,12 +1884,12 @@ function parseEntry(entry, definitions, definitionMap) {
|
|
|
1824
1884
|
}
|
|
1825
1885
|
}
|
|
1826
1886
|
}
|
|
1827
|
-
function getWordDefinitions(
|
|
1887
|
+
function getWordDefinitions(wiktionaryEntries, jmDict) {
|
|
1828
1888
|
var _a, _b, _c, _d, _e;
|
|
1829
1889
|
const entries = /* @__PURE__ */ new Map();
|
|
1830
|
-
for (const entry of
|
|
1890
|
+
for (const entry of wiktionaryEntries) {
|
|
1831
1891
|
const ent = entries.get(entry.word);
|
|
1832
|
-
if (ent) ent.push(entry);
|
|
1892
|
+
if (ent !== void 0) ent.push(entry);
|
|
1833
1893
|
else entries.set(entry.word, [entry]);
|
|
1834
1894
|
}
|
|
1835
1895
|
const japaneseDefinitions = [];
|
|
@@ -1843,16 +1903,14 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1843
1903
|
const wordKanjiForms = /* @__PURE__ */ new Set();
|
|
1844
1904
|
const rkf = getValidForms(
|
|
1845
1905
|
word.readings,
|
|
1846
|
-
word.kanjiForms
|
|
1847
|
-
word.isCommon
|
|
1906
|
+
word.kanjiForms
|
|
1848
1907
|
);
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
if (rkf.kanjiForms && rkf.kanjiForms.length > 0)
|
|
1908
|
+
for (const r of rkf.readings) {
|
|
1909
|
+
validReadings.add(r.reading);
|
|
1910
|
+
wordReadings.add(r.reading);
|
|
1911
|
+
validForms.add(r.reading);
|
|
1912
|
+
}
|
|
1913
|
+
if (rkf.kanjiForms !== void 0 && rkf.kanjiForms.length > 0)
|
|
1856
1914
|
for (const kf of rkf.kanjiForms) {
|
|
1857
1915
|
validKanjiForms.add(kf.form);
|
|
1858
1916
|
wordKanjiForms.add(kf.form);
|
|
@@ -1872,44 +1930,42 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1872
1930
|
const ents = Array.from(entries.values()).flat();
|
|
1873
1931
|
for (const entry of ents) {
|
|
1874
1932
|
let valid = false;
|
|
1875
|
-
if (validKanjiForms
|
|
1933
|
+
if (validKanjiForms.has(entry.word)) {
|
|
1876
1934
|
valid = true;
|
|
1877
1935
|
for (const sense of entry.senses) {
|
|
1878
|
-
if (sense.form_of && sense.form_of.some((form) =>
|
|
1936
|
+
if (sense.form_of !== void 0 && sense.form_of.some((form) => validForms.has(form)))
|
|
1879
1937
|
validFormOfEntries.add(entry.word);
|
|
1880
1938
|
for (const gloss of sense.glosses) {
|
|
1881
1939
|
let hasForm = false;
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1940
|
+
for (const r of validForms)
|
|
1941
|
+
if (gloss.includes(r)) {
|
|
1942
|
+
hasForm = true;
|
|
1943
|
+
break;
|
|
1944
|
+
}
|
|
1889
1945
|
if (hasForm) validGlossesEntries.add(entry.word);
|
|
1890
1946
|
}
|
|
1891
1947
|
}
|
|
1892
|
-
if (entry.forms) {
|
|
1948
|
+
if (entry.forms !== void 0) {
|
|
1893
1949
|
for (const form of entry.forms)
|
|
1894
|
-
if (
|
|
1950
|
+
if (validForms.has(form)) validFormsEntries.add(entry.word);
|
|
1895
1951
|
}
|
|
1896
1952
|
}
|
|
1897
|
-
if (
|
|
1953
|
+
if (validForms.has(entry.word)) {
|
|
1898
1954
|
valid = true;
|
|
1899
1955
|
const ftEntry = entriesWithFormTitlesGlobal.get(entry.word);
|
|
1900
|
-
if (ftEntry) ftEntry.push(entry);
|
|
1956
|
+
if (ftEntry !== void 0) ftEntry.push(entry);
|
|
1901
1957
|
else entriesWithFormTitlesGlobal.set(entry.word, [entry]);
|
|
1902
1958
|
}
|
|
1903
1959
|
if (valid) {
|
|
1904
|
-
const tEntry = validTitleEntries.get(
|
|
1905
|
-
|
|
1960
|
+
const tEntry = validTitleEntries.get(
|
|
1961
|
+
entry.word
|
|
1962
|
+
);
|
|
1963
|
+
if (tEntry !== void 0) tEntry.push(entry);
|
|
1906
1964
|
else validTitleEntries.set(entry.word, [entry]);
|
|
1907
1965
|
}
|
|
1908
|
-
if (entry.forms
|
|
1909
|
-
(form) => validKanjiForms.has(form) || validReadings.has(form)
|
|
1910
|
-
)) {
|
|
1966
|
+
if (entry.forms !== void 0 && validForms.has(entry.word) && entry.forms.some((form) => validForms.has(form))) {
|
|
1911
1967
|
const wfEntry = entriesWithFormsGlobal.get(entry.word);
|
|
1912
|
-
if (wfEntry) wfEntry.push(entry);
|
|
1968
|
+
if (wfEntry !== void 0) wfEntry.push(entry);
|
|
1913
1969
|
else entriesWithFormsGlobal.set(entry.word, [entry]);
|
|
1914
1970
|
}
|
|
1915
1971
|
}
|
|
@@ -1924,53 +1980,17 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1924
1980
|
const wfe = Array.from(
|
|
1925
1981
|
entriesWithFormsGlobal.values()
|
|
1926
1982
|
).flat();
|
|
1927
|
-
for (const pos of
|
|
1928
|
-
"\u540D\u8A5E",
|
|
1929
|
-
"\u52D5\u8A5E",
|
|
1930
|
-
"\u6210\u53E5",
|
|
1931
|
-
"\u526F\u8A5E",
|
|
1932
|
-
"\u5F62\u5BB9\u52D5\u8A5E",
|
|
1933
|
-
"\u52A9\u8A5E",
|
|
1934
|
-
"\u611F\u52D5\u8A5E",
|
|
1935
|
-
"\u4EE3\u540D\u8A5E",
|
|
1936
|
-
"\u63A5\u5C3E\u8F9E",
|
|
1937
|
-
"\u63A5\u982D\u8A9E",
|
|
1938
|
-
"\u9020\u8A9E\u6210\u5206",
|
|
1939
|
-
"\u7565\u8A9E",
|
|
1940
|
-
"\u56FA\u6709\u540D\u8A5E",
|
|
1941
|
-
"\u4EBA\u79F0\u4EE3\u540D\u8A5E",
|
|
1942
|
-
"\u63A5\u982D\u8F9E",
|
|
1943
|
-
"\u63A5\u7D9A\u52A9\u8A5E",
|
|
1944
|
-
"\u9593\u6295\u8A5E",
|
|
1945
|
-
"\u52A9\u52D5\u8A5E",
|
|
1946
|
-
"\u5F62\u5BB9\u8A5E",
|
|
1947
|
-
"\u7E2E\u7D04\u5F62",
|
|
1948
|
-
"\u63A5\u8F9E",
|
|
1949
|
-
"\u63A5\u7D9A\u8A5E",
|
|
1950
|
-
"\u9023\u4F53\u8A5E",
|
|
1951
|
-
"\u4EBA\u540D",
|
|
1952
|
-
"\u8A18\u53F7",
|
|
1953
|
-
"\u6570\u8A5E",
|
|
1954
|
-
"\u6163\u7528\u53E5",
|
|
1955
|
-
"\u3053\u3068\u308F\u3056",
|
|
1956
|
-
"\u52A9\u6570\u8A5E",
|
|
1957
|
-
"\u82F1\u6570\u5B57\u6DF7\u5408\u8868\u8A18",
|
|
1958
|
-
"\u52D5\u8A5E\u53E5",
|
|
1959
|
-
"\u6210\u8A9E",
|
|
1960
|
-
"\u610F\u7FA9",
|
|
1961
|
-
"\u982D\u5B57\u8A9E",
|
|
1962
|
-
"\u63A5\u5C3E\u8A9E"
|
|
1963
|
-
]) {
|
|
1983
|
+
for (const pos of posList) {
|
|
1964
1984
|
posMap.set(pos, {});
|
|
1965
1985
|
for (const te of vte)
|
|
1966
1986
|
if (te.pos_title === pos || te.pos_title === "\u548C\u8A9E\u306E\u6F22\u5B57\u8868\u8A18") {
|
|
1967
1987
|
const posEntries = posMap.get(pos);
|
|
1968
1988
|
if (posEntries.title === void 0)
|
|
1969
1989
|
posEntries.title = /* @__PURE__ */ new Map();
|
|
1970
|
-
const
|
|
1990
|
+
const entryList = posEntries.title.get(
|
|
1971
1991
|
te.word
|
|
1972
1992
|
);
|
|
1973
|
-
if (
|
|
1993
|
+
if (entryList !== void 0) entryList.push(te);
|
|
1974
1994
|
else posEntries.title.set(te.word, [te]);
|
|
1975
1995
|
}
|
|
1976
1996
|
for (const ft of fge)
|
|
@@ -1978,8 +1998,8 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1978
1998
|
const posEntries = posMap.get(pos);
|
|
1979
1999
|
if (posEntries.formTitle === void 0)
|
|
1980
2000
|
posEntries.formTitle = /* @__PURE__ */ new Map();
|
|
1981
|
-
const
|
|
1982
|
-
if (
|
|
2001
|
+
const entryList = posEntries.formTitle.get(ft.word);
|
|
2002
|
+
if (entryList !== void 0) entryList.push(ft);
|
|
1983
2003
|
else posEntries.formTitle.set(ft.word, [ft]);
|
|
1984
2004
|
}
|
|
1985
2005
|
for (const wf of wfe)
|
|
@@ -1987,10 +2007,10 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1987
2007
|
const posEntries = posMap.get(pos);
|
|
1988
2008
|
if (posEntries.form === void 0)
|
|
1989
2009
|
posEntries.form = /* @__PURE__ */ new Map();
|
|
1990
|
-
const
|
|
2010
|
+
const entryList = posEntries.form.get(
|
|
1991
2011
|
wf.word
|
|
1992
2012
|
);
|
|
1993
|
-
if (
|
|
2013
|
+
if (entryList !== void 0) entryList.push(wf);
|
|
1994
2014
|
else posEntries.form.set(wf.word, [wf]);
|
|
1995
2015
|
}
|
|
1996
2016
|
}
|
|
@@ -2003,7 +2023,7 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2003
2023
|
for (const m of word.meanings)
|
|
2004
2024
|
for (const note of m.partOfSpeech) {
|
|
2005
2025
|
const noteEntry = noteMap.get(note);
|
|
2006
|
-
if (noteEntry
|
|
2026
|
+
if ((noteEntry == null ? void 0 : noteEntry.length) === 3) {
|
|
2007
2027
|
const notePos = noteEntry[2];
|
|
2008
2028
|
if (Array.isArray(notePos))
|
|
2009
2029
|
for (const pos of notePos) {
|
|
@@ -2020,21 +2040,21 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2020
2040
|
if (poses.size > 0)
|
|
2021
2041
|
for (const pos of poses) {
|
|
2022
2042
|
const posEntries = posMap.get(pos);
|
|
2023
|
-
if (rkf.kanjiForms)
|
|
2043
|
+
if (rkf.kanjiForms !== void 0)
|
|
2024
2044
|
for (const kf of rkf.kanjiForms) {
|
|
2025
2045
|
const te = (_a = posEntries.title) == null ? void 0 : _a.get(kf);
|
|
2026
2046
|
const fe = (_b = posEntries.form) == null ? void 0 : _b.get(kf);
|
|
2027
|
-
if (te)
|
|
2047
|
+
if (te !== void 0)
|
|
2028
2048
|
entriesWithTitles.push(
|
|
2029
2049
|
...te.filter(
|
|
2030
2050
|
(ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
|
|
2031
2051
|
)
|
|
2032
2052
|
);
|
|
2033
|
-
if (fe)
|
|
2053
|
+
if (fe !== void 0)
|
|
2034
2054
|
entriesWithForms.push(
|
|
2035
2055
|
...fe.filter(
|
|
2036
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2037
|
-
(form) => rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2056
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2057
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2038
2058
|
)
|
|
2039
2059
|
)
|
|
2040
2060
|
);
|
|
@@ -2043,41 +2063,41 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2043
2063
|
const te = (_c = posEntries.title) == null ? void 0 : _c.get(r);
|
|
2044
2064
|
const fe = (_d = posEntries.form) == null ? void 0 : _d.get(r);
|
|
2045
2065
|
const fte = (_e = posEntries.formTitle) == null ? void 0 : _e.get(r);
|
|
2046
|
-
if (te)
|
|
2066
|
+
if (te !== void 0)
|
|
2047
2067
|
entriesWithTitles.push(
|
|
2048
2068
|
...te.filter(
|
|
2049
|
-
(ent) => ent.forms
|
|
2050
|
-
(form) => rkf.kanjiForms.has(form)
|
|
2051
|
-
)
|
|
2069
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2070
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2071
|
+
)
|
|
2052
2072
|
)
|
|
2053
2073
|
);
|
|
2054
|
-
if (fe)
|
|
2074
|
+
if (fe !== void 0)
|
|
2055
2075
|
entriesWithForms.push(
|
|
2056
2076
|
...fe.filter(
|
|
2057
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2058
|
-
(form) => rkf.kanjiForms && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2077
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2078
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2059
2079
|
)
|
|
2060
2080
|
)
|
|
2061
2081
|
);
|
|
2062
|
-
if (fte) entriesWithFormTitles.push(...fte);
|
|
2082
|
+
if (fte !== void 0) entriesWithFormTitles.push(...fte);
|
|
2063
2083
|
}
|
|
2064
2084
|
}
|
|
2065
2085
|
if (entriesWithTitles.length === 0 && entriesWithFormTitles.length === 0 && entriesWithForms.length === 0) {
|
|
2066
|
-
if (rkf.kanjiForms)
|
|
2086
|
+
if (rkf.kanjiForms !== void 0)
|
|
2067
2087
|
for (const kf of rkf.kanjiForms) {
|
|
2068
2088
|
const te = validTitleEntries.get(kf);
|
|
2069
2089
|
const fe = entriesWithFormsGlobal.get(kf);
|
|
2070
|
-
if (te)
|
|
2090
|
+
if (te !== void 0)
|
|
2071
2091
|
entriesWithTitles.push(
|
|
2072
2092
|
...te.filter(
|
|
2073
2093
|
(ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
|
|
2074
2094
|
)
|
|
2075
2095
|
);
|
|
2076
|
-
if (fe)
|
|
2096
|
+
if (fe !== void 0)
|
|
2077
2097
|
entriesWithForms.push(
|
|
2078
2098
|
...fe.filter(
|
|
2079
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2080
|
-
(form) => rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2099
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2100
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2081
2101
|
)
|
|
2082
2102
|
)
|
|
2083
2103
|
);
|
|
@@ -2086,31 +2106,31 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2086
2106
|
const te = validTitleEntries.get(r);
|
|
2087
2107
|
const fe = entriesWithFormsGlobal.get(r);
|
|
2088
2108
|
const fte = entriesWithFormTitlesGlobal.get(r);
|
|
2089
|
-
if (te)
|
|
2109
|
+
if (te !== void 0)
|
|
2090
2110
|
entriesWithTitles.push(
|
|
2091
2111
|
...te.filter(
|
|
2092
|
-
(ent) => ent.forms
|
|
2093
|
-
(form) => rkf.kanjiForms.has(form)
|
|
2094
|
-
)
|
|
2112
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2113
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2114
|
+
)
|
|
2095
2115
|
)
|
|
2096
2116
|
);
|
|
2097
|
-
if (fe)
|
|
2117
|
+
if (fe !== void 0)
|
|
2098
2118
|
entriesWithForms.push(
|
|
2099
2119
|
...fe.filter(
|
|
2100
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2101
|
-
(form) => rkf.kanjiForms && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2120
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2121
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2102
2122
|
)
|
|
2103
2123
|
)
|
|
2104
2124
|
);
|
|
2105
|
-
if (fte) entriesWithFormTitles.push(...fte);
|
|
2125
|
+
if (fte !== void 0) entriesWithFormTitles.push(...fte);
|
|
2106
2126
|
}
|
|
2107
2127
|
}
|
|
2108
2128
|
if (entriesWithTitles.length > 0 && (entriesWithFormTitles.length > 0 || entriesWithForms.length > 0))
|
|
2109
2129
|
wordEntriesPairs.push({
|
|
2110
2130
|
word,
|
|
2111
2131
|
readings: rkf.readings,
|
|
2112
|
-
...rkf.kanjiForms ? { kanjiForms: rkf.kanjiForms } : {},
|
|
2113
|
-
forms: rkf.kanjiForms ? rkf.readings.union(rkf.kanjiForms) : rkf.readings,
|
|
2132
|
+
...rkf.kanjiForms !== void 0 ? { kanjiForms: rkf.kanjiForms } : {},
|
|
2133
|
+
forms: rkf.kanjiForms !== void 0 ? rkf.readings.union(rkf.kanjiForms) : rkf.readings,
|
|
2114
2134
|
entriesWithTitles,
|
|
2115
2135
|
entriesWithFormTitles,
|
|
2116
2136
|
entriesWithForms
|
|
@@ -2123,59 +2143,54 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2123
2143
|
const readingEntries = [];
|
|
2124
2144
|
const titleFormMap = /* @__PURE__ */ new Map();
|
|
2125
2145
|
const refsMap = /* @__PURE__ */ new Map();
|
|
2126
|
-
const
|
|
2146
|
+
const forms = /* @__PURE__ */ new Set();
|
|
2127
2147
|
for (const ent of pair.entriesWithTitles) {
|
|
2128
|
-
const
|
|
2129
|
-
const
|
|
2130
|
-
const
|
|
2131
|
-
|
|
2132
|
-
if (pair.kanjiForms && pair.kanjiForms.has(ent.word) && (validFormOf || validGlosses || validForms2)) {
|
|
2148
|
+
const hasValidFormOf = validFormOfEntries.has(ent.word);
|
|
2149
|
+
const hasValidForms = validFormsEntries.has(ent.word);
|
|
2150
|
+
const hasForms = ent.forms !== void 0 && ent.forms.some((form) => pair.forms.has(form));
|
|
2151
|
+
if (pair.kanjiForms !== void 0 && pair.kanjiForms.has(ent.word)) {
|
|
2133
2152
|
kanjiFormEntries.push(ent);
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
if (validGlosses) {
|
|
2146
|
-
for (const gloss of sense.glosses)
|
|
2147
|
-
if (gloss.includes("\u8868\u8A18") || gloss.includes("\u53C2\u7167")) {
|
|
2148
|
-
for (const f of pair.forms)
|
|
2149
|
-
if (gloss.includes(f)) {
|
|
2150
|
-
const elem = refsMap.get(f);
|
|
2151
|
-
if (!elem) refsMap.set(f, /* @__PURE__ */ new Set([ent.word]));
|
|
2152
|
-
else elem.add(ent.word);
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
}
|
|
2153
|
+
for (const sense of ent.senses) {
|
|
2154
|
+
if (hasValidFormOf && sense.form_of !== void 0) {
|
|
2155
|
+
for (const form of sense.form_of)
|
|
2156
|
+
if (pair.forms.has(form)) {
|
|
2157
|
+
const elem = titleFormMap.get(form);
|
|
2158
|
+
if (elem === void 0)
|
|
2159
|
+
titleFormMap.set(form, /* @__PURE__ */ new Set([ent.word]));
|
|
2160
|
+
else elem.add(ent.word);
|
|
2161
|
+
}
|
|
2156
2162
|
}
|
|
2157
|
-
|
|
2163
|
+
for (const gloss of sense.glosses)
|
|
2164
|
+
for (const f of pair.forms)
|
|
2165
|
+
if (gloss.includes(f)) {
|
|
2166
|
+
const elem = refsMap.get(f);
|
|
2167
|
+
if (elem === void 0)
|
|
2168
|
+
refsMap.set(f, /* @__PURE__ */ new Set([ent.word]));
|
|
2169
|
+
else elem.add(ent.word);
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
if (hasValidForms && ent.forms !== void 0) {
|
|
2158
2173
|
for (const form of ent.forms)
|
|
2159
|
-
if (pair.
|
|
2174
|
+
if (pair.forms.has(form)) forms.add(form);
|
|
2160
2175
|
}
|
|
2161
2176
|
}
|
|
2162
|
-
if (pair.readings.has(ent.word) &&
|
|
2163
|
-
entriesWithForms.push(ent);
|
|
2177
|
+
if (pair.readings.has(ent.word) && hasForms) entriesWithForms.push(ent);
|
|
2164
2178
|
if (pair.kanjiForms === void 0 && pair.readings.has(ent.word))
|
|
2165
2179
|
readingEntries.push(ent);
|
|
2166
2180
|
}
|
|
2167
2181
|
for (const entry of pair.entriesWithForms) {
|
|
2168
2182
|
const elem = titleFormMap.get(entry.word);
|
|
2169
|
-
if (elem && entry.forms && entry.forms.some((form) => elem.has(form)))
|
|
2183
|
+
if (elem !== void 0 && entry.forms !== void 0 && entry.forms.some((form) => elem.has(form)))
|
|
2170
2184
|
entriesWithForms.push(entry);
|
|
2171
2185
|
}
|
|
2172
2186
|
for (const entry of pair.entriesWithFormTitles) {
|
|
2173
|
-
if (
|
|
2187
|
+
if (forms.has(entry.word)) {
|
|
2174
2188
|
entriesWithForms.push(entry);
|
|
2175
2189
|
continue;
|
|
2176
2190
|
}
|
|
2177
2191
|
const ft = refsMap.get(entry.word);
|
|
2178
|
-
if (ft && !ft.isDisjointFrom(pair.forms))
|
|
2192
|
+
if (ft !== void 0 && !ft.isDisjointFrom(pair.forms))
|
|
2193
|
+
entriesWithForms.push(entry);
|
|
2179
2194
|
}
|
|
2180
2195
|
if (kanjiFormEntries.length > 0) {
|
|
2181
2196
|
for (const entry of kanjiFormEntries)
|
|
@@ -2191,7 +2206,15 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2191
2206
|
if (definitions.length > 0)
|
|
2192
2207
|
japaneseDefinitions.push({
|
|
2193
2208
|
wordID: pair.word.id,
|
|
2194
|
-
definitions
|
|
2209
|
+
definitions,
|
|
2210
|
+
wordForms: pair.forms.union(
|
|
2211
|
+
new Set(
|
|
2212
|
+
pair.forms.values().toArray().flatMap((form) => [
|
|
2213
|
+
hiraganaToKatakana(form),
|
|
2214
|
+
katakanaToHiragana(form)
|
|
2215
|
+
])
|
|
2216
|
+
)
|
|
2217
|
+
)
|
|
2195
2218
|
});
|
|
2196
2219
|
}
|
|
2197
2220
|
for (let i = 0; i < japaneseDefinitions.length; i++) {
|
|
@@ -2200,41 +2223,46 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2200
2223
|
const defCount = definitionMap.get(
|
|
2201
2224
|
pair.definitions[j].definition
|
|
2202
2225
|
);
|
|
2203
|
-
if (defCount && defCount.count > 1)
|
|
2204
|
-
|
|
2226
|
+
if (defCount !== void 0 && defCount.count > 1) {
|
|
2227
|
+
let mnba = true;
|
|
2228
|
+
for (const f of pair.wordForms)
|
|
2229
|
+
if (pair.definitions[j].definition.includes(f)) {
|
|
2230
|
+
mnba = false;
|
|
2231
|
+
break;
|
|
2232
|
+
}
|
|
2233
|
+
pair.definitions[j].mayNotBeAccurate = mnba ? 2 : 1;
|
|
2234
|
+
}
|
|
2205
2235
|
}
|
|
2236
|
+
delete pair.wordForms;
|
|
2206
2237
|
japaneseDefinitions[i] = pair;
|
|
2207
2238
|
}
|
|
2208
2239
|
return japaneseDefinitions;
|
|
2209
2240
|
}
|
|
2210
2241
|
async function getWordDefinitionsWithFurigana(entryList, jmDict) {
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
pair.definitions[j].
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
}
|
|
2232
|
-
resolve(japaneseDefinitions);
|
|
2233
|
-
});
|
|
2242
|
+
const japaneseDefinitions = getWordDefinitions(
|
|
2243
|
+
entryList,
|
|
2244
|
+
jmDict
|
|
2245
|
+
);
|
|
2246
|
+
const kuroshiro = new Kuroshiro.default();
|
|
2247
|
+
await kuroshiro.init(new KuromojiAnalyzer());
|
|
2248
|
+
const convert = kuroshiro.convert.bind(kuroshiro);
|
|
2249
|
+
for (let i = 0; i < japaneseDefinitions.length; i++) {
|
|
2250
|
+
const pair = japaneseDefinitions[i];
|
|
2251
|
+
for (let j = 0; j < pair.definitions.length; j++)
|
|
2252
|
+
if (!pair.definitions[j].definition.includes("\u30FB"))
|
|
2253
|
+
pair.definitions[j].furigana = String(
|
|
2254
|
+
await convert(pair.definitions[j].definition, {
|
|
2255
|
+
to: "hiragana",
|
|
2256
|
+
mode: "furigana"
|
|
2257
|
+
})
|
|
2258
|
+
);
|
|
2259
|
+
japaneseDefinitions[i] = pair;
|
|
2260
|
+
}
|
|
2261
|
+
return japaneseDefinitions;
|
|
2234
2262
|
}
|
|
2235
2263
|
function lookupWordNote(key, notes, tags) {
|
|
2236
2264
|
const info = noteMap.get(key.toLowerCase());
|
|
2237
|
-
if (
|
|
2265
|
+
if (info === void 0) {
|
|
2238
2266
|
notes.push(key);
|
|
2239
2267
|
return { note: key };
|
|
2240
2268
|
}
|
|
@@ -2244,22 +2272,172 @@ function lookupWordNote(key, notes, tags) {
|
|
|
2244
2272
|
return { note: info[1], tag };
|
|
2245
2273
|
}
|
|
2246
2274
|
var wordAddNoteArray = (arr, cb) => {
|
|
2247
|
-
if (
|
|
2275
|
+
if (arr === void 0) return;
|
|
2248
2276
|
for (const v of arr) cb(v);
|
|
2249
2277
|
};
|
|
2250
|
-
function
|
|
2278
|
+
function getKanji(searchedKanji, dict, jmDict, svgList, noteTypeName, deckPath) {
|
|
2279
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
2280
|
+
let dictKanji = void 0;
|
|
2281
|
+
if (typeof searchedKanji === "string" && dict !== void 0)
|
|
2282
|
+
dictKanji = dict instanceof Map ? dict.get(searchedKanji) : dict.find((entry) => entry.kanji === searchedKanji);
|
|
2283
|
+
else if (typeof searchedKanji === "object") dictKanji = searchedKanji;
|
|
2284
|
+
if (dictKanji !== void 0) {
|
|
2285
|
+
const kanji = {
|
|
2286
|
+
kanji: dictKanji.kanji,
|
|
2287
|
+
strokes: dictKanji.misc.strokeNumber,
|
|
2288
|
+
...((_a = dictKanji.misc) == null ? void 0 : _a.grade) !== void 0 ? { grade: dictKanji.misc.grade } : {},
|
|
2289
|
+
...((_b = dictKanji.misc) == null ? void 0 : _b.frequency) !== void 0 ? { frequency: dictKanji.misc.frequency } : {},
|
|
2290
|
+
...((_c = dictKanji.misc) == null ? void 0 : _c.jlpt) !== void 0 ? { jlpt: dictKanji.misc.jlpt } : {},
|
|
2291
|
+
noteID: `kanji_${dictKanji.kanji}`,
|
|
2292
|
+
...noteTypeName !== void 0 ? { noteTypeName } : {},
|
|
2293
|
+
...deckPath !== void 0 ? { deckPath } : {},
|
|
2294
|
+
tags: []
|
|
2295
|
+
};
|
|
2296
|
+
if (dictKanji.readingMeaning !== void 0 && dictKanji.readingMeaning.length > 0) {
|
|
2297
|
+
const meanings = [];
|
|
2298
|
+
const nanori = [];
|
|
2299
|
+
const onyomi = [];
|
|
2300
|
+
const kunyomi = [];
|
|
2301
|
+
for (const rm of dictKanji.readingMeaning) {
|
|
2302
|
+
if (rm.nanori !== void 0 && rm.nanori.length > 0)
|
|
2303
|
+
nanori.push(...rm.nanori);
|
|
2304
|
+
for (const group of rm.groups) {
|
|
2305
|
+
if (group.readings !== void 0) {
|
|
2306
|
+
onyomi.push(
|
|
2307
|
+
...group.readings.filter((reading) => reading.type === "ja_on").map((reading) => reading.reading)
|
|
2308
|
+
);
|
|
2309
|
+
kunyomi.push(
|
|
2310
|
+
...group.readings.filter(
|
|
2311
|
+
(reading) => reading.type === "ja_kun"
|
|
2312
|
+
).map((reading) => reading.reading)
|
|
2313
|
+
);
|
|
2314
|
+
}
|
|
2315
|
+
if (group.meanings !== void 0 && group.meanings.length > 0)
|
|
2316
|
+
meanings.push(...group.meanings);
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
if (meanings.length > 0) kanji.meanings = meanings;
|
|
2320
|
+
if (nanori.length > 0) kanji.nanori = nanori;
|
|
2321
|
+
if (onyomi.length > 0) kanji.onyomi = onyomi;
|
|
2322
|
+
if (kunyomi.length > 0) kanji.kunyomi = kunyomi;
|
|
2323
|
+
}
|
|
2324
|
+
if (jmDict !== void 0) {
|
|
2325
|
+
let kanjiWords = jmDict instanceof Map ? jmDict.get(kanji.kanji) : jmDict;
|
|
2326
|
+
const firstKfWords = kanjiWords == null ? void 0 : kanjiWords.filter(
|
|
2327
|
+
(word) => word.kanjiForms !== void 0 && word.kanjiForms[0].form.includes(kanji.kanji)
|
|
2328
|
+
);
|
|
2329
|
+
if (firstKfWords !== void 0 && firstKfWords.length > 0)
|
|
2330
|
+
kanjiWords = firstKfWords;
|
|
2331
|
+
if (kanjiWords !== void 0) {
|
|
2332
|
+
const validWords = [];
|
|
2333
|
+
for (const word of kanjiWords) {
|
|
2334
|
+
const kanjiForm = (_d = firstKfWords !== void 0 && firstKfWords.length > 0 ? word.kanjiForms[0] : word.kanjiForms.find(
|
|
2335
|
+
(kf) => kf.form.includes(kanji.kanji)
|
|
2336
|
+
)) == null ? void 0 : _d.form;
|
|
2337
|
+
if (kanjiForm !== void 0) {
|
|
2338
|
+
const reading = (_e = firstKfWords !== void 0 && firstKfWords.length > 0 ? word.readings[0] : word.readings.find(
|
|
2339
|
+
(r) => r.kanjiFormRestrictions !== void 0 && r.kanjiFormRestrictions.includes(kanjiForm)
|
|
2340
|
+
)) == null ? void 0 : _e.reading;
|
|
2341
|
+
if (reading === void 0) continue;
|
|
2342
|
+
const translation = (_f = firstKfWords !== void 0 && firstKfWords.length > 0 ? word.meanings[0] : word.meanings.find(
|
|
2343
|
+
(m) => m.kanjiFormRestrictions !== void 0 && m.kanjiFormRestrictions.includes(kanjiForm)
|
|
2344
|
+
)) == null ? void 0 : _f.translations.map(
|
|
2345
|
+
(t) => typeof t === "string" ? t : t.translation
|
|
2346
|
+
)[0];
|
|
2347
|
+
if (translation === void 0) continue;
|
|
2348
|
+
validWords.push({
|
|
2349
|
+
kanjiForms: [{ kanjiForm }],
|
|
2350
|
+
readings: [{ reading }],
|
|
2351
|
+
translations: [
|
|
2352
|
+
{
|
|
2353
|
+
translation
|
|
2354
|
+
}
|
|
2355
|
+
]
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
if (validWords.length === 3) break;
|
|
2359
|
+
}
|
|
2360
|
+
if (validWords.length > 0) kanji.words = validWords;
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
if (svgList !== void 0) {
|
|
2364
|
+
const codePoint = kanji.kanji.codePointAt(0).toString(16).toLowerCase();
|
|
2365
|
+
const svg = svgList instanceof Map ? svgList.get(kanji.kanji) : svgList.find(
|
|
2366
|
+
(svgFile) => [`${codePoint}.svg`, `0${codePoint}.svg`].includes(
|
|
2367
|
+
svgFile.toLowerCase()
|
|
2368
|
+
)
|
|
2369
|
+
);
|
|
2370
|
+
if (svg !== void 0) kanji.svg = svg;
|
|
2371
|
+
}
|
|
2372
|
+
if (dictKanji.isKokuji === true) {
|
|
2373
|
+
kanji.kokuji = true;
|
|
2374
|
+
kanji.tags.push("kanji::kokuji");
|
|
2375
|
+
}
|
|
2376
|
+
kanji.tags.push(
|
|
2377
|
+
`kanji::strokes::${kanji.strokes}`,
|
|
2378
|
+
...kanji.frequency !== void 0 ? [`kanji::frequency::${kanji.frequency}`] : [],
|
|
2379
|
+
...kanji.grade !== void 0 ? [`kanji::grade::${kanji.grade}`] : [],
|
|
2380
|
+
...kanji.jlpt !== void 0 ? [`kanji::pre-2010_jlpt::${kanji.jlpt.toLowerCase()}`] : [],
|
|
2381
|
+
`kanji::onyomi::${(_h = (_g = kanji.onyomi) == null ? void 0 : _g.length) != null ? _h : 0}`,
|
|
2382
|
+
`kanji::kunyomi::${(_j = (_i = kanji.kunyomi) == null ? void 0 : _i.length) != null ? _j : 0}`,
|
|
2383
|
+
`kanji::nanori::${(_l = (_k = kanji.nanori) == null ? void 0 : _k.length) != null ? _l : 0}`,
|
|
2384
|
+
`kanji::words::${(_n = (_m = kanji.words) == null ? void 0 : _m.length) != null ? _n : 0}`,
|
|
2385
|
+
...kanji.svg !== void 0 ? ["kanji::has_svg"] : []
|
|
2386
|
+
);
|
|
2387
|
+
return kanji;
|
|
2388
|
+
} else return void 0;
|
|
2389
|
+
}
|
|
2390
|
+
function getKanjiExtended(info, kanji, dict, useWords, jmDict, svgList, noteTypeName, deckPath, sourceURL) {
|
|
2391
|
+
const kanjiObj = getKanji(
|
|
2392
|
+
kanji,
|
|
2393
|
+
dict,
|
|
2394
|
+
jmDict,
|
|
2395
|
+
svgList,
|
|
2396
|
+
noteTypeName,
|
|
2397
|
+
deckPath
|
|
2398
|
+
);
|
|
2399
|
+
if (kanjiObj !== void 0) {
|
|
2400
|
+
let usedInfo = false;
|
|
2401
|
+
if (info.components !== void 0) {
|
|
2402
|
+
kanjiObj.components = info.components;
|
|
2403
|
+
kanjiObj.tags.push(`kanji::components::${kanjiObj.components.length}`);
|
|
2404
|
+
usedInfo = true;
|
|
2405
|
+
}
|
|
2406
|
+
if (info.mnemonic !== void 0 && info.mnemonic.length > 0) {
|
|
2407
|
+
kanjiObj.mnemonic = info.mnemonic;
|
|
2408
|
+
kanjiObj.tags.push("kanji::has_mnemonic");
|
|
2409
|
+
usedInfo = true;
|
|
2410
|
+
}
|
|
2411
|
+
if (useWords === true && info.words !== void 0 && info.words.length > 0) {
|
|
2412
|
+
kanjiObj.words = info.words;
|
|
2413
|
+
kanjiObj.tags.forEach((tag, index) => {
|
|
2414
|
+
if (tag.startsWith("kanji::words::") && kanjiObj.words !== void 0)
|
|
2415
|
+
kanjiObj.tags.splice(
|
|
2416
|
+
index,
|
|
2417
|
+
1,
|
|
2418
|
+
`kanji::words::${kanjiObj.words.length}`
|
|
2419
|
+
);
|
|
2420
|
+
});
|
|
2421
|
+
usedInfo = true;
|
|
2422
|
+
}
|
|
2423
|
+
if (sourceURL !== void 0 && info.externalInfo === true && usedInfo)
|
|
2424
|
+
kanjiObj.source = sourceURL;
|
|
2425
|
+
return kanjiObj;
|
|
2426
|
+
} else return void 0;
|
|
2427
|
+
}
|
|
2428
|
+
function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeName, deckPath) {
|
|
2251
2429
|
var _a, _b;
|
|
2252
2430
|
let dictWord = void 0;
|
|
2253
|
-
if (typeof
|
|
2431
|
+
if (typeof searchedWord === "string" && dict !== void 0) {
|
|
2254
2432
|
if (Array.isArray(dict))
|
|
2255
2433
|
dictWord = dict.find(
|
|
2256
|
-
(entry) => entry.id ===
|
|
2434
|
+
(entry) => entry.id === searchedWord
|
|
2257
2435
|
);
|
|
2258
|
-
if (dict instanceof Map) dictWord = dict.get(
|
|
2436
|
+
if (dict instanceof Map) dictWord = dict.get(searchedWord);
|
|
2259
2437
|
}
|
|
2260
|
-
if (typeof
|
|
2261
|
-
if (dictWord) {
|
|
2262
|
-
const
|
|
2438
|
+
if (typeof searchedWord === "object") dictWord = searchedWord;
|
|
2439
|
+
if (dictWord !== void 0) {
|
|
2440
|
+
const word = {
|
|
2263
2441
|
id: dictWord.id,
|
|
2264
2442
|
readings: [],
|
|
2265
2443
|
translations: [],
|
|
@@ -2269,46 +2447,46 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2269
2447
|
tags: []
|
|
2270
2448
|
};
|
|
2271
2449
|
if (dictWord.isCommon === true) {
|
|
2272
|
-
|
|
2273
|
-
|
|
2450
|
+
word.common = true;
|
|
2451
|
+
word.tags.push("word::common");
|
|
2274
2452
|
}
|
|
2275
|
-
if (dictWord.kanjiForms)
|
|
2276
|
-
|
|
2453
|
+
if (dictWord.kanjiForms !== void 0)
|
|
2454
|
+
word.kanjiForms = dictWord.kanjiForms.map(
|
|
2277
2455
|
(dictKanjiForm) => ({
|
|
2278
2456
|
kanjiForm: dictKanjiForm.form,
|
|
2279
|
-
...dictKanjiForm.notes ? {
|
|
2457
|
+
...dictKanjiForm.notes !== void 0 ? {
|
|
2280
2458
|
notes: dictKanjiForm.notes.map((note) => {
|
|
2281
2459
|
const noteAndTag = lookupWordNote(
|
|
2282
2460
|
note,
|
|
2283
2461
|
[],
|
|
2284
|
-
|
|
2462
|
+
word.tags
|
|
2285
2463
|
);
|
|
2286
2464
|
return capitalizeString(noteAndTag.note);
|
|
2287
2465
|
})
|
|
2288
2466
|
} : {},
|
|
2289
|
-
...dictKanjiForm.commonness && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
|
|
2467
|
+
...dictKanjiForm.commonness !== void 0 && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
|
|
2290
2468
|
})
|
|
2291
2469
|
);
|
|
2292
|
-
|
|
2470
|
+
word.readings = dictWord.readings.map((dictReading) => ({
|
|
2293
2471
|
reading: dictReading.reading,
|
|
2294
|
-
...dictReading.kanjiFormRestrictions || dictReading.notes ? {
|
|
2472
|
+
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.notes !== void 0 ? {
|
|
2295
2473
|
notes: [
|
|
2296
|
-
...dictReading.kanjiFormRestrictions ? dictReading.kanjiFormRestrictions.map(
|
|
2474
|
+
...dictReading.kanjiFormRestrictions !== void 0 ? dictReading.kanjiFormRestrictions.map(
|
|
2297
2475
|
(restriction) => `Reading restricted to ${restriction}`
|
|
2298
2476
|
) : [],
|
|
2299
|
-
...dictReading.notes ? dictReading.notes.map((note) => {
|
|
2477
|
+
...dictReading.notes !== void 0 ? dictReading.notes.map((note) => {
|
|
2300
2478
|
const noteAndTag = lookupWordNote(
|
|
2301
2479
|
note,
|
|
2302
2480
|
[],
|
|
2303
|
-
|
|
2481
|
+
word.tags
|
|
2304
2482
|
);
|
|
2305
2483
|
return capitalizeString(noteAndTag.note);
|
|
2306
2484
|
}) : []
|
|
2307
2485
|
]
|
|
2308
2486
|
} : {},
|
|
2309
|
-
...dictReading.commonness && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
2487
|
+
...dictReading.commonness !== void 0 && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
2310
2488
|
}));
|
|
2311
|
-
|
|
2489
|
+
word.translations = [];
|
|
2312
2490
|
for (const dictMeaning of dictWord.meanings) {
|
|
2313
2491
|
const translationTypes = [];
|
|
2314
2492
|
const translations = dictMeaning.translations.map(
|
|
@@ -2319,7 +2497,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2319
2497
|
translation.type
|
|
2320
2498
|
);
|
|
2321
2499
|
translationTypes.push(translationNoteAndTag[1]);
|
|
2322
|
-
|
|
2500
|
+
word.tags.push(`word::${translationNoteAndTag[0]}`);
|
|
2323
2501
|
return translation.translation;
|
|
2324
2502
|
}
|
|
2325
2503
|
}
|
|
@@ -2336,15 +2514,15 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2336
2514
|
for (const t of translationTypes) notes.push(t);
|
|
2337
2515
|
wordAddNoteArray(
|
|
2338
2516
|
dictMeaning.partOfSpeech,
|
|
2339
|
-
(pos) => lookupWordNote(pos, notes,
|
|
2517
|
+
(pos) => lookupWordNote(pos, notes, word.tags)
|
|
2340
2518
|
);
|
|
2341
2519
|
wordAddNoteArray(
|
|
2342
2520
|
dictMeaning.fields,
|
|
2343
|
-
(field) => lookupWordNote(field, notes,
|
|
2521
|
+
(field) => lookupWordNote(field, notes, word.tags)
|
|
2344
2522
|
);
|
|
2345
2523
|
wordAddNoteArray(
|
|
2346
2524
|
dictMeaning.dialects,
|
|
2347
|
-
(dialect) => lookupWordNote(dialect, notes,
|
|
2525
|
+
(dialect) => lookupWordNote(dialect, notes, word.tags)
|
|
2348
2526
|
);
|
|
2349
2527
|
wordAddNoteArray(
|
|
2350
2528
|
dictMeaning.antonyms,
|
|
@@ -2356,45 +2534,45 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2356
2534
|
);
|
|
2357
2535
|
wordAddNoteArray(
|
|
2358
2536
|
dictMeaning.info,
|
|
2359
|
-
(info) => lookupWordNote(info, notes,
|
|
2537
|
+
(info) => lookupWordNote(info, notes, word.tags)
|
|
2360
2538
|
);
|
|
2361
2539
|
wordAddNoteArray(
|
|
2362
2540
|
dictMeaning.misc,
|
|
2363
|
-
(misc) => lookupWordNote(misc, notes,
|
|
2541
|
+
(misc) => lookupWordNote(misc, notes, word.tags)
|
|
2364
2542
|
);
|
|
2365
2543
|
for (let i = 0; i < notes.length; i++)
|
|
2366
2544
|
notes[i] = capitalizeString(notes[i]);
|
|
2367
|
-
|
|
2545
|
+
word.translations.push({
|
|
2368
2546
|
translation: translations.join("; "),
|
|
2369
2547
|
notes
|
|
2370
2548
|
});
|
|
2371
2549
|
}
|
|
2372
2550
|
if (dictWord.usuallyInKana === true) {
|
|
2373
|
-
|
|
2374
|
-
|
|
2551
|
+
word.usuallyInKana = true;
|
|
2552
|
+
word.tags.push("word::usually_in_kana_for_all_senses");
|
|
2375
2553
|
}
|
|
2376
|
-
if (kanjiDic &&
|
|
2554
|
+
if (kanjiDic !== void 0 && word.kanjiForms !== void 0) {
|
|
2377
2555
|
const kanji = [];
|
|
2378
2556
|
const seenChars = /* @__PURE__ */ new Set();
|
|
2379
|
-
for (const kanjiForm of
|
|
2557
|
+
for (const kanjiForm of word.kanjiForms)
|
|
2380
2558
|
for (const char of kanjiForm.kanjiForm.split("").filter((c) => regexps.kanji.test(c))) {
|
|
2381
2559
|
if (seenChars.has(char)) continue;
|
|
2382
2560
|
seenChars.add(char);
|
|
2383
2561
|
const kanjiEntry = kanjiDic instanceof Map ? kanjiDic.get(char) : void 0;
|
|
2384
2562
|
const kanjiObj = getKanji(
|
|
2385
2563
|
kanjiEntry != null ? kanjiEntry : char,
|
|
2386
|
-
|
|
2564
|
+
!(kanjiDic instanceof Map) ? kanjiDic : void 0
|
|
2387
2565
|
);
|
|
2388
|
-
if (kanjiObj)
|
|
2566
|
+
if (kanjiObj !== void 0)
|
|
2389
2567
|
kanji.push({
|
|
2390
2568
|
kanji: kanjiObj.kanji,
|
|
2391
|
-
...kanjiObj.meanings && kanjiObj.meanings.length > 0 ? { meanings: kanjiObj.meanings } : {}
|
|
2569
|
+
...kanjiObj.meanings !== void 0 && kanjiObj.meanings.length > 0 ? { meanings: kanjiObj.meanings } : {}
|
|
2392
2570
|
});
|
|
2393
2571
|
}
|
|
2394
|
-
if (kanji.length > 0)
|
|
2572
|
+
if (kanji.length > 0) word.kanji = kanji;
|
|
2395
2573
|
}
|
|
2396
|
-
if (dictWord.hasPhrases !== void 0
|
|
2397
|
-
const exampleList =
|
|
2574
|
+
if (dictWord.hasPhrases === true && examples !== void 0) {
|
|
2575
|
+
const exampleList = examples instanceof Map ? (_a = examples.get(dictWord.id)) != null ? _a : [] : examples;
|
|
2398
2576
|
const rkf = getValidForms(
|
|
2399
2577
|
dictWord.readings,
|
|
2400
2578
|
dictWord.kanjiForms,
|
|
@@ -2403,7 +2581,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2403
2581
|
const readings = new Set(
|
|
2404
2582
|
rkf.readings.map((r) => r.reading)
|
|
2405
2583
|
);
|
|
2406
|
-
const kanjiForms = rkf.kanjiForms ? new Set(rkf.kanjiForms.map((kf) => kf.form)) : void 0;
|
|
2584
|
+
const kanjiForms = rkf.kanjiForms !== void 0 ? new Set(rkf.kanjiForms.map((kf) => kf.form)) : void 0;
|
|
2407
2585
|
let kanjiFormExamples = [];
|
|
2408
2586
|
const readingMatchingKanjiFormExamples = [];
|
|
2409
2587
|
const readingExamples = [];
|
|
@@ -2414,7 +2592,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2414
2592
|
const readingAsReadingMatch = part.reading !== void 0 && readings.has(part.reading);
|
|
2415
2593
|
const readingAsInflectedFormMatch = part.inflectedForm !== void 0 && readings.has(part.inflectedForm);
|
|
2416
2594
|
const referenceIDMatch = part.referenceID === dictWord.id;
|
|
2417
|
-
if (kanjiForms && kanjiForms.has(part.baseForm) || referenceIDMatch) {
|
|
2595
|
+
if (kanjiForms !== void 0 && kanjiForms.has(part.baseForm) || referenceIDMatch) {
|
|
2418
2596
|
if (readingAsReadingMatch || readingAsInflectedFormMatch) {
|
|
2419
2597
|
readingMatchingKanjiFormExamples.push({
|
|
2420
2598
|
ex: example,
|
|
@@ -2430,30 +2608,33 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2430
2608
|
break;
|
|
2431
2609
|
}
|
|
2432
2610
|
const readingAsBaseFormMatch = readings.has(part.baseForm);
|
|
2433
|
-
if (
|
|
2611
|
+
if (readingAsBaseFormMatch && kanjiForms === void 0) {
|
|
2434
2612
|
readingExamples.push({ ex: example, partIndex: i });
|
|
2435
2613
|
break;
|
|
2436
2614
|
}
|
|
2437
2615
|
}
|
|
2438
2616
|
if (readingMatchingKanjiForms.size > 0)
|
|
2439
2617
|
kanjiFormExamples = kanjiFormExamples.filter(
|
|
2440
|
-
(ex) => ex.form && readingMatchingKanjiForms.has(ex.form)
|
|
2618
|
+
(ex) => ex.form !== void 0 && readingMatchingKanjiForms.has(ex.form)
|
|
2441
2619
|
);
|
|
2442
|
-
const includeKanjiFormExamples =
|
|
2620
|
+
const includeKanjiFormExamples = word.kanjiForms !== void 0;
|
|
2443
2621
|
let wordExamples = [
|
|
2444
2622
|
...includeKanjiFormExamples ? [...readingMatchingKanjiFormExamples, ...kanjiFormExamples] : readingExamples
|
|
2445
2623
|
];
|
|
2624
|
+
wordExamples.sort(
|
|
2625
|
+
(a, b) => a.ex.phrase.length - b.ex.phrase.length
|
|
2626
|
+
);
|
|
2446
2627
|
readingMatchingKanjiForms.clear();
|
|
2447
2628
|
const glossSpecificExamples = [];
|
|
2448
2629
|
const seenPhrases = /* @__PURE__ */ new Set();
|
|
2449
|
-
for (let i = 0; i <
|
|
2630
|
+
for (let i = 0; i < word.translations.length; i++)
|
|
2450
2631
|
outer: for (const example of wordExamples) {
|
|
2451
2632
|
if (seenPhrases.has(example.ex.phrase)) continue;
|
|
2452
2633
|
for (let j = 0; j < example.ex.parts.length; j++) {
|
|
2453
2634
|
const part = example.ex.parts[j];
|
|
2454
2635
|
if (j === example.partIndex && part.glossNumber === i + 1) {
|
|
2455
2636
|
example.ex.glossNumber = {
|
|
2456
|
-
wordId:
|
|
2637
|
+
wordId: word.id,
|
|
2457
2638
|
glossNumber: i + 1
|
|
2458
2639
|
};
|
|
2459
2640
|
glossSpecificExamples.push(example);
|
|
@@ -2462,216 +2643,75 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2462
2643
|
}
|
|
2463
2644
|
}
|
|
2464
2645
|
}
|
|
2465
|
-
}
|
|
2466
2646
|
if (glossSpecificExamples.length > 0) {
|
|
2467
|
-
|
|
2468
|
-
if (exes.length < 5) {
|
|
2647
|
+
if (glossSpecificExamples.length < 5) {
|
|
2469
2648
|
wordExamples = wordExamples.filter(
|
|
2470
2649
|
(ex) => !seenPhrases.has(ex.ex.phrase)
|
|
2471
2650
|
);
|
|
2472
2651
|
if (wordExamples.length > 0)
|
|
2473
2652
|
for (const ex of wordExamples) {
|
|
2474
|
-
|
|
2475
|
-
if (
|
|
2653
|
+
glossSpecificExamples.push(ex);
|
|
2654
|
+
if (glossSpecificExamples.length === 5) break;
|
|
2476
2655
|
}
|
|
2477
2656
|
}
|
|
2478
|
-
wordExamples =
|
|
2657
|
+
wordExamples = glossSpecificExamples;
|
|
2479
2658
|
}
|
|
2480
2659
|
if (wordExamples.length > 0) {
|
|
2481
|
-
|
|
2660
|
+
word.phrases = (glossSpecificExamples.length === 0 ? wordExamples.slice(0, 5) : wordExamples).map((ex) => {
|
|
2482
2661
|
var _a2;
|
|
2483
2662
|
return {
|
|
2484
2663
|
phrase: (_a2 = ex.ex.furigana) != null ? _a2 : ex.ex.phrase,
|
|
2485
2664
|
translation: ex.ex.translation,
|
|
2486
2665
|
originalPhrase: ex.ex.phrase,
|
|
2487
|
-
...ex.ex.glossNumber ? { glossNumber: ex.ex.glossNumber } : {}
|
|
2666
|
+
...ex.ex.glossNumber !== void 0 ? { glossNumber: ex.ex.glossNumber } : {}
|
|
2488
2667
|
};
|
|
2489
2668
|
});
|
|
2490
|
-
|
|
2669
|
+
word.tags.push("word::has_phrases");
|
|
2491
2670
|
if (glossSpecificExamples.length > 0)
|
|
2492
|
-
|
|
2493
|
-
}
|
|
2494
|
-
}
|
|
2495
|
-
if (definitions) {
|
|
2496
|
-
const defs = Array.isArray(definitions) ? (_b = definitions.find((wdp) => wdp.wordID === word2.id)) == null ? void 0 : _b.definitions : definitions.get(word2.id);
|
|
2497
|
-
if (defs) word2.definitions = [...defs];
|
|
2498
|
-
}
|
|
2499
|
-
return word2;
|
|
2500
|
-
} else return void 0;
|
|
2501
|
-
}
|
|
2502
|
-
function getKanji(kanji, dict, jmDict, svgList, noteTypeName, deckPath) {
|
|
2503
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2504
|
-
let dictKanji = void 0;
|
|
2505
|
-
if (typeof kanji === "string" && dict)
|
|
2506
|
-
dictKanji = Array.isArray(dict) ? dict.find((entry) => entry.kanji === kanji) : dict.get(kanji);
|
|
2507
|
-
else if (typeof kanji === "object") dictKanji = kanji;
|
|
2508
|
-
if (dictKanji) {
|
|
2509
|
-
const kanji2 = {
|
|
2510
|
-
kanji: dictKanji.kanji,
|
|
2511
|
-
strokes: dictKanji.misc.strokeNumber,
|
|
2512
|
-
...dictKanji.misc && dictKanji.misc.grade ? { grade: dictKanji.misc.grade } : {},
|
|
2513
|
-
...dictKanji.misc && dictKanji.misc.frequency ? { frequency: dictKanji.misc.frequency } : {},
|
|
2514
|
-
...dictKanji.misc && dictKanji.misc.jlpt ? { jlpt: dictKanji.misc.jlpt } : {},
|
|
2515
|
-
noteID: `kanji_${dictKanji.kanji}`,
|
|
2516
|
-
...noteTypeName ? { noteTypeName } : {},
|
|
2517
|
-
...deckPath ? { deckPath } : {},
|
|
2518
|
-
tags: []
|
|
2519
|
-
};
|
|
2520
|
-
if (dictKanji.readingMeaning && dictKanji.readingMeaning.length > 0) {
|
|
2521
|
-
const meanings = [];
|
|
2522
|
-
const nanori = [];
|
|
2523
|
-
const onyomi = [];
|
|
2524
|
-
const kunyomi = [];
|
|
2525
|
-
for (const rm of dictKanji.readingMeaning) {
|
|
2526
|
-
if (rm.nanori && rm.nanori.length > 0) nanori.push(...rm.nanori);
|
|
2527
|
-
for (const group of rm.groups) {
|
|
2528
|
-
if (group.readings) {
|
|
2529
|
-
onyomi.push(
|
|
2530
|
-
...group.readings.filter((reading) => reading.type === "ja_on").map((reading) => reading.reading)
|
|
2531
|
-
);
|
|
2532
|
-
kunyomi.push(
|
|
2533
|
-
...group.readings.filter(
|
|
2534
|
-
(reading) => reading.type === "ja_kun"
|
|
2535
|
-
).map((reading) => reading.reading)
|
|
2536
|
-
);
|
|
2537
|
-
}
|
|
2538
|
-
if (group.meanings && group.meanings.length > 0)
|
|
2539
|
-
meanings.push(...group.meanings);
|
|
2540
|
-
}
|
|
2541
|
-
}
|
|
2542
|
-
if (meanings.length > 0) kanji2.meanings = meanings;
|
|
2543
|
-
if (nanori.length > 0) kanji2.nanori = nanori;
|
|
2544
|
-
if (onyomi.length > 0) kanji2.onyomi = onyomi;
|
|
2545
|
-
if (kunyomi.length > 0) kanji2.kunyomi = kunyomi;
|
|
2546
|
-
}
|
|
2547
|
-
if (jmDict) {
|
|
2548
|
-
let kanjiWords = Array.isArray(
|
|
2549
|
-
jmDict
|
|
2550
|
-
) ? jmDict : jmDict.get(kanji2.kanji);
|
|
2551
|
-
const firstKfWords = kanjiWords == null ? void 0 : kanjiWords.filter(
|
|
2552
|
-
(word) => word.kanjiForms && word.kanjiForms[0].form.includes(kanji2.kanji)
|
|
2553
|
-
);
|
|
2554
|
-
if (firstKfWords && firstKfWords.length > 0) kanjiWords = firstKfWords;
|
|
2555
|
-
if (kanjiWords) {
|
|
2556
|
-
const validWords = [];
|
|
2557
|
-
for (const word of kanjiWords) {
|
|
2558
|
-
const kanjiForm = (_a = firstKfWords && firstKfWords.length > 0 ? word.kanjiForms[0] : word.kanjiForms.find(
|
|
2559
|
-
(kf) => kf.form.includes(kanji2.kanji)
|
|
2560
|
-
)) == null ? void 0 : _a.form;
|
|
2561
|
-
if (kanjiForm) {
|
|
2562
|
-
const reading = (_b = firstKfWords && firstKfWords.length > 0 ? word.readings[0] : word.readings.find(
|
|
2563
|
-
(reading2) => reading2.kanjiFormRestrictions && reading2.kanjiFormRestrictions.includes(kanjiForm)
|
|
2564
|
-
)) == null ? void 0 : _b.reading;
|
|
2565
|
-
if (!reading) continue;
|
|
2566
|
-
const translation = (_c = firstKfWords && firstKfWords.length > 0 ? word.meanings[0] : word.meanings.find(
|
|
2567
|
-
(m) => m.translations && m.kanjiFormRestrictions && m.kanjiFormRestrictions.includes(kanjiForm)
|
|
2568
|
-
)) == null ? void 0 : _c.translations.map(
|
|
2569
|
-
(t) => typeof t === "string" ? t : t.translation
|
|
2570
|
-
)[0];
|
|
2571
|
-
if (!translation) continue;
|
|
2572
|
-
validWords.push({
|
|
2573
|
-
kanjiForms: [{ kanjiForm }],
|
|
2574
|
-
readings: [{ reading }],
|
|
2575
|
-
translations: [
|
|
2576
|
-
{
|
|
2577
|
-
translation
|
|
2578
|
-
}
|
|
2579
|
-
]
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
if (validWords.length === 3) break;
|
|
2583
|
-
}
|
|
2584
|
-
if (validWords.length > 0) kanji2.words = validWords;
|
|
2671
|
+
word.tags.push("word::has_meaning-specific_phrases");
|
|
2585
2672
|
}
|
|
2586
2673
|
}
|
|
2587
|
-
if (
|
|
2588
|
-
const
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
kanji2.tags.push(
|
|
2601
|
-
`kanji::strokes::${kanji2.strokes}`,
|
|
2602
|
-
...kanji2.frequency ? [`kanji::frequency::${kanji2.frequency}`] : [],
|
|
2603
|
-
...kanji2.grade ? [`kanji::grade::${kanji2.grade}`] : [],
|
|
2604
|
-
...kanji2.jlpt ? [`kanji::pre-2010_jlpt::${kanji2.jlpt.toLowerCase()}`] : [],
|
|
2605
|
-
`kanji::onyomi::${(_e = (_d = kanji2.onyomi) == null ? void 0 : _d.length) != null ? _e : 0}`,
|
|
2606
|
-
`kanji::kunyomi::${(_g = (_f = kanji2.kunyomi) == null ? void 0 : _f.length) != null ? _g : 0}`,
|
|
2607
|
-
`kanji::nanori::${(_i = (_h = kanji2.nanori) == null ? void 0 : _h.length) != null ? _i : 0}`,
|
|
2608
|
-
`kanji::words::${(_k = (_j = kanji2.words) == null ? void 0 : _j.length) != null ? _k : 0}`,
|
|
2609
|
-
...kanji2.svg ? ["kanji::has_svg"] : []
|
|
2610
|
-
);
|
|
2611
|
-
return kanji2;
|
|
2612
|
-
} else return void 0;
|
|
2613
|
-
}
|
|
2614
|
-
function getKanjiExtended(info, kanji, dict, useWords, jmDict, svgList, noteTypeName, deckPath, sourceURL) {
|
|
2615
|
-
const kanjiObj = getKanji(
|
|
2616
|
-
kanji,
|
|
2617
|
-
dict,
|
|
2618
|
-
jmDict,
|
|
2619
|
-
svgList,
|
|
2620
|
-
noteTypeName,
|
|
2621
|
-
deckPath
|
|
2622
|
-
);
|
|
2623
|
-
if (kanjiObj) {
|
|
2624
|
-
let usedInfo = false;
|
|
2625
|
-
if (info.components) {
|
|
2626
|
-
kanjiObj.components = info.components;
|
|
2627
|
-
usedInfo = true;
|
|
2628
|
-
}
|
|
2629
|
-
if (info.mnemonic && info.mnemonic.length > 0) {
|
|
2630
|
-
kanjiObj.mnemonic = info.mnemonic;
|
|
2631
|
-
usedInfo = true;
|
|
2632
|
-
}
|
|
2633
|
-
if (useWords === true && info.words && info.words.length > 0) {
|
|
2634
|
-
kanjiObj.words = info.words;
|
|
2635
|
-
usedInfo = true;
|
|
2674
|
+
if (definitions !== void 0) {
|
|
2675
|
+
const defs = definitions instanceof Map ? definitions.get(word.id) : (_b = definitions.find(
|
|
2676
|
+
(wdp) => wdp.wordID === word.id
|
|
2677
|
+
)) == null ? void 0 : _b.definitions;
|
|
2678
|
+
if (defs !== void 0)
|
|
2679
|
+
word.definitions = [
|
|
2680
|
+
...defs.toSorted(
|
|
2681
|
+
(a, b) => {
|
|
2682
|
+
var _a2, _b2;
|
|
2683
|
+
return ((_a2 = a.mayNotBeAccurate) != null ? _a2 : 0) - ((_b2 = b.mayNotBeAccurate) != null ? _b2 : 0);
|
|
2684
|
+
}
|
|
2685
|
+
)
|
|
2686
|
+
];
|
|
2636
2687
|
}
|
|
2637
|
-
|
|
2638
|
-
kanjiObj.tags.push(`kanji::components::${kanjiObj.components.length}`);
|
|
2639
|
-
if (kanjiObj.mnemonic && kanjiObj.mnemonic.length > 0)
|
|
2640
|
-
kanjiObj.tags.push("kanji::has_mnemonic");
|
|
2641
|
-
if (useWords === true && kanjiObj.words && info.words)
|
|
2642
|
-
kanjiObj.tags.forEach((tag, index) => {
|
|
2643
|
-
if (tag.startsWith("kanji::words::") && kanjiObj.words) {
|
|
2644
|
-
kanjiObj.tags.splice(
|
|
2645
|
-
index,
|
|
2646
|
-
1,
|
|
2647
|
-
`kanji::words::${kanjiObj.words.length}`
|
|
2648
|
-
);
|
|
2649
|
-
}
|
|
2650
|
-
});
|
|
2651
|
-
if (sourceURL && info.externalInfo === true && usedInfo)
|
|
2652
|
-
kanjiObj.source = sourceURL;
|
|
2653
|
-
return kanjiObj;
|
|
2688
|
+
return word;
|
|
2654
2689
|
} else return void 0;
|
|
2655
2690
|
}
|
|
2656
2691
|
function isWord(entry) {
|
|
2657
|
-
|
|
2692
|
+
var _a, _b;
|
|
2693
|
+
return isObjectArray((_a = Object.getOwnPropertyDescriptor(entry, "readings")) == null ? void 0 : _a.value) && isObjectArray((_b = Object.getOwnPropertyDescriptor(entry, "translations")) == null ? void 0 : _b.value);
|
|
2658
2694
|
}
|
|
2659
2695
|
function isRadical(entry) {
|
|
2660
|
-
|
|
2696
|
+
var _a;
|
|
2697
|
+
return typeof ((_a = Object.getOwnPropertyDescriptor(entry, "radical")) == null ? void 0 : _a.value) === "string";
|
|
2661
2698
|
}
|
|
2662
2699
|
function isKanji(entry) {
|
|
2663
|
-
|
|
2700
|
+
var _a;
|
|
2701
|
+
return !Object.hasOwn(entry, "translations") && !Object.hasOwn(entry, "readings") && !Object.hasOwn(entry, "radical") && typeof ((_a = Object.getOwnPropertyDescriptor(entry, "kanji")) == null ? void 0 : _a.value) === "string";
|
|
2664
2702
|
}
|
|
2665
2703
|
function isKana(entry) {
|
|
2666
|
-
|
|
2704
|
+
var _a;
|
|
2705
|
+
return typeof ((_a = Object.getOwnPropertyDescriptor(entry, "kana")) == null ? void 0 : _a.value) === "string";
|
|
2667
2706
|
}
|
|
2668
2707
|
function isGrammar(entry) {
|
|
2669
|
-
|
|
2708
|
+
var _a;
|
|
2709
|
+
return typeof ((_a = Object.getOwnPropertyDescriptor(entry, "point")) == null ? void 0 : _a.value) === "string";
|
|
2670
2710
|
}
|
|
2671
2711
|
var createNotes = (notes, phrase) => `${phrase === true ? "<details><summary>Show translation</summary>" : ""}<ul class="note-list">${notes.map((note) => `<li class="note">${note}</li>`).join("")}</ul>${phrase === true ? "</details>" : ""}`;
|
|
2672
|
-
var createEntry = (entry, notes, phrase, glossSpecific) => `<div class="entry${glossSpecific ? " gloss-specific" : ""}">${entry}${notes && notes.length > 0 ? createNotes(notes, phrase) : ""}</div>`;
|
|
2673
|
-
var noKanjiForms = '<span class="word word-kanjiform">(no kanji forms)</span>';
|
|
2712
|
+
var createEntry = (entry, notes, phrase, glossSpecific) => `<div class="entry${glossSpecific === true ? " gloss-specific" : ""}">${entry}${notes !== void 0 && notes.length > 0 ? createNotes(notes, phrase) : ""}</div>`;
|
|
2674
2713
|
function generateAnkiNote(entry) {
|
|
2714
|
+
var _a, _b;
|
|
2675
2715
|
const fields = [];
|
|
2676
2716
|
if (isWord(entry)) {
|
|
2677
2717
|
const firstReading = createEntry(
|
|
@@ -2683,64 +2723,97 @@ function generateAnkiNote(entry) {
|
|
|
2683
2723
|
`<span class="word word-reading">${readingEntry.reading}${readingEntry.audio !== void 0 ? `<br>[sound:${readingEntry.audio}]` : ""}</span>`,
|
|
2684
2724
|
readingEntry.notes
|
|
2685
2725
|
)
|
|
2686
|
-
).join("")}</details>` :
|
|
2687
|
-
const readingsField =
|
|
2688
|
-
|
|
2689
|
-
);
|
|
2690
|
-
const firstKanjiForm = entry.kanjiForms ? createEntry(
|
|
2726
|
+
).join("")}</details>` : "";
|
|
2727
|
+
const readingsField = `${firstReading}${otherReadings}`;
|
|
2728
|
+
const firstKanjiForm = entry.kanjiForms !== void 0 ? createEntry(
|
|
2691
2729
|
`<span class="word word-kanjiform"><ruby><rb>${entry.kanjiForms[0].kanjiForm}</rb><rt>${entry.readings[0].reading}</rt></ruby></span>`,
|
|
2692
2730
|
entry.kanjiForms[0].notes
|
|
2693
2731
|
) : void 0;
|
|
2694
|
-
const otherKanjiForms = entry.kanjiForms && entry.kanjiForms.length > 1 ? `<details><summary>Show other kanji forms</summary>${entry.kanjiForms.slice(1).map((kanjiFormEntry) => {
|
|
2732
|
+
const otherKanjiForms = entry.kanjiForms !== void 0 && entry.kanjiForms.length > 1 ? `<details><summary>Show other kanji forms</summary>${entry.kanjiForms.slice(1).map((kanjiFormEntry) => {
|
|
2695
2733
|
const restrictedReading = entry.readings.find(
|
|
2696
|
-
(r) => r.notes && r.notes.includes(
|
|
2734
|
+
(r) => r.notes !== void 0 && r.notes.includes(
|
|
2697
2735
|
`Reading restricted to ${kanjiFormEntry.kanjiForm}`
|
|
2698
2736
|
)
|
|
2699
2737
|
);
|
|
2700
|
-
return
|
|
2701
|
-
|
|
2702
|
-
|
|
2738
|
+
return createEntry(
|
|
2739
|
+
`<span class="word word-kanjiform">${restrictedReading !== void 0 ? "<ruby><rb>" : ""}${kanjiFormEntry.kanjiForm}${restrictedReading !== void 0 ? `</rb><rt>${restrictedReading.reading}</rt></ruby>` : ""}</span>`,
|
|
2740
|
+
kanjiFormEntry.notes
|
|
2741
|
+
);
|
|
2742
|
+
}).join("")}</details>` : "";
|
|
2743
|
+
const kanjiFormsField = firstKanjiForm !== void 0 ? `${firstKanjiForm}${otherKanjiForms}` : '<span class="word word-kanjiform">(no kanji forms)</span>';
|
|
2703
2744
|
const firstThreeTranslations = entry.translations.slice(0, 3).map(
|
|
2704
|
-
(translationEntry, index) =>
|
|
2745
|
+
(translationEntry, index) => createEntry(
|
|
2746
|
+
`<span class="word word-translation">${translationEntry.translation}</span>`,
|
|
2747
|
+
translationEntry.notes,
|
|
2748
|
+
void 0,
|
|
2749
|
+
entry.phrases !== void 0 ? entry.phrases.some(
|
|
2750
|
+
(phrase, index2) => index === index2 && phrase.glossNumber !== void 0 && phrase.glossNumber.wordId === entry.id && phrase.glossNumber.glossNumber === index + 1
|
|
2751
|
+
) ? true : void 0 : void 0
|
|
2752
|
+
)
|
|
2753
|
+
).join("");
|
|
2754
|
+
const otherTranslations = entry.translations.length > 3 ? `<details><summary>Show other translations</summary>${entry.translations.map((translationEntry, index) => {
|
|
2755
|
+
if (index < 3) return "null";
|
|
2756
|
+
return createEntry(
|
|
2757
|
+
`<span class="word word-translation">${translationEntry.translation}</span>`,
|
|
2758
|
+
translationEntry.notes,
|
|
2759
|
+
void 0,
|
|
2760
|
+
entry.phrases !== void 0 ? entry.phrases.some(
|
|
2761
|
+
(phrase, index2) => index === index2 && phrase.glossNumber !== void 0 && phrase.glossNumber.wordId === entry.id && phrase.glossNumber.glossNumber === index + 1
|
|
2762
|
+
) ? true : void 0 : void 0
|
|
2763
|
+
);
|
|
2764
|
+
}).filter((translation) => translation !== "null").join("")}</details>` : "";
|
|
2765
|
+
const translationsField = `${firstThreeTranslations}${otherTranslations}`;
|
|
2766
|
+
const firstFivePhrases = (_a = entry.phrases) == null ? void 0 : _a.slice(0, 5).map(
|
|
2767
|
+
(phraseEntry, index) => createEntry(
|
|
2768
|
+
`<span class="word word-phrase"><span class="word word-phrase-original">${phraseEntry.originalPhrase}</span><span class="word word-phrase-furigana">${phraseEntry.phrase}</span></span>`,
|
|
2769
|
+
[phraseEntry.translation],
|
|
2770
|
+
true,
|
|
2771
|
+
entry.translations.some(
|
|
2772
|
+
(_translation, index2) => index === index2 && phraseEntry.glossNumber !== void 0 && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2773
|
+
) ? true : void 0
|
|
2774
|
+
)
|
|
2775
|
+
).join("");
|
|
2776
|
+
const otherPhrases = entry.phrases !== void 0 && entry.phrases.length > 5 ? `<details><summary>Show other phrases</summary>${entry.phrases.map((phraseEntry, index) => {
|
|
2777
|
+
if (index < 5) return "null";
|
|
2778
|
+
return createEntry(
|
|
2779
|
+
`<span class="word word-phrase"><span class="word word-phrase-original">${phraseEntry.originalPhrase}</span><span class="word word-phrase-furigana">${phraseEntry.phrase}</span></span>`,
|
|
2780
|
+
[phraseEntry.translation],
|
|
2781
|
+
true,
|
|
2782
|
+
entry.translations.some(
|
|
2783
|
+
(_translation, index2) => index === index2 && phraseEntry.glossNumber !== void 0 && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2784
|
+
) ? true : void 0
|
|
2785
|
+
);
|
|
2786
|
+
}).filter((phrase) => phrase !== "null").join("")}</details>` : "";
|
|
2787
|
+
const phrasesField = firstFivePhrases !== void 0 ? `${firstFivePhrases}${otherPhrases}` : '<span class="word word-phrase">(no phrases) (Search on dictionaries!)</span>';
|
|
2788
|
+
const firstThreeDefinitions = (_b = entry.definitions) == null ? void 0 : _b.slice(0, 3).map(
|
|
2789
|
+
(definitionEntry) => {
|
|
2790
|
+
var _a2;
|
|
2791
|
+
return createEntry(
|
|
2792
|
+
`<span class="word word-definition${definitionEntry.mayNotBeAccurate === 2 ? " mnba2" : definitionEntry.mayNotBeAccurate === 1 ? " mnba1" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a2 = definitionEntry.furigana) != null ? _a2 : definitionEntry.definition}</span></span>`
|
|
2793
|
+
);
|
|
2794
|
+
}
|
|
2705
2795
|
).join("");
|
|
2706
|
-
const
|
|
2707
|
-
(
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2796
|
+
const otherDefinitions = entry.definitions !== void 0 && entry.definitions.length > 3 ? `<details><summary>Show other definitions</summary>${entry.definitions.map(
|
|
2797
|
+
(definitionEntry, index) => {
|
|
2798
|
+
var _a2;
|
|
2799
|
+
return index > 2 ? createEntry(
|
|
2800
|
+
`<span class="word word-definition${definitionEntry.mayNotBeAccurate === 2 ? " mnba2" : definitionEntry.mayNotBeAccurate === 1 ? " mnba1" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a2 = definitionEntry.furigana) != null ? _a2 : definitionEntry.definition}</span></span>`
|
|
2801
|
+
) : "null";
|
|
2802
|
+
}
|
|
2803
|
+
).filter((definition) => definition !== "null").join("")}</details>` : "";
|
|
2804
|
+
const definitionsField = firstThreeDefinitions !== void 0 ? `${firstThreeDefinitions}${otherDefinitions}` : '<span class="word word-definition">(no definitions)</span>';
|
|
2713
2805
|
fields.push(
|
|
2714
|
-
...entry.kanjiForms
|
|
2715
|
-
readingsField,
|
|
2716
|
-
entry.kanjiForms && kanjiFormsField ? kanjiFormsField : noKanjiForms
|
|
2717
|
-
],
|
|
2806
|
+
...entry.kanjiForms !== void 0 && !entry.usuallyInKana ? [kanjiFormsField, readingsField] : [readingsField, kanjiFormsField],
|
|
2718
2807
|
translationsField,
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
[phraseEntry.translation],
|
|
2723
|
-
true,
|
|
2724
|
-
entry.translations.some(
|
|
2725
|
-
(_translation, index2) => index === index2 && phraseEntry.glossNumber && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2726
|
-
) ? true : void 0
|
|
2727
|
-
)
|
|
2728
|
-
).join("") : '<span class="word word-phrase">(no phrases) (Search on dictionaries!)</span>',
|
|
2729
|
-
entry.definitions ? entry.definitions.map(
|
|
2730
|
-
(definitionEntry) => {
|
|
2731
|
-
var _a;
|
|
2732
|
-
return createEntry(
|
|
2733
|
-
`<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>`
|
|
2734
|
-
);
|
|
2735
|
-
}
|
|
2736
|
-
).join("") : '<span class="word word-definition">(no definitions)</span>',
|
|
2737
|
-
entry.kanji ? entry.kanji.map(
|
|
2808
|
+
phrasesField,
|
|
2809
|
+
definitionsField,
|
|
2810
|
+
entry.kanji !== void 0 ? entry.kanji.map(
|
|
2738
2811
|
(kanjiEntry) => createEntry(
|
|
2739
2812
|
`<span class="word word-kanji">${kanjiEntry.kanji}${kanjiEntry.meanings === void 0 ? " (no meanings)" : ""}</span>`,
|
|
2740
2813
|
kanjiEntry.meanings
|
|
2741
2814
|
)
|
|
2742
2815
|
).join("") : '<span class="word word-kanji">(no kanji)</span>',
|
|
2743
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2816
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2744
2817
|
entry.tags.map(
|
|
2745
2818
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2746
2819
|
).join(" ")
|
|
@@ -2760,19 +2833,19 @@ function generateAnkiNote(entry) {
|
|
|
2760
2833
|
`<span class="radical radical-meaning">${meaningEntry}</span>`
|
|
2761
2834
|
)
|
|
2762
2835
|
).join(""),
|
|
2763
|
-
entry.mnemonic ? createEntry(
|
|
2836
|
+
entry.mnemonic !== void 0 ? createEntry(
|
|
2764
2837
|
`<span class="radical radical-mnemonic">${entry.mnemonic}</span>`
|
|
2765
2838
|
) : '<span class="radical radical-mnemonic">(no mnemonic) (Come up with your own!)</span>',
|
|
2766
|
-
entry.kanji ? entry.kanji.map(
|
|
2839
|
+
entry.kanji !== void 0 ? entry.kanji.map(
|
|
2767
2840
|
(kanji) => createEntry(
|
|
2768
|
-
`<span class="radical radical-kanji">${kanji.kanji}${kanji.meanings && kanji.meanings.length
|
|
2841
|
+
`<span class="radical radical-kanji">${kanji.kanji}${kanji.meanings !== void 0 && kanji.meanings.length > 0 ? ` - ${kanji.meanings[0]}` : ""}</span>`
|
|
2769
2842
|
)
|
|
2770
2843
|
).join("") : '<span class="radical radical-kanji">(no "used-in" kanji)</span>',
|
|
2771
|
-
entry.strokes ? createEntry(
|
|
2772
|
-
`<span class="radical radical-strokes">${entry.strokes}<br>${entry.svg ? `<img class="radical radical-stroke-order" src="${entry.svg}" alt="${entry.radical} stroke order SVG">` : "(no stroke order SVG available)"}</span>`
|
|
2844
|
+
entry.strokes !== void 0 ? createEntry(
|
|
2845
|
+
`<span class="radical radical-strokes">${entry.strokes}<br>${entry.svg !== void 0 ? `<img class="radical radical-stroke-order" src="${entry.svg}" alt="${entry.radical} stroke order SVG">` : "(no stroke order SVG available)"}</span>`
|
|
2773
2846
|
) : '<span class="radical radical-strokes">(no stroke number)</span>',
|
|
2774
|
-
entry.sources ? `<span class="radical radical-source">${entry.sources.map((source, index) => `<a href="${source}" target="_blank">Source ${index + 1}</a>`).join("<br>")}</span>` : '<span class="radical radical-source">(no sources)</span>',
|
|
2775
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2847
|
+
entry.sources !== void 0 ? `<span class="radical radical-source">${entry.sources.map((source, index) => `<a href="${source}" target="_blank">Source ${index + 1}</a>`).join("<br>")}</span>` : '<span class="radical radical-source">(no sources)</span>',
|
|
2848
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2776
2849
|
entry.tags.map(
|
|
2777
2850
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2778
2851
|
).join(" ")
|
|
@@ -2781,44 +2854,44 @@ function generateAnkiNote(entry) {
|
|
|
2781
2854
|
if (isKanji(entry))
|
|
2782
2855
|
fields.push(
|
|
2783
2856
|
createEntry(`<span class="kanji kanji-character">${entry.kanji}</span>`),
|
|
2784
|
-
entry.meanings ? entry.meanings.map(
|
|
2857
|
+
entry.meanings !== void 0 ? entry.meanings.map(
|
|
2785
2858
|
(meaningEntry) => createEntry(
|
|
2786
2859
|
`<span class="kanji kanji-meaning">${meaningEntry}</span>`
|
|
2787
2860
|
)
|
|
2788
2861
|
).join("") : '<span class="kanji kanji-meaning">(no meanings)</span>',
|
|
2789
|
-
entry.onyomi ? entry.onyomi.map(
|
|
2862
|
+
entry.onyomi !== void 0 ? entry.onyomi.map(
|
|
2790
2863
|
(onyomiEntry) => createEntry(
|
|
2791
2864
|
`<span class="kanji kanji-onyomi">${onyomiEntry}</span>`
|
|
2792
2865
|
)
|
|
2793
|
-
).join("") : `<span class="kanji kanji-onyomi">(no onyomi) ${entry.kokuji === true ? "(kokuji)" : ""}</span
|
|
2794
|
-
entry.kunyomi ? entry.kunyomi.map(
|
|
2866
|
+
).join("") : `<span class="kanji kanji-onyomi">(no onyomi) ${entry.kokuji === true ? "(kokuji)" : ""}</span>`,
|
|
2867
|
+
entry.kunyomi !== void 0 ? entry.kunyomi.map(
|
|
2795
2868
|
(kunyomiEntry) => createEntry(
|
|
2796
2869
|
`<span class="kanji kanji-kunyomi">${kunyomiEntry}</span>`
|
|
2797
2870
|
)
|
|
2798
2871
|
).join("") : `<span class="kanji kanji-kunyomi">(no kunyomi) ${entry.kokuji === true ? "(kokuji)" : ""}</span>`,
|
|
2799
|
-
entry.nanori ? entry.nanori.map(
|
|
2872
|
+
entry.nanori !== void 0 ? entry.nanori.map(
|
|
2800
2873
|
(nanoriEntry) => createEntry(
|
|
2801
2874
|
`<span class="kanji kanji-nanori">${nanoriEntry}</span>`
|
|
2802
2875
|
)
|
|
2803
2876
|
).join("") : '<span class="kanji kanji-nanori">(no nanori)</span>',
|
|
2804
|
-
entry.components ? entry.components.map(
|
|
2877
|
+
entry.components !== void 0 ? entry.components.map(
|
|
2805
2878
|
(componentEntry) => createEntry(
|
|
2806
|
-
`<span class="kanji kanji-component">${componentEntry.component}${componentEntry.meaning ? ` - ${componentEntry.meaning}` : ""}</span>`
|
|
2879
|
+
`<span class="kanji kanji-component">${componentEntry.component}${componentEntry.meaning !== void 0 ? ` - ${componentEntry.meaning}` : ""}</span>`
|
|
2807
2880
|
)
|
|
2808
2881
|
).join("") : '<span class="kanji kanji-component">(no components)</span>',
|
|
2809
|
-
entry.mnemonic ? createEntry(
|
|
2882
|
+
entry.mnemonic !== void 0 ? createEntry(
|
|
2810
2883
|
`<span class="kanji kanji-mnemonic">${entry.mnemonic}</span>`
|
|
2811
2884
|
) : '<span class="kanji kanji-mnemonic">(no mnemonic) (Come up with your own!)</span>',
|
|
2812
|
-
entry.words ? entry.words.map(
|
|
2885
|
+
entry.words !== void 0 ? entry.words.map(
|
|
2813
2886
|
(word) => createEntry(
|
|
2814
|
-
`<span class="kanji kanji-words">${word.kanjiForms
|
|
2887
|
+
`<span class="kanji kanji-words">${word.kanjiForms.find((kf) => kf.kanjiForm.includes(entry.kanji)).kanjiForm} / ${word.readings[0].reading} - ${word.translations[0].translation}</span>`
|
|
2815
2888
|
)
|
|
2816
2889
|
).join("") : '<span class="kanji kanji-words">(no words) (Search on dictionaries!)</span>',
|
|
2817
|
-
entry.strokes ? createEntry(
|
|
2818
|
-
`<span class="kanji kanji-strokes">${entry.strokes}<br>${entry.svg ? `<img class="kanji kanji-stroke-order" src="${entry.svg}" alt="${entry.kanji} stroke order SVG">` : "(no stroke order SVG available)"}</span>`
|
|
2890
|
+
entry.strokes !== void 0 ? createEntry(
|
|
2891
|
+
`<span class="kanji kanji-strokes">${entry.strokes}<br>${entry.svg !== void 0 ? `<img class="kanji kanji-stroke-order" src="${entry.svg}" alt="${entry.kanji} stroke order SVG">` : "(no stroke order SVG available)"}</span>`
|
|
2819
2892
|
) : '<span class="kanji kanji-strokes">(no stroke number)</span>',
|
|
2820
|
-
entry.source ? `<span class="kanji kanji-source"><a href="${entry.source}" target="_blank">Source</a></span>` : '<span class="kanji kanji-source">(no components/mnemonic source)</span>',
|
|
2821
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2893
|
+
entry.source !== void 0 ? `<span class="kanji kanji-source"><a href="${entry.source}" target="_blank">Source</a></span>` : '<span class="kanji kanji-source">(no components/mnemonic source)</span>',
|
|
2894
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2822
2895
|
entry.tags.map(
|
|
2823
2896
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2824
2897
|
).join(" ")
|
|
@@ -2830,10 +2903,10 @@ function generateAnkiNote(entry) {
|
|
|
2830
2903
|
createEntry(
|
|
2831
2904
|
`<span class="kana kana-reading">${entry.reading}${entry.audio !== void 0 ? `<br>[sound:${entry.audio}]` : ""}</span>`
|
|
2832
2905
|
),
|
|
2833
|
-
entry.svg ? createEntry(
|
|
2906
|
+
entry.svg !== void 0 ? createEntry(
|
|
2834
2907
|
`<img class="kana kana-stroke-order" src="${entry.svg}" alt="${entry.kana} stroke order SVG">`
|
|
2835
2908
|
) : "(no stroke order SVG available)",
|
|
2836
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2909
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2837
2910
|
entry.tags.map(
|
|
2838
2911
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2839
2912
|
).join(" ")
|
|
@@ -2842,28 +2915,28 @@ function generateAnkiNote(entry) {
|
|
|
2842
2915
|
if (isGrammar(entry))
|
|
2843
2916
|
fields.push(
|
|
2844
2917
|
createEntry(`<span class="grammar grammar-point">${entry.point}</span>`),
|
|
2845
|
-
entry.readings ? entry.readings.map(
|
|
2918
|
+
entry.readings !== void 0 ? entry.readings.map(
|
|
2846
2919
|
(readingEntry) => createEntry(
|
|
2847
2920
|
`<span class="grammar grammar-reading">${readingEntry.reading}</span>`
|
|
2848
2921
|
)
|
|
2849
2922
|
).join("") : '<span class="grammar grammar-reading">(no additional readings)</span>',
|
|
2850
2923
|
createEntry(
|
|
2851
|
-
`<span class="grammar grammar-meaning">${entry.meaning.meaning}${entry.meaning.example && entry.meaning.example.length > 0 ? `<br><span class="grammar grammar-meaning-example">${entry.meaning.example}</span>` : ""}</span>`
|
|
2924
|
+
`<span class="grammar grammar-meaning">${entry.meaning.meaning}${entry.meaning.example !== void 0 && entry.meaning.example.length > 0 ? `<br><span class="grammar grammar-meaning-example">${entry.meaning.example}</span>` : ""}</span>`
|
|
2852
2925
|
),
|
|
2853
|
-
entry.usages ? entry.usages.map(
|
|
2926
|
+
entry.usages !== void 0 ? entry.usages.map(
|
|
2854
2927
|
(usage) => createEntry(
|
|
2855
2928
|
`<span class="grammar grammar-usage">${usage}</span>`
|
|
2856
2929
|
)
|
|
2857
2930
|
).join("") : '<span class="grammar grammar-usage">(no usages)</span>',
|
|
2858
|
-
entry.phrases ? entry.phrases.map(
|
|
2931
|
+
entry.phrases !== void 0 ? entry.phrases.map(
|
|
2859
2932
|
(phraseEntry) => createEntry(
|
|
2860
2933
|
`<span class="grammar grammar-phrase"><span class="grammar grammar-phrase-original">${phraseEntry.originalPhrase}</span><span class="grammar grammar-phrase-furigana">${phraseEntry.phrase}</span></span>`,
|
|
2861
2934
|
[phraseEntry.translation],
|
|
2862
2935
|
true
|
|
2863
2936
|
)
|
|
2864
2937
|
).join("") : '<span class="grammar grammar-phrase">(no phrases) (Search on dictionaries!)</span>',
|
|
2865
|
-
entry.source ? `<span class="grammar grammar-source"><a href="${entry.source}" target="_blank">Source</a></span>` : '<span class="grammar grammar-source">(no source)</span>',
|
|
2866
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2938
|
+
entry.source !== void 0 ? `<span class="grammar grammar-source"><a href="${entry.source}" target="_blank">Source</a></span>` : '<span class="grammar grammar-source">(no source)</span>',
|
|
2939
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2867
2940
|
entry.tags.map(
|
|
2868
2941
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2869
2942
|
).join(" ")
|
|
@@ -2875,8 +2948,9 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2875
2948
|
const headers = [noteHeaderKeys.separator, noteHeaderKeys.html];
|
|
2876
2949
|
let ankiNotes = "";
|
|
2877
2950
|
if (list.length > 0) {
|
|
2878
|
-
|
|
2879
|
-
|
|
2951
|
+
let noteInfo = {};
|
|
2952
|
+
if (defaultNoteInfo !== void 0) noteInfo = { ...defaultNoteInfo };
|
|
2953
|
+
const infoValues = Object.values(noteInfo);
|
|
2880
2954
|
let invalidList = false;
|
|
2881
2955
|
const firstEntry = list[0];
|
|
2882
2956
|
const firstEntryInfo = {
|
|
@@ -2886,7 +2960,7 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2886
2960
|
};
|
|
2887
2961
|
if (infoValues.length === 0 || infoValues.some((value) => value === true || value === void 0)) {
|
|
2888
2962
|
for (const res of list)
|
|
2889
|
-
if (
|
|
2963
|
+
if (noteInfo.guid === true && res.noteID === void 0 || noteInfo.noteType === true && res.noteTypeName === void 0 || noteInfo.deckPath === true && res.deckPath === void 0 || noteInfo.guid === void 0 && typeof res.noteID !== firstEntryInfo.guid || noteInfo.noteType === void 0 && typeof res.noteTypeName !== firstEntryInfo.noteType || noteInfo.deckPath === void 0 && typeof res.deckPath !== firstEntryInfo.deckPath) {
|
|
2890
2964
|
invalidList = true;
|
|
2891
2965
|
break;
|
|
2892
2966
|
}
|
|
@@ -2895,26 +2969,28 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2895
2969
|
const hasHeader = { guid: false, noteType: false, deckPath: false, tags: false };
|
|
2896
2970
|
let headerCount = 0;
|
|
2897
2971
|
ankiNotes = list.filter((result) => result.doNotCreateNote === void 0).map((result) => {
|
|
2898
|
-
if (typeof
|
|
2899
|
-
if (isWord(result) && result.id
|
|
2972
|
+
if (typeof noteInfo.guid === "string" && result.noteID === void 0) {
|
|
2973
|
+
if (isWord(result) && result.id !== void 0)
|
|
2974
|
+
result.noteID = result.id;
|
|
2900
2975
|
if (isKanji(result)) result.noteID = result.kanji;
|
|
2901
2976
|
if (isRadical(result)) result.noteID = result.radical;
|
|
2902
2977
|
if (isKana(result)) result.noteID = result.kana;
|
|
2903
|
-
if (isGrammar(result) && result.id
|
|
2978
|
+
if (isGrammar(result) && result.id !== void 0)
|
|
2979
|
+
result.noteID = result.id;
|
|
2904
2980
|
}
|
|
2905
|
-
if (typeof
|
|
2906
|
-
result.noteTypeName =
|
|
2907
|
-
if (typeof
|
|
2908
|
-
result.deckPath =
|
|
2909
|
-
if (!hasHeader.guid && result.noteID) {
|
|
2981
|
+
if (typeof noteInfo.noteType === "string" && result.noteTypeName === void 0)
|
|
2982
|
+
result.noteTypeName = noteInfo.noteType;
|
|
2983
|
+
if (typeof noteInfo.deckPath === "string" && result.deckPath === void 0)
|
|
2984
|
+
result.deckPath = noteInfo.deckPath;
|
|
2985
|
+
if (!hasHeader.guid && result.noteID !== void 0) {
|
|
2910
2986
|
headers.push(`${noteHeaderKeys.guid}${++headerCount}`);
|
|
2911
2987
|
hasHeader.guid = true;
|
|
2912
2988
|
}
|
|
2913
|
-
if (!hasHeader.noteType && result.noteTypeName) {
|
|
2989
|
+
if (!hasHeader.noteType && result.noteTypeName !== void 0) {
|
|
2914
2990
|
headers.push(`${noteHeaderKeys.notetype}${++headerCount}`);
|
|
2915
2991
|
hasHeader.noteType = true;
|
|
2916
2992
|
}
|
|
2917
|
-
if (!hasHeader.deckPath && result.deckPath) {
|
|
2993
|
+
if (!hasHeader.deckPath && result.deckPath !== void 0) {
|
|
2918
2994
|
headers.push(`${noteHeaderKeys.deck}${++headerCount}`);
|
|
2919
2995
|
hasHeader.deckPath = true;
|
|
2920
2996
|
}
|
|
@@ -2923,7 +2999,7 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2923
2999
|
headers.push(`${noteHeaderKeys.tags}${note.length + headerCount}`);
|
|
2924
3000
|
hasHeader.tags = true;
|
|
2925
3001
|
}
|
|
2926
|
-
return `${result.noteID ? `${result.noteID} ` : ""}${result.noteTypeName ? `${result.noteTypeName} ` : ""}${result.deckPath ? `${result.deckPath} ` : ""}${note.join(" ")}`;
|
|
3002
|
+
return `${result.noteID !== void 0 ? `${result.noteID} ` : ""}${result.noteTypeName !== void 0 ? `${result.noteTypeName} ` : ""}${result.deckPath !== void 0 ? `${result.deckPath} ` : ""}${note.join(" ")}`;
|
|
2927
3003
|
}).join("\n").trim();
|
|
2928
3004
|
}
|
|
2929
3005
|
return `${headers.join("\n")}
|
|
@@ -2950,6 +3026,7 @@ ${ankiNotes}`;
|
|
|
2950
3026
|
getWord,
|
|
2951
3027
|
getWordDefinitions,
|
|
2952
3028
|
getWordDefinitionsWithFurigana,
|
|
3029
|
+
hiraganaToKatakana,
|
|
2953
3030
|
isGrammar,
|
|
2954
3031
|
isKana,
|
|
2955
3032
|
isKanji,
|
|
@@ -2958,9 +3035,11 @@ ${ankiNotes}`;
|
|
|
2958
3035
|
isStringArray,
|
|
2959
3036
|
isValidArrayWithFirstElement,
|
|
2960
3037
|
isWord,
|
|
3038
|
+
katakanaToHiragana,
|
|
2961
3039
|
notSearchedForms,
|
|
2962
3040
|
noteHeaderKeys,
|
|
2963
3041
|
noteMap,
|
|
3042
|
+
posList,
|
|
2964
3043
|
regexps,
|
|
2965
3044
|
shuffleArray
|
|
2966
3045
|
});
|