henkan 2.2.5 → 2.3.1
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/LICENSE.md +1 -1
- package/dist/index.cjs.js +596 -604
- package/dist/index.cjs.js.map +3 -3
- package/dist/index.mjs +585 -587
- 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 +13 -9
- 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 +4 -4
- 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 +11 -6
- 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/tsconfig.json +60 -0
- package/tsconfig.types.json +9 -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?.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?.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,34 +1563,38 @@ function convertKanjiDic(xmlString) {
|
|
|
1490
1563
|
return dict;
|
|
1491
1564
|
}
|
|
1492
1565
|
function convertTanakaCorpus(tanakaString) {
|
|
1493
|
-
var _a;
|
|
1494
1566
|
const tanakaArray = [];
|
|
1495
1567
|
const tanakaParsed = tanakaString.split("\n");
|
|
1496
1568
|
for (let i = 0; i <= tanakaParsed.length; i += 2) {
|
|
1497
1569
|
let a = tanakaParsed[i];
|
|
1498
1570
|
let b = tanakaParsed[i + 1];
|
|
1499
|
-
if (a && b && a.startsWith("A: ") && b.startsWith("B: ")) {
|
|
1571
|
+
if (a !== void 0 && b !== void 0 && a.startsWith("A: ") && b.startsWith("B: ")) {
|
|
1500
1572
|
a = a.replace("A: ", "");
|
|
1501
1573
|
b = b.replace("B: ", "");
|
|
1502
|
-
const idMatch = regexps.tanakaID.exec(a);
|
|
1574
|
+
const idMatch = regexps.tanakaID.exec(a)?.groups["id"]?.trim();
|
|
1575
|
+
const idParts = String(idMatch).split("_");
|
|
1576
|
+
const id = `${Number(idParts[0])}_${Number(idParts[1])}`;
|
|
1503
1577
|
const aParts = a.replace(regexps.tanakaID, "").split(" ");
|
|
1504
1578
|
const bRawParts = b.split(" ").filter((part) => part.trim().length !== 0);
|
|
1505
1579
|
const bParts = [];
|
|
1506
1580
|
for (const part of bRawParts) {
|
|
1507
1581
|
const partMatches = regexps.tanakaPart.exec(part);
|
|
1508
|
-
const baseForm = partMatches
|
|
1582
|
+
const baseForm = partMatches?.groups["base"];
|
|
1509
1583
|
const examplePart = { baseForm };
|
|
1510
|
-
const reading = partMatches
|
|
1511
|
-
const glossNumber = partMatches
|
|
1512
|
-
const inflectedForm = partMatches
|
|
1513
|
-
if (reading)
|
|
1584
|
+
const reading = partMatches?.groups["reading"];
|
|
1585
|
+
const glossNumber = partMatches?.groups["glossnum"];
|
|
1586
|
+
const inflectedForm = partMatches?.groups["inflection"];
|
|
1587
|
+
if (reading !== void 0)
|
|
1514
1588
|
if (regexps.tanakaReferenceID.test(reading)) {
|
|
1515
1589
|
const referenceID = regexps.tanakaReferenceID.exec(reading);
|
|
1516
|
-
examplePart.referenceID =
|
|
1590
|
+
examplePart.referenceID = `${Number(
|
|
1591
|
+
referenceID?.groups["entryid"]
|
|
1592
|
+
)}`;
|
|
1517
1593
|
} else examplePart.reading = reading;
|
|
1518
|
-
if (glossNumber)
|
|
1594
|
+
if (glossNumber !== void 0)
|
|
1519
1595
|
examplePart.glossNumber = glossNumber.startsWith("0") ? Number.parseInt(glossNumber.substring(1)) : Number.parseInt(glossNumber);
|
|
1520
|
-
if (inflectedForm
|
|
1596
|
+
if (inflectedForm !== void 0)
|
|
1597
|
+
examplePart.inflectedForm = inflectedForm;
|
|
1521
1598
|
if (baseForm.endsWith("~")) {
|
|
1522
1599
|
examplePart.edited = true;
|
|
1523
1600
|
examplePart.baseForm = examplePart.baseForm.replace("~", "");
|
|
@@ -1527,7 +1604,7 @@ function convertTanakaCorpus(tanakaString) {
|
|
|
1527
1604
|
const phrase = aParts[0];
|
|
1528
1605
|
const translation = aParts[1];
|
|
1529
1606
|
tanakaArray.push({
|
|
1530
|
-
id
|
|
1607
|
+
id,
|
|
1531
1608
|
phrase: phrase.trim(),
|
|
1532
1609
|
translation: translation.trim(),
|
|
1533
1610
|
parts: bParts
|
|
@@ -1537,34 +1614,26 @@ function convertTanakaCorpus(tanakaString) {
|
|
|
1537
1614
|
return tanakaArray;
|
|
1538
1615
|
}
|
|
1539
1616
|
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;
|
|
1617
|
+
const tanakaArray = convertTanakaCorpus(tanakaString);
|
|
1618
|
+
const kuroshiro = new Kuroshiro.default();
|
|
1619
|
+
await kuroshiro.init(new KuromojiAnalyzer());
|
|
1620
|
+
const convert = kuroshiro.convert.bind(kuroshiro);
|
|
1621
|
+
for (let i = 0; i < tanakaArray.length; i++)
|
|
1622
|
+
if (!tanakaArray[i].phrase.includes("\u30FB"))
|
|
1623
|
+
tanakaArray[i].furigana = String(
|
|
1624
|
+
await convert(tanakaArray[i].phrase, {
|
|
1625
|
+
to: "hiragana",
|
|
1626
|
+
mode: "furigana"
|
|
1556
1627
|
})
|
|
1557
1628
|
);
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1560
|
-
);
|
|
1629
|
+
return tanakaArray;
|
|
1561
1630
|
}
|
|
1562
1631
|
function convertRadkFile(radkBuffer, kanjiDic) {
|
|
1563
1632
|
const fileParsed = import_iconv_lite.default.decode(radkBuffer, "euc-jp").split("\n").filter((line) => !line.startsWith("#"));
|
|
1564
1633
|
const radicals = [];
|
|
1565
1634
|
for (let i = 0; i < fileParsed.length; i++) {
|
|
1566
1635
|
const line = fileParsed[i];
|
|
1567
|
-
if (line && line.startsWith("$ ")) {
|
|
1636
|
+
if (line !== void 0 && line.startsWith("$ ")) {
|
|
1568
1637
|
const radical = {
|
|
1569
1638
|
radical: line.charAt(2).trim(),
|
|
1570
1639
|
strokes: line.substring(4).trim()
|
|
@@ -1572,7 +1641,7 @@ function convertRadkFile(radkBuffer, kanjiDic) {
|
|
|
1572
1641
|
let j = i + 1;
|
|
1573
1642
|
let kanjiLine = fileParsed[j];
|
|
1574
1643
|
const kanjiList = [];
|
|
1575
|
-
while (kanjiLine && !kanjiLine.startsWith("$ ")) {
|
|
1644
|
+
while (kanjiLine !== void 0 && !kanjiLine.startsWith("$ ")) {
|
|
1576
1645
|
const kanjis = kanjiLine.split("");
|
|
1577
1646
|
for (const kanji of kanjis) {
|
|
1578
1647
|
const foundKanji = kanjiDic.find(
|
|
@@ -1583,7 +1652,7 @@ function convertRadkFile(radkBuffer, kanjiDic) {
|
|
|
1583
1652
|
kanjiList.push(kanjiObj);
|
|
1584
1653
|
}
|
|
1585
1654
|
kanjiLine = fileParsed[++j];
|
|
1586
|
-
if (
|
|
1655
|
+
if (kanjiLine === void 0) continue;
|
|
1587
1656
|
if (kanjiLine.startsWith("$ ")) i = j - 1;
|
|
1588
1657
|
}
|
|
1589
1658
|
if (kanjiList.length > 0) radical.kanji = kanjiList;
|
|
@@ -1595,7 +1664,7 @@ function convertRadkFile(radkBuffer, kanjiDic) {
|
|
|
1595
1664
|
function convertKradFile(kradBuffer, kanjiDic, katakanaList) {
|
|
1596
1665
|
const fileParsed = import_iconv_lite.default.decode(kradBuffer, "euc-jp").split("\n").filter((line) => !line.startsWith("#"));
|
|
1597
1666
|
const kanjiWithRadicals = [];
|
|
1598
|
-
for (const line of fileParsed)
|
|
1667
|
+
for (const line of fileParsed)
|
|
1599
1668
|
if (line.length > 0) {
|
|
1600
1669
|
const split = line.split(" : ");
|
|
1601
1670
|
const kanjiChar = split[0];
|
|
@@ -1609,12 +1678,12 @@ function convertKradFile(kradBuffer, kanjiDic, katakanaList) {
|
|
|
1609
1678
|
const foundRadical = kanjiDic.find(
|
|
1610
1679
|
(dictKanji) => dictKanji.kanji === radical
|
|
1611
1680
|
);
|
|
1612
|
-
let radicalObj = foundRadical
|
|
1613
|
-
if (
|
|
1681
|
+
let radicalObj = foundRadical ?? { kanji: radical };
|
|
1682
|
+
if (foundRadical === void 0) {
|
|
1614
1683
|
const katakanaChar = katakanaList.find(
|
|
1615
1684
|
(kana) => kana.kana === radical
|
|
1616
1685
|
);
|
|
1617
|
-
if (
|
|
1686
|
+
if (katakanaChar === void 0) continue;
|
|
1618
1687
|
radicalObj = {
|
|
1619
1688
|
kanji: katakanaChar.kana,
|
|
1620
1689
|
readingMeaning: [
|
|
@@ -1634,11 +1703,9 @@ function convertKradFile(kradBuffer, kanjiDic, katakanaList) {
|
|
|
1634
1703
|
if (kanji.kanji.length === 1 && kanji.radicals.length > 0)
|
|
1635
1704
|
kanjiWithRadicals.push(kanji);
|
|
1636
1705
|
}
|
|
1637
|
-
}
|
|
1638
1706
|
return kanjiWithRadicals;
|
|
1639
1707
|
}
|
|
1640
1708
|
function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs, svgList) {
|
|
1641
|
-
var _a;
|
|
1642
1709
|
const kanjiEntryMap = /* @__PURE__ */ new Map();
|
|
1643
1710
|
const wordIDEntryMap = /* @__PURE__ */ new Map();
|
|
1644
1711
|
const kanjiWordsMap = /* @__PURE__ */ new Map();
|
|
@@ -1648,30 +1715,29 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
|
|
|
1648
1715
|
const wordPartsMap = /* @__PURE__ */ new Map();
|
|
1649
1716
|
const partExamplesMap = /* @__PURE__ */ new Map();
|
|
1650
1717
|
const entryParts = /* @__PURE__ */ new Set();
|
|
1651
|
-
if (kanjiDic)
|
|
1718
|
+
if (kanjiDic !== void 0)
|
|
1652
1719
|
for (const kanji of kanjiDic) kanjiEntryMap.set(kanji.kanji, kanji);
|
|
1653
|
-
if (wordDefinitionPairs)
|
|
1720
|
+
if (wordDefinitionPairs !== void 0)
|
|
1654
1721
|
for (const pair of wordDefinitionPairs)
|
|
1655
1722
|
wordDefinitionsMap.set(pair.wordID, pair.definitions);
|
|
1656
|
-
if (kanjiDic && svgList)
|
|
1723
|
+
if (kanjiDic !== void 0 && svgList !== void 0)
|
|
1657
1724
|
for (const kanji of kanjiDic) {
|
|
1658
1725
|
const codePoint = kanji.kanji.codePointAt(0).toString(16).toLowerCase();
|
|
1659
1726
|
const svg = svgList.find((file) => {
|
|
1660
1727
|
const baseName = file.split(".")[0].toLowerCase();
|
|
1661
1728
|
return baseName === codePoint || baseName === `0${codePoint}`;
|
|
1662
1729
|
});
|
|
1663
|
-
if (svg) kanjiSVGMap.set(kanji.kanji, svg);
|
|
1730
|
+
if (svg !== void 0) kanjiSVGMap.set(kanji.kanji, svg);
|
|
1664
1731
|
}
|
|
1665
|
-
if (jmDict) {
|
|
1732
|
+
if (jmDict !== void 0) {
|
|
1666
1733
|
for (const word of jmDict) {
|
|
1667
1734
|
wordIDEntryMap.set(word.id, word);
|
|
1668
|
-
if (word.kanjiForms)
|
|
1735
|
+
if (word.kanjiForms !== void 0)
|
|
1669
1736
|
for (const kf of word.kanjiForms)
|
|
1670
|
-
for (const char of kf.form.split("").filter((c) => regexps.kanji.test(c)))
|
|
1737
|
+
for (const char of kf.form.split("").filter((c) => regexps.kanji.test(c)))
|
|
1671
1738
|
if (!kanjiWordsMap.has(char)) kanjiWordsMap.set(char, [word]);
|
|
1672
1739
|
else kanjiWordsMap.get(char).push(word);
|
|
1673
|
-
|
|
1674
|
-
if (tanakaExamples) {
|
|
1740
|
+
if (tanakaExamples !== void 0) {
|
|
1675
1741
|
const rkf = getValidForms(
|
|
1676
1742
|
word.readings,
|
|
1677
1743
|
word.kanjiForms,
|
|
@@ -1682,7 +1748,7 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
|
|
|
1682
1748
|
entryParts.add(reading.reading);
|
|
1683
1749
|
localPartParts.add(reading.reading);
|
|
1684
1750
|
}
|
|
1685
|
-
if (rkf.kanjiForms && rkf.kanjiForms.length > 0)
|
|
1751
|
+
if (rkf.kanjiForms !== void 0 && rkf.kanjiForms.length > 0)
|
|
1686
1752
|
for (const kanjiForm of rkf.kanjiForms) {
|
|
1687
1753
|
entryParts.add(kanjiForm.form);
|
|
1688
1754
|
localPartParts.add(kanjiForm.form);
|
|
@@ -1692,58 +1758,56 @@ function createEntryMaps(jmDict, kanjiDic, tanakaExamples, wordDefinitionPairs,
|
|
|
1692
1758
|
wordPartsMap.set(word.id, localPartParts);
|
|
1693
1759
|
}
|
|
1694
1760
|
}
|
|
1695
|
-
if (tanakaExamples) {
|
|
1696
|
-
for (const ex of tanakaExamples)
|
|
1761
|
+
if (tanakaExamples !== void 0) {
|
|
1762
|
+
for (const ex of tanakaExamples)
|
|
1697
1763
|
for (const part of ex.parts) {
|
|
1698
1764
|
if (entryParts.has(part.baseForm)) {
|
|
1699
1765
|
let exList = partExamplesMap.get(
|
|
1700
1766
|
part.baseForm
|
|
1701
1767
|
);
|
|
1702
|
-
if (
|
|
1768
|
+
if (exList === void 0) {
|
|
1703
1769
|
exList = [];
|
|
1704
1770
|
partExamplesMap.set(part.baseForm, exList);
|
|
1705
1771
|
}
|
|
1706
1772
|
exList.push(ex);
|
|
1707
1773
|
}
|
|
1708
|
-
if (part.reading && entryParts.has(part.reading)) {
|
|
1774
|
+
if (part.reading !== void 0 && entryParts.has(part.reading)) {
|
|
1709
1775
|
let exList = partExamplesMap.get(
|
|
1710
1776
|
part.reading
|
|
1711
1777
|
);
|
|
1712
|
-
if (
|
|
1778
|
+
if (exList === void 0) {
|
|
1713
1779
|
exList = [];
|
|
1714
1780
|
partExamplesMap.set(part.reading, exList);
|
|
1715
1781
|
}
|
|
1716
1782
|
exList.push(ex);
|
|
1717
1783
|
}
|
|
1718
|
-
if (part.inflectedForm && entryParts.has(part.inflectedForm)) {
|
|
1784
|
+
if (part.inflectedForm !== void 0 && entryParts.has(part.inflectedForm)) {
|
|
1719
1785
|
let exList = partExamplesMap.get(
|
|
1720
1786
|
part.inflectedForm
|
|
1721
1787
|
);
|
|
1722
|
-
if (
|
|
1788
|
+
if (exList === void 0) {
|
|
1723
1789
|
exList = [];
|
|
1724
1790
|
partExamplesMap.set(part.inflectedForm, exList);
|
|
1725
1791
|
}
|
|
1726
1792
|
exList.push(ex);
|
|
1727
1793
|
}
|
|
1728
|
-
if (part.referenceID && entryParts.has(part.referenceID)) {
|
|
1794
|
+
if (part.referenceID !== void 0 && entryParts.has(part.referenceID)) {
|
|
1729
1795
|
let exList = partExamplesMap.get(
|
|
1730
1796
|
part.referenceID
|
|
1731
1797
|
);
|
|
1732
|
-
if (
|
|
1798
|
+
if (exList === void 0) {
|
|
1733
1799
|
exList = [];
|
|
1734
1800
|
partExamplesMap.set(part.referenceID, exList);
|
|
1735
1801
|
}
|
|
1736
1802
|
exList.push(ex);
|
|
1737
1803
|
}
|
|
1738
1804
|
}
|
|
1739
|
-
}
|
|
1740
1805
|
for (const word of jmDict) {
|
|
1741
|
-
const entryParts2 = wordPartsMap.get(word.id);
|
|
1742
1806
|
const seenEx = /* @__PURE__ */ new Set();
|
|
1743
1807
|
const validExamples = [];
|
|
1744
|
-
for (const p of
|
|
1745
|
-
const examplesForPart =
|
|
1746
|
-
if (
|
|
1808
|
+
for (const p of wordPartsMap.get(word.id)) {
|
|
1809
|
+
const examplesForPart = partExamplesMap.get(p)?.filter((ex) => !seenEx.has(ex.id));
|
|
1810
|
+
if (examplesForPart === void 0) continue;
|
|
1747
1811
|
for (const ex of examplesForPart) {
|
|
1748
1812
|
seenEx.add(ex.id);
|
|
1749
1813
|
validExamples.push(ex);
|
|
@@ -1768,49 +1832,43 @@ function mapEntry(entry) {
|
|
|
1768
1832
|
word: entry.word,
|
|
1769
1833
|
pos_title: entry.pos_title,
|
|
1770
1834
|
senses: entry.senses.filter(
|
|
1771
|
-
(sense) => isObjectArray(sense.form_of)
|
|
1772
|
-
(form) => form.word && typeof form.word === "string"
|
|
1773
|
-
) || isStringArray(sense.glosses)
|
|
1835
|
+
(sense) => (isObjectArray(sense.form_of) ? sense.form_of.every((form) => typeof form.word === "string") : isStringArray(sense.glosses)) === true || isStringArray(sense.glosses)
|
|
1774
1836
|
).map((sense) => ({
|
|
1775
|
-
...sense.form_of ? {
|
|
1776
|
-
form_of: sense.form_of.map((form) => form.word)
|
|
1837
|
+
...isObjectArray(sense.form_of) ? {
|
|
1838
|
+
form_of: sense.form_of.map((form) => String(form.word))
|
|
1777
1839
|
} : {},
|
|
1778
1840
|
glosses: sense.glosses
|
|
1779
1841
|
})),
|
|
1780
|
-
...isObjectArray(entry.forms) && entry.forms.every((form) => typeof form.form === "string") ? { forms: entry.forms.map((form) => form.form) } : {}
|
|
1842
|
+
...isObjectArray(entry.forms) && entry.forms.every((form) => typeof form.form === "string") === true ? { forms: entry.forms.map((form) => String(form.form)) } : {}
|
|
1781
1843
|
};
|
|
1782
1844
|
}
|
|
1783
1845
|
function convertJawiktionarySync(buffer) {
|
|
1784
1846
|
const lines = buffer.toString("utf-8").split("\n");
|
|
1785
1847
|
const entries = [];
|
|
1786
1848
|
for (let i = 0; i < lines.length; i++) {
|
|
1787
|
-
const line = lines[i];
|
|
1788
|
-
if (
|
|
1849
|
+
const line = lines[i]?.trim();
|
|
1850
|
+
if (line === void 0 || line.length === 0) continue;
|
|
1789
1851
|
const obj = JSON.parse(line);
|
|
1790
|
-
if (
|
|
1852
|
+
if (typeof obj === "object" && (obj.lang === "\u65E5\u672C\u8A9E" || obj.lang === "\u53E4\u5178\u65E5\u672C\u8A9E"))
|
|
1791
1853
|
entries.push(mapEntry(obj));
|
|
1792
1854
|
}
|
|
1793
1855
|
return entries;
|
|
1794
1856
|
}
|
|
1795
1857
|
async function convertJawiktionaryAsync(stream) {
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
stream.destroy();
|
|
1811
|
-
resolve(entries);
|
|
1812
|
-
}
|
|
1813
|
-
);
|
|
1858
|
+
const rl = (0, import_readline.createInterface)({
|
|
1859
|
+
input: stream,
|
|
1860
|
+
crlfDelay: Infinity
|
|
1861
|
+
});
|
|
1862
|
+
const entries = [];
|
|
1863
|
+
for await (const line of rl) {
|
|
1864
|
+
const obj = JSON.parse(line.trim());
|
|
1865
|
+
if (typeof obj === "object" && (obj.lang === "\u65E5\u672C\u8A9E" || obj.lang === "\u53E4\u5178\u65E5\u672C\u8A9E"))
|
|
1866
|
+
entries.push(mapEntry(obj));
|
|
1867
|
+
}
|
|
1868
|
+
rl.close();
|
|
1869
|
+
stream.close();
|
|
1870
|
+
stream.destroy();
|
|
1871
|
+
return entries;
|
|
1814
1872
|
}
|
|
1815
1873
|
function parseEntry(entry, definitions, definitionMap) {
|
|
1816
1874
|
for (const sense of entry.senses) {
|
|
@@ -1823,12 +1881,11 @@ function parseEntry(entry, definitions, definitionMap) {
|
|
|
1823
1881
|
}
|
|
1824
1882
|
}
|
|
1825
1883
|
}
|
|
1826
|
-
function getWordDefinitions(
|
|
1827
|
-
var _a, _b, _c, _d, _e;
|
|
1884
|
+
function getWordDefinitions(wiktionaryEntries, jmDict) {
|
|
1828
1885
|
const entries = /* @__PURE__ */ new Map();
|
|
1829
|
-
for (const entry of
|
|
1886
|
+
for (const entry of wiktionaryEntries) {
|
|
1830
1887
|
const ent = entries.get(entry.word);
|
|
1831
|
-
if (ent) ent.push(entry);
|
|
1888
|
+
if (ent !== void 0) ent.push(entry);
|
|
1832
1889
|
else entries.set(entry.word, [entry]);
|
|
1833
1890
|
}
|
|
1834
1891
|
const japaneseDefinitions = [];
|
|
@@ -1842,15 +1899,14 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1842
1899
|
const wordKanjiForms = /* @__PURE__ */ new Set();
|
|
1843
1900
|
const rkf = getValidForms(
|
|
1844
1901
|
word.readings,
|
|
1845
|
-
word.kanjiForms
|
|
1846
|
-
word.isCommon
|
|
1902
|
+
word.kanjiForms
|
|
1847
1903
|
);
|
|
1848
1904
|
for (const r of rkf.readings) {
|
|
1849
1905
|
validReadings.add(r.reading);
|
|
1850
1906
|
wordReadings.add(r.reading);
|
|
1851
1907
|
validForms.add(r.reading);
|
|
1852
1908
|
}
|
|
1853
|
-
if (rkf.kanjiForms && rkf.kanjiForms.length > 0)
|
|
1909
|
+
if (rkf.kanjiForms !== void 0 && rkf.kanjiForms.length > 0)
|
|
1854
1910
|
for (const kf of rkf.kanjiForms) {
|
|
1855
1911
|
validKanjiForms.add(kf.form);
|
|
1856
1912
|
wordKanjiForms.add(kf.form);
|
|
@@ -1870,24 +1926,22 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1870
1926
|
const ents = Array.from(entries.values()).flat();
|
|
1871
1927
|
for (const entry of ents) {
|
|
1872
1928
|
let valid = false;
|
|
1873
|
-
if (validKanjiForms
|
|
1929
|
+
if (validKanjiForms.has(entry.word)) {
|
|
1874
1930
|
valid = true;
|
|
1875
1931
|
for (const sense of entry.senses) {
|
|
1876
|
-
if (sense.form_of && sense.form_of.some((form) => validForms.has(form)))
|
|
1932
|
+
if (sense.form_of !== void 0 && sense.form_of.some((form) => validForms.has(form)))
|
|
1877
1933
|
validFormOfEntries.add(entry.word);
|
|
1878
1934
|
for (const gloss of sense.glosses) {
|
|
1879
1935
|
let hasForm = false;
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1936
|
+
for (const r of validForms)
|
|
1937
|
+
if (gloss.includes(r)) {
|
|
1938
|
+
hasForm = true;
|
|
1939
|
+
break;
|
|
1940
|
+
}
|
|
1887
1941
|
if (hasForm) validGlossesEntries.add(entry.word);
|
|
1888
1942
|
}
|
|
1889
1943
|
}
|
|
1890
|
-
if (entry.forms) {
|
|
1944
|
+
if (entry.forms !== void 0) {
|
|
1891
1945
|
for (const form of entry.forms)
|
|
1892
1946
|
if (validForms.has(form)) validFormsEntries.add(entry.word);
|
|
1893
1947
|
}
|
|
@@ -1895,17 +1949,19 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1895
1949
|
if (validForms.has(entry.word)) {
|
|
1896
1950
|
valid = true;
|
|
1897
1951
|
const ftEntry = entriesWithFormTitlesGlobal.get(entry.word);
|
|
1898
|
-
if (ftEntry) ftEntry.push(entry);
|
|
1952
|
+
if (ftEntry !== void 0) ftEntry.push(entry);
|
|
1899
1953
|
else entriesWithFormTitlesGlobal.set(entry.word, [entry]);
|
|
1900
1954
|
}
|
|
1901
1955
|
if (valid) {
|
|
1902
|
-
const tEntry = validTitleEntries.get(
|
|
1903
|
-
|
|
1956
|
+
const tEntry = validTitleEntries.get(
|
|
1957
|
+
entry.word
|
|
1958
|
+
);
|
|
1959
|
+
if (tEntry !== void 0) tEntry.push(entry);
|
|
1904
1960
|
else validTitleEntries.set(entry.word, [entry]);
|
|
1905
1961
|
}
|
|
1906
|
-
if (entry.forms && validForms.has(entry.word) && entry.forms.some((form) => validForms.has(form))) {
|
|
1962
|
+
if (entry.forms !== void 0 && validForms.has(entry.word) && entry.forms.some((form) => validForms.has(form))) {
|
|
1907
1963
|
const wfEntry = entriesWithFormsGlobal.get(entry.word);
|
|
1908
|
-
if (wfEntry) wfEntry.push(entry);
|
|
1964
|
+
if (wfEntry !== void 0) wfEntry.push(entry);
|
|
1909
1965
|
else entriesWithFormsGlobal.set(entry.word, [entry]);
|
|
1910
1966
|
}
|
|
1911
1967
|
}
|
|
@@ -1920,53 +1976,17 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1920
1976
|
const wfe = Array.from(
|
|
1921
1977
|
entriesWithFormsGlobal.values()
|
|
1922
1978
|
).flat();
|
|
1923
|
-
for (const pos of
|
|
1924
|
-
"\u540D\u8A5E",
|
|
1925
|
-
"\u52D5\u8A5E",
|
|
1926
|
-
"\u6210\u53E5",
|
|
1927
|
-
"\u526F\u8A5E",
|
|
1928
|
-
"\u5F62\u5BB9\u52D5\u8A5E",
|
|
1929
|
-
"\u52A9\u8A5E",
|
|
1930
|
-
"\u611F\u52D5\u8A5E",
|
|
1931
|
-
"\u4EE3\u540D\u8A5E",
|
|
1932
|
-
"\u63A5\u5C3E\u8F9E",
|
|
1933
|
-
"\u63A5\u982D\u8A9E",
|
|
1934
|
-
"\u9020\u8A9E\u6210\u5206",
|
|
1935
|
-
"\u7565\u8A9E",
|
|
1936
|
-
"\u56FA\u6709\u540D\u8A5E",
|
|
1937
|
-
"\u4EBA\u79F0\u4EE3\u540D\u8A5E",
|
|
1938
|
-
"\u63A5\u982D\u8F9E",
|
|
1939
|
-
"\u63A5\u7D9A\u52A9\u8A5E",
|
|
1940
|
-
"\u9593\u6295\u8A5E",
|
|
1941
|
-
"\u52A9\u52D5\u8A5E",
|
|
1942
|
-
"\u5F62\u5BB9\u8A5E",
|
|
1943
|
-
"\u7E2E\u7D04\u5F62",
|
|
1944
|
-
"\u63A5\u8F9E",
|
|
1945
|
-
"\u63A5\u7D9A\u8A5E",
|
|
1946
|
-
"\u9023\u4F53\u8A5E",
|
|
1947
|
-
"\u4EBA\u540D",
|
|
1948
|
-
"\u8A18\u53F7",
|
|
1949
|
-
"\u6570\u8A5E",
|
|
1950
|
-
"\u6163\u7528\u53E5",
|
|
1951
|
-
"\u3053\u3068\u308F\u3056",
|
|
1952
|
-
"\u52A9\u6570\u8A5E",
|
|
1953
|
-
"\u82F1\u6570\u5B57\u6DF7\u5408\u8868\u8A18",
|
|
1954
|
-
"\u52D5\u8A5E\u53E5",
|
|
1955
|
-
"\u6210\u8A9E",
|
|
1956
|
-
"\u610F\u7FA9",
|
|
1957
|
-
"\u982D\u5B57\u8A9E",
|
|
1958
|
-
"\u63A5\u5C3E\u8A9E"
|
|
1959
|
-
]) {
|
|
1979
|
+
for (const pos of posList) {
|
|
1960
1980
|
posMap.set(pos, {});
|
|
1961
1981
|
for (const te of vte)
|
|
1962
1982
|
if (te.pos_title === pos || te.pos_title === "\u548C\u8A9E\u306E\u6F22\u5B57\u8868\u8A18") {
|
|
1963
1983
|
const posEntries = posMap.get(pos);
|
|
1964
1984
|
if (posEntries.title === void 0)
|
|
1965
1985
|
posEntries.title = /* @__PURE__ */ new Map();
|
|
1966
|
-
const
|
|
1986
|
+
const entryList = posEntries.title.get(
|
|
1967
1987
|
te.word
|
|
1968
1988
|
);
|
|
1969
|
-
if (
|
|
1989
|
+
if (entryList !== void 0) entryList.push(te);
|
|
1970
1990
|
else posEntries.title.set(te.word, [te]);
|
|
1971
1991
|
}
|
|
1972
1992
|
for (const ft of fge)
|
|
@@ -1974,8 +1994,8 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1974
1994
|
const posEntries = posMap.get(pos);
|
|
1975
1995
|
if (posEntries.formTitle === void 0)
|
|
1976
1996
|
posEntries.formTitle = /* @__PURE__ */ new Map();
|
|
1977
|
-
const
|
|
1978
|
-
if (
|
|
1997
|
+
const entryList = posEntries.formTitle.get(ft.word);
|
|
1998
|
+
if (entryList !== void 0) entryList.push(ft);
|
|
1979
1999
|
else posEntries.formTitle.set(ft.word, [ft]);
|
|
1980
2000
|
}
|
|
1981
2001
|
for (const wf of wfe)
|
|
@@ -1983,10 +2003,10 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1983
2003
|
const posEntries = posMap.get(pos);
|
|
1984
2004
|
if (posEntries.form === void 0)
|
|
1985
2005
|
posEntries.form = /* @__PURE__ */ new Map();
|
|
1986
|
-
const
|
|
2006
|
+
const entryList = posEntries.form.get(
|
|
1987
2007
|
wf.word
|
|
1988
2008
|
);
|
|
1989
|
-
if (
|
|
2009
|
+
if (entryList !== void 0) entryList.push(wf);
|
|
1990
2010
|
else posEntries.form.set(wf.word, [wf]);
|
|
1991
2011
|
}
|
|
1992
2012
|
}
|
|
@@ -1999,7 +2019,7 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
1999
2019
|
for (const m of word.meanings)
|
|
2000
2020
|
for (const note of m.partOfSpeech) {
|
|
2001
2021
|
const noteEntry = noteMap.get(note);
|
|
2002
|
-
if (noteEntry
|
|
2022
|
+
if (noteEntry?.length === 3) {
|
|
2003
2023
|
const notePos = noteEntry[2];
|
|
2004
2024
|
if (Array.isArray(notePos))
|
|
2005
2025
|
for (const pos of notePos) {
|
|
@@ -2016,76 +2036,64 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2016
2036
|
if (poses.size > 0)
|
|
2017
2037
|
for (const pos of poses) {
|
|
2018
2038
|
const posEntries = posMap.get(pos);
|
|
2019
|
-
if (rkf.kanjiForms)
|
|
2039
|
+
if (rkf.kanjiForms !== void 0)
|
|
2020
2040
|
for (const kf of rkf.kanjiForms) {
|
|
2021
|
-
const te =
|
|
2022
|
-
const fe =
|
|
2023
|
-
if (te)
|
|
2041
|
+
const te = posEntries.title?.get(kf);
|
|
2042
|
+
const fe = posEntries.form?.get(kf);
|
|
2043
|
+
if (te !== void 0)
|
|
2024
2044
|
entriesWithTitles.push(
|
|
2025
2045
|
...te.filter(
|
|
2026
2046
|
(ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
|
|
2027
2047
|
)
|
|
2028
2048
|
);
|
|
2029
|
-
if (fe)
|
|
2049
|
+
if (fe !== void 0)
|
|
2030
2050
|
entriesWithForms.push(
|
|
2031
2051
|
...fe.filter(
|
|
2032
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2033
|
-
(form) =>
|
|
2034
|
-
var _a2;
|
|
2035
|
-
return ((_a2 = rkf.kanjiForms) == null ? void 0 : _a2.has(form)) || rkf.readings.has(form);
|
|
2036
|
-
}
|
|
2052
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2053
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2037
2054
|
)
|
|
2038
2055
|
)
|
|
2039
2056
|
);
|
|
2040
2057
|
}
|
|
2041
2058
|
for (const r of rkf.readings) {
|
|
2042
|
-
const te =
|
|
2043
|
-
const fe =
|
|
2044
|
-
const fte =
|
|
2045
|
-
if (te)
|
|
2059
|
+
const te = posEntries.title?.get(r);
|
|
2060
|
+
const fe = posEntries.form?.get(r);
|
|
2061
|
+
const fte = posEntries.formTitle?.get(r);
|
|
2062
|
+
if (te !== void 0)
|
|
2046
2063
|
entriesWithTitles.push(
|
|
2047
2064
|
...te.filter(
|
|
2048
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2049
|
-
(form) =>
|
|
2050
|
-
var _a2;
|
|
2051
|
-
return ((_a2 = rkf.kanjiForms) == null ? void 0 : _a2.has(form)) || rkf.readings.has(form);
|
|
2052
|
-
}
|
|
2065
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2066
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2053
2067
|
)
|
|
2054
2068
|
)
|
|
2055
2069
|
);
|
|
2056
|
-
if (fe)
|
|
2070
|
+
if (fe !== void 0)
|
|
2057
2071
|
entriesWithForms.push(
|
|
2058
2072
|
...fe.filter(
|
|
2059
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2060
|
-
(form) =>
|
|
2061
|
-
var _a2;
|
|
2062
|
-
return ((_a2 = rkf.kanjiForms) == null ? void 0 : _a2.has(form)) || rkf.readings.has(form);
|
|
2063
|
-
}
|
|
2073
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2074
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2064
2075
|
)
|
|
2065
2076
|
)
|
|
2066
2077
|
);
|
|
2067
|
-
if (fte) entriesWithFormTitles.push(...fte);
|
|
2078
|
+
if (fte !== void 0) entriesWithFormTitles.push(...fte);
|
|
2068
2079
|
}
|
|
2069
2080
|
}
|
|
2070
2081
|
if (entriesWithTitles.length === 0 && entriesWithFormTitles.length === 0 && entriesWithForms.length === 0) {
|
|
2071
|
-
if (rkf.kanjiForms)
|
|
2082
|
+
if (rkf.kanjiForms !== void 0)
|
|
2072
2083
|
for (const kf of rkf.kanjiForms) {
|
|
2073
2084
|
const te = validTitleEntries.get(kf);
|
|
2074
2085
|
const fe = entriesWithFormsGlobal.get(kf);
|
|
2075
|
-
if (te)
|
|
2086
|
+
if (te !== void 0)
|
|
2076
2087
|
entriesWithTitles.push(
|
|
2077
2088
|
...te.filter(
|
|
2078
2089
|
(ent) => validFormOfEntries.has(ent.word) || validGlossesEntries.has(ent.word) || validFormsEntries.has(ent.word)
|
|
2079
2090
|
)
|
|
2080
2091
|
);
|
|
2081
|
-
if (fe)
|
|
2092
|
+
if (fe !== void 0)
|
|
2082
2093
|
entriesWithForms.push(
|
|
2083
2094
|
...fe.filter(
|
|
2084
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2085
|
-
(form) =>
|
|
2086
|
-
var _a2;
|
|
2087
|
-
return ((_a2 = rkf.kanjiForms) == null ? void 0 : _a2.has(form)) || rkf.readings.has(form);
|
|
2088
|
-
}
|
|
2095
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2096
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2089
2097
|
)
|
|
2090
2098
|
)
|
|
2091
2099
|
);
|
|
@@ -2094,37 +2102,31 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2094
2102
|
const te = validTitleEntries.get(r);
|
|
2095
2103
|
const fe = entriesWithFormsGlobal.get(r);
|
|
2096
2104
|
const fte = entriesWithFormTitlesGlobal.get(r);
|
|
2097
|
-
if (te)
|
|
2105
|
+
if (te !== void 0)
|
|
2098
2106
|
entriesWithTitles.push(
|
|
2099
2107
|
...te.filter(
|
|
2100
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2101
|
-
(form) =>
|
|
2102
|
-
var _a2;
|
|
2103
|
-
return ((_a2 = rkf.kanjiForms) == null ? void 0 : _a2.has(form)) || rkf.readings.has(form);
|
|
2104
|
-
}
|
|
2108
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2109
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2105
2110
|
)
|
|
2106
2111
|
)
|
|
2107
2112
|
);
|
|
2108
|
-
if (fe)
|
|
2113
|
+
if (fe !== void 0)
|
|
2109
2114
|
entriesWithForms.push(
|
|
2110
2115
|
...fe.filter(
|
|
2111
|
-
(ent) => ent.forms && ent.forms.some(
|
|
2112
|
-
(form) =>
|
|
2113
|
-
var _a2;
|
|
2114
|
-
return ((_a2 = rkf.kanjiForms) == null ? void 0 : _a2.has(form)) || rkf.readings.has(form);
|
|
2115
|
-
}
|
|
2116
|
+
(ent) => ent.forms !== void 0 && ent.forms.some(
|
|
2117
|
+
(form) => rkf.kanjiForms !== void 0 && rkf.kanjiForms.has(form) || rkf.readings.has(form)
|
|
2116
2118
|
)
|
|
2117
2119
|
)
|
|
2118
2120
|
);
|
|
2119
|
-
if (fte) entriesWithFormTitles.push(...fte);
|
|
2121
|
+
if (fte !== void 0) entriesWithFormTitles.push(...fte);
|
|
2120
2122
|
}
|
|
2121
2123
|
}
|
|
2122
2124
|
if (entriesWithTitles.length > 0 && (entriesWithFormTitles.length > 0 || entriesWithForms.length > 0))
|
|
2123
2125
|
wordEntriesPairs.push({
|
|
2124
2126
|
word,
|
|
2125
2127
|
readings: rkf.readings,
|
|
2126
|
-
...rkf.kanjiForms ? { kanjiForms: rkf.kanjiForms } : {},
|
|
2127
|
-
forms: rkf.kanjiForms ? rkf.readings.union(rkf.kanjiForms) : rkf.readings,
|
|
2128
|
+
...rkf.kanjiForms !== void 0 ? { kanjiForms: rkf.kanjiForms } : {},
|
|
2129
|
+
forms: rkf.kanjiForms !== void 0 ? rkf.readings.union(rkf.kanjiForms) : rkf.readings,
|
|
2128
2130
|
entriesWithTitles,
|
|
2129
2131
|
entriesWithFormTitles,
|
|
2130
2132
|
entriesWithForms
|
|
@@ -2139,36 +2141,31 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2139
2141
|
const refsMap = /* @__PURE__ */ new Map();
|
|
2140
2142
|
const forms = /* @__PURE__ */ new Set();
|
|
2141
2143
|
for (const ent of pair.entriesWithTitles) {
|
|
2142
|
-
const
|
|
2143
|
-
const
|
|
2144
|
-
const validForms2 = validFormsEntries.has(ent.word);
|
|
2144
|
+
const hasValidFormOf = validFormOfEntries.has(ent.word);
|
|
2145
|
+
const hasValidForms = validFormsEntries.has(ent.word);
|
|
2145
2146
|
const hasForms = ent.forms !== void 0 && ent.forms.some((form) => pair.forms.has(form));
|
|
2146
|
-
if (pair.kanjiForms && pair.kanjiForms.has(ent.word)
|
|
2147
|
+
if (pair.kanjiForms !== void 0 && pair.kanjiForms.has(ent.word)) {
|
|
2147
2148
|
kanjiFormEntries.push(ent);
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
if (validGlosses) {
|
|
2160
|
-
for (const gloss of sense.glosses)
|
|
2161
|
-
if (gloss.includes("\u8868\u8A18") || gloss.includes("\u53C2\u7167")) {
|
|
2162
|
-
for (const f of pair.forms)
|
|
2163
|
-
if (gloss.includes(f)) {
|
|
2164
|
-
const elem = refsMap.get(f);
|
|
2165
|
-
if (!elem) refsMap.set(f, /* @__PURE__ */ new Set([ent.word]));
|
|
2166
|
-
else elem.add(ent.word);
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2149
|
+
for (const sense of ent.senses) {
|
|
2150
|
+
if (hasValidFormOf && sense.form_of !== void 0) {
|
|
2151
|
+
for (const form of sense.form_of)
|
|
2152
|
+
if (pair.forms.has(form)) {
|
|
2153
|
+
const elem = titleFormMap.get(form);
|
|
2154
|
+
if (elem === void 0)
|
|
2155
|
+
titleFormMap.set(form, /* @__PURE__ */ new Set([ent.word]));
|
|
2156
|
+
else elem.add(ent.word);
|
|
2157
|
+
}
|
|
2170
2158
|
}
|
|
2171
|
-
|
|
2159
|
+
for (const gloss of sense.glosses)
|
|
2160
|
+
for (const f of pair.forms)
|
|
2161
|
+
if (gloss.includes(f)) {
|
|
2162
|
+
const elem = refsMap.get(f);
|
|
2163
|
+
if (elem === void 0)
|
|
2164
|
+
refsMap.set(f, /* @__PURE__ */ new Set([ent.word]));
|
|
2165
|
+
else elem.add(ent.word);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
if (hasValidForms && ent.forms !== void 0) {
|
|
2172
2169
|
for (const form of ent.forms)
|
|
2173
2170
|
if (pair.forms.has(form)) forms.add(form);
|
|
2174
2171
|
}
|
|
@@ -2179,7 +2176,7 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2179
2176
|
}
|
|
2180
2177
|
for (const entry of pair.entriesWithForms) {
|
|
2181
2178
|
const elem = titleFormMap.get(entry.word);
|
|
2182
|
-
if (elem && entry.forms && entry.forms.some((form) => elem.has(form)))
|
|
2179
|
+
if (elem !== void 0 && entry.forms !== void 0 && entry.forms.some((form) => elem.has(form)))
|
|
2183
2180
|
entriesWithForms.push(entry);
|
|
2184
2181
|
}
|
|
2185
2182
|
for (const entry of pair.entriesWithFormTitles) {
|
|
@@ -2188,7 +2185,8 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2188
2185
|
continue;
|
|
2189
2186
|
}
|
|
2190
2187
|
const ft = refsMap.get(entry.word);
|
|
2191
|
-
if (ft && !ft.isDisjointFrom(pair.forms))
|
|
2188
|
+
if (ft !== void 0 && !ft.isDisjointFrom(pair.forms))
|
|
2189
|
+
entriesWithForms.push(entry);
|
|
2192
2190
|
}
|
|
2193
2191
|
if (kanjiFormEntries.length > 0) {
|
|
2194
2192
|
for (const entry of kanjiFormEntries)
|
|
@@ -2205,7 +2203,14 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2205
2203
|
japaneseDefinitions.push({
|
|
2206
2204
|
wordID: pair.word.id,
|
|
2207
2205
|
definitions,
|
|
2208
|
-
wordForms: pair.forms
|
|
2206
|
+
wordForms: pair.forms.union(
|
|
2207
|
+
new Set(
|
|
2208
|
+
pair.forms.values().toArray().flatMap((form) => [
|
|
2209
|
+
hiraganaToKatakana(form),
|
|
2210
|
+
katakanaToHiragana(form)
|
|
2211
|
+
])
|
|
2212
|
+
)
|
|
2213
|
+
)
|
|
2209
2214
|
});
|
|
2210
2215
|
}
|
|
2211
2216
|
for (let i = 0; i < japaneseDefinitions.length; i++) {
|
|
@@ -2214,14 +2219,14 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2214
2219
|
const defCount = definitionMap.get(
|
|
2215
2220
|
pair.definitions[j].definition
|
|
2216
2221
|
);
|
|
2217
|
-
if (defCount && defCount.count > 1) {
|
|
2222
|
+
if (defCount !== void 0 && defCount.count > 1) {
|
|
2218
2223
|
let mnba = true;
|
|
2219
2224
|
for (const f of pair.wordForms)
|
|
2220
2225
|
if (pair.definitions[j].definition.includes(f)) {
|
|
2221
2226
|
mnba = false;
|
|
2222
2227
|
break;
|
|
2223
2228
|
}
|
|
2224
|
-
|
|
2229
|
+
pair.definitions[j].mayNotBeAccurate = mnba ? 2 : 1;
|
|
2225
2230
|
}
|
|
2226
2231
|
}
|
|
2227
2232
|
delete pair.wordForms;
|
|
@@ -2230,33 +2235,30 @@ function getWordDefinitions(entryList, jmDict) {
|
|
|
2230
2235
|
return japaneseDefinitions;
|
|
2231
2236
|
}
|
|
2232
2237
|
async function getWordDefinitionsWithFurigana(entryList, jmDict) {
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
pair.definitions[j].
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
}
|
|
2254
|
-
resolve(japaneseDefinitions);
|
|
2255
|
-
});
|
|
2238
|
+
const japaneseDefinitions = getWordDefinitions(
|
|
2239
|
+
entryList,
|
|
2240
|
+
jmDict
|
|
2241
|
+
);
|
|
2242
|
+
const kuroshiro = new Kuroshiro.default();
|
|
2243
|
+
await kuroshiro.init(new KuromojiAnalyzer());
|
|
2244
|
+
const convert = kuroshiro.convert.bind(kuroshiro);
|
|
2245
|
+
for (let i = 0; i < japaneseDefinitions.length; i++) {
|
|
2246
|
+
const pair = japaneseDefinitions[i];
|
|
2247
|
+
for (let j = 0; j < pair.definitions.length; j++)
|
|
2248
|
+
if (!pair.definitions[j].definition.includes("\u30FB"))
|
|
2249
|
+
pair.definitions[j].furigana = String(
|
|
2250
|
+
await convert(pair.definitions[j].definition, {
|
|
2251
|
+
to: "hiragana",
|
|
2252
|
+
mode: "furigana"
|
|
2253
|
+
})
|
|
2254
|
+
);
|
|
2255
|
+
japaneseDefinitions[i] = pair;
|
|
2256
|
+
}
|
|
2257
|
+
return japaneseDefinitions;
|
|
2256
2258
|
}
|
|
2257
2259
|
function lookupWordNote(key, notes, tags) {
|
|
2258
2260
|
const info = noteMap.get(key.toLowerCase());
|
|
2259
|
-
if (
|
|
2261
|
+
if (info === void 0) {
|
|
2260
2262
|
notes.push(key);
|
|
2261
2263
|
return { note: key };
|
|
2262
2264
|
}
|
|
@@ -2266,22 +2268,170 @@ function lookupWordNote(key, notes, tags) {
|
|
|
2266
2268
|
return { note: info[1], tag };
|
|
2267
2269
|
}
|
|
2268
2270
|
var wordAddNoteArray = (arr, cb) => {
|
|
2269
|
-
if (
|
|
2271
|
+
if (arr === void 0) return;
|
|
2270
2272
|
for (const v of arr) cb(v);
|
|
2271
2273
|
};
|
|
2272
|
-
function
|
|
2273
|
-
|
|
2274
|
+
function getKanji(searchedKanji, dict, jmDict, svgList, noteTypeName, deckPath) {
|
|
2275
|
+
let dictKanji = void 0;
|
|
2276
|
+
if (typeof searchedKanji === "string" && dict !== void 0)
|
|
2277
|
+
dictKanji = dict instanceof Map ? dict.get(searchedKanji) : dict.find((entry) => entry.kanji === searchedKanji);
|
|
2278
|
+
else if (typeof searchedKanji === "object") dictKanji = searchedKanji;
|
|
2279
|
+
if (dictKanji !== void 0) {
|
|
2280
|
+
const kanji = {
|
|
2281
|
+
kanji: dictKanji.kanji,
|
|
2282
|
+
strokes: dictKanji.misc.strokeNumber,
|
|
2283
|
+
...dictKanji.misc?.grade !== void 0 ? { grade: dictKanji.misc.grade } : {},
|
|
2284
|
+
...dictKanji.misc?.frequency !== void 0 ? { frequency: dictKanji.misc.frequency } : {},
|
|
2285
|
+
...dictKanji.misc?.jlpt !== void 0 ? { jlpt: dictKanji.misc.jlpt } : {},
|
|
2286
|
+
noteID: `kanji_${dictKanji.kanji}`,
|
|
2287
|
+
...noteTypeName !== void 0 ? { noteTypeName } : {},
|
|
2288
|
+
...deckPath !== void 0 ? { deckPath } : {},
|
|
2289
|
+
tags: []
|
|
2290
|
+
};
|
|
2291
|
+
if (dictKanji.readingMeaning !== void 0 && dictKanji.readingMeaning.length > 0) {
|
|
2292
|
+
const meanings = [];
|
|
2293
|
+
const nanori = [];
|
|
2294
|
+
const onyomi = [];
|
|
2295
|
+
const kunyomi = [];
|
|
2296
|
+
for (const rm of dictKanji.readingMeaning) {
|
|
2297
|
+
if (rm.nanori !== void 0 && rm.nanori.length > 0)
|
|
2298
|
+
nanori.push(...rm.nanori);
|
|
2299
|
+
for (const group of rm.groups) {
|
|
2300
|
+
if (group.readings !== void 0) {
|
|
2301
|
+
onyomi.push(
|
|
2302
|
+
...group.readings.filter((reading) => reading.type === "ja_on").map((reading) => reading.reading)
|
|
2303
|
+
);
|
|
2304
|
+
kunyomi.push(
|
|
2305
|
+
...group.readings.filter(
|
|
2306
|
+
(reading) => reading.type === "ja_kun"
|
|
2307
|
+
).map((reading) => reading.reading)
|
|
2308
|
+
);
|
|
2309
|
+
}
|
|
2310
|
+
if (group.meanings !== void 0 && group.meanings.length > 0)
|
|
2311
|
+
meanings.push(...group.meanings);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
if (meanings.length > 0) kanji.meanings = meanings;
|
|
2315
|
+
if (nanori.length > 0) kanji.nanori = nanori;
|
|
2316
|
+
if (onyomi.length > 0) kanji.onyomi = onyomi;
|
|
2317
|
+
if (kunyomi.length > 0) kanji.kunyomi = kunyomi;
|
|
2318
|
+
}
|
|
2319
|
+
if (jmDict !== void 0) {
|
|
2320
|
+
let kanjiWords = jmDict instanceof Map ? jmDict.get(kanji.kanji) : jmDict;
|
|
2321
|
+
const firstKfWords = kanjiWords?.filter(
|
|
2322
|
+
(word) => word.kanjiForms !== void 0 && word.kanjiForms[0].form.includes(kanji.kanji)
|
|
2323
|
+
);
|
|
2324
|
+
if (firstKfWords !== void 0 && firstKfWords.length > 0)
|
|
2325
|
+
kanjiWords = firstKfWords;
|
|
2326
|
+
if (kanjiWords !== void 0) {
|
|
2327
|
+
const validWords = [];
|
|
2328
|
+
for (const word of kanjiWords) {
|
|
2329
|
+
const kanjiForm = (firstKfWords !== void 0 && firstKfWords.length > 0 ? word.kanjiForms[0] : word.kanjiForms.find(
|
|
2330
|
+
(kf) => kf.form.includes(kanji.kanji)
|
|
2331
|
+
))?.form;
|
|
2332
|
+
if (kanjiForm !== void 0) {
|
|
2333
|
+
const reading = (firstKfWords !== void 0 && firstKfWords.length > 0 ? word.readings[0] : word.readings.find(
|
|
2334
|
+
(r) => r.kanjiFormRestrictions !== void 0 && r.kanjiFormRestrictions.includes(kanjiForm)
|
|
2335
|
+
))?.reading;
|
|
2336
|
+
if (reading === void 0) continue;
|
|
2337
|
+
const translation = (firstKfWords !== void 0 && firstKfWords.length > 0 ? word.meanings[0] : word.meanings.find(
|
|
2338
|
+
(m) => m.kanjiFormRestrictions !== void 0 && m.kanjiFormRestrictions.includes(kanjiForm)
|
|
2339
|
+
))?.translations.map(
|
|
2340
|
+
(t) => typeof t === "string" ? t : t.translation
|
|
2341
|
+
)[0];
|
|
2342
|
+
if (translation === void 0) continue;
|
|
2343
|
+
validWords.push({
|
|
2344
|
+
kanjiForms: [{ kanjiForm }],
|
|
2345
|
+
readings: [{ reading }],
|
|
2346
|
+
translations: [
|
|
2347
|
+
{
|
|
2348
|
+
translation
|
|
2349
|
+
}
|
|
2350
|
+
]
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
if (validWords.length === 3) break;
|
|
2354
|
+
}
|
|
2355
|
+
if (validWords.length > 0) kanji.words = validWords;
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
if (svgList !== void 0) {
|
|
2359
|
+
const codePoint = kanji.kanji.codePointAt(0).toString(16).toLowerCase();
|
|
2360
|
+
const svg = svgList instanceof Map ? svgList.get(kanji.kanji) : svgList.find(
|
|
2361
|
+
(svgFile) => [`${codePoint}.svg`, `0${codePoint}.svg`].includes(
|
|
2362
|
+
svgFile.toLowerCase()
|
|
2363
|
+
)
|
|
2364
|
+
);
|
|
2365
|
+
if (svg !== void 0) kanji.svg = svg;
|
|
2366
|
+
}
|
|
2367
|
+
if (dictKanji.isKokuji === true) {
|
|
2368
|
+
kanji.kokuji = true;
|
|
2369
|
+
kanji.tags.push("kanji::kokuji");
|
|
2370
|
+
}
|
|
2371
|
+
kanji.tags.push(
|
|
2372
|
+
`kanji::strokes::${kanji.strokes}`,
|
|
2373
|
+
...kanji.frequency !== void 0 ? [`kanji::frequency::${kanji.frequency}`] : [],
|
|
2374
|
+
...kanji.grade !== void 0 ? [`kanji::grade::${kanji.grade}`] : [],
|
|
2375
|
+
...kanji.jlpt !== void 0 ? [`kanji::pre-2010_jlpt::${kanji.jlpt.toLowerCase()}`] : [],
|
|
2376
|
+
`kanji::onyomi::${kanji.onyomi?.length ?? 0}`,
|
|
2377
|
+
`kanji::kunyomi::${kanji.kunyomi?.length ?? 0}`,
|
|
2378
|
+
`kanji::nanori::${kanji.nanori?.length ?? 0}`,
|
|
2379
|
+
`kanji::words::${kanji.words?.length ?? 0}`,
|
|
2380
|
+
...kanji.svg !== void 0 ? ["kanji::has_svg"] : []
|
|
2381
|
+
);
|
|
2382
|
+
return kanji;
|
|
2383
|
+
} else return void 0;
|
|
2384
|
+
}
|
|
2385
|
+
function getKanjiExtended(info, kanji, dict, useWords, jmDict, svgList, noteTypeName, deckPath, sourceURL) {
|
|
2386
|
+
const kanjiObj = getKanji(
|
|
2387
|
+
kanji,
|
|
2388
|
+
dict,
|
|
2389
|
+
jmDict,
|
|
2390
|
+
svgList,
|
|
2391
|
+
noteTypeName,
|
|
2392
|
+
deckPath
|
|
2393
|
+
);
|
|
2394
|
+
if (kanjiObj !== void 0) {
|
|
2395
|
+
let usedInfo = false;
|
|
2396
|
+
if (info.components !== void 0) {
|
|
2397
|
+
kanjiObj.components = info.components;
|
|
2398
|
+
kanjiObj.tags.push(`kanji::components::${kanjiObj.components.length}`);
|
|
2399
|
+
usedInfo = true;
|
|
2400
|
+
}
|
|
2401
|
+
if (info.mnemonic !== void 0 && info.mnemonic.length > 0) {
|
|
2402
|
+
kanjiObj.mnemonic = info.mnemonic;
|
|
2403
|
+
kanjiObj.tags.push("kanji::has_mnemonic");
|
|
2404
|
+
usedInfo = true;
|
|
2405
|
+
}
|
|
2406
|
+
if (useWords === true && info.words !== void 0 && info.words.length > 0) {
|
|
2407
|
+
kanjiObj.words = info.words;
|
|
2408
|
+
kanjiObj.tags.forEach((tag, index) => {
|
|
2409
|
+
if (tag.startsWith("kanji::words::") && kanjiObj.words !== void 0)
|
|
2410
|
+
kanjiObj.tags.splice(
|
|
2411
|
+
index,
|
|
2412
|
+
1,
|
|
2413
|
+
`kanji::words::${kanjiObj.words.length}`
|
|
2414
|
+
);
|
|
2415
|
+
});
|
|
2416
|
+
usedInfo = true;
|
|
2417
|
+
}
|
|
2418
|
+
if (sourceURL !== void 0 && info.externalInfo === true && usedInfo)
|
|
2419
|
+
kanjiObj.source = sourceURL;
|
|
2420
|
+
return kanjiObj;
|
|
2421
|
+
} else return void 0;
|
|
2422
|
+
}
|
|
2423
|
+
function getWord(searchedWord, dict, kanjiDic, examples, definitions, noteTypeName, deckPath) {
|
|
2274
2424
|
let dictWord = void 0;
|
|
2275
|
-
if (typeof
|
|
2425
|
+
if (typeof searchedWord === "string" && dict !== void 0) {
|
|
2276
2426
|
if (Array.isArray(dict))
|
|
2277
2427
|
dictWord = dict.find(
|
|
2278
|
-
(entry) => entry.id ===
|
|
2428
|
+
(entry) => entry.id === searchedWord
|
|
2279
2429
|
);
|
|
2280
|
-
if (dict instanceof Map) dictWord = dict.get(
|
|
2430
|
+
if (dict instanceof Map) dictWord = dict.get(searchedWord);
|
|
2281
2431
|
}
|
|
2282
|
-
if (typeof
|
|
2283
|
-
if (dictWord) {
|
|
2284
|
-
const
|
|
2432
|
+
if (typeof searchedWord === "object") dictWord = searchedWord;
|
|
2433
|
+
if (dictWord !== void 0) {
|
|
2434
|
+
const word = {
|
|
2285
2435
|
id: dictWord.id,
|
|
2286
2436
|
readings: [],
|
|
2287
2437
|
translations: [],
|
|
@@ -2291,46 +2441,46 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2291
2441
|
tags: []
|
|
2292
2442
|
};
|
|
2293
2443
|
if (dictWord.isCommon === true) {
|
|
2294
|
-
|
|
2295
|
-
|
|
2444
|
+
word.common = true;
|
|
2445
|
+
word.tags.push("word::common");
|
|
2296
2446
|
}
|
|
2297
|
-
if (dictWord.kanjiForms)
|
|
2298
|
-
|
|
2447
|
+
if (dictWord.kanjiForms !== void 0)
|
|
2448
|
+
word.kanjiForms = dictWord.kanjiForms.map(
|
|
2299
2449
|
(dictKanjiForm) => ({
|
|
2300
2450
|
kanjiForm: dictKanjiForm.form,
|
|
2301
|
-
...dictKanjiForm.notes ? {
|
|
2451
|
+
...dictKanjiForm.notes !== void 0 ? {
|
|
2302
2452
|
notes: dictKanjiForm.notes.map((note) => {
|
|
2303
2453
|
const noteAndTag = lookupWordNote(
|
|
2304
2454
|
note,
|
|
2305
2455
|
[],
|
|
2306
|
-
|
|
2456
|
+
word.tags
|
|
2307
2457
|
);
|
|
2308
2458
|
return capitalizeString(noteAndTag.note);
|
|
2309
2459
|
})
|
|
2310
2460
|
} : {},
|
|
2311
|
-
...dictKanjiForm.commonness && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
|
|
2461
|
+
...dictKanjiForm.commonness !== void 0 && dictKanjiForm.commonness.length > 0 ? { common: true } : {}
|
|
2312
2462
|
})
|
|
2313
2463
|
);
|
|
2314
|
-
|
|
2464
|
+
word.readings = dictWord.readings.map((dictReading) => ({
|
|
2315
2465
|
reading: dictReading.reading,
|
|
2316
|
-
...dictReading.kanjiFormRestrictions || dictReading.notes ? {
|
|
2466
|
+
...dictReading.kanjiFormRestrictions !== void 0 || dictReading.notes !== void 0 ? {
|
|
2317
2467
|
notes: [
|
|
2318
|
-
...dictReading.kanjiFormRestrictions ? dictReading.kanjiFormRestrictions.map(
|
|
2468
|
+
...dictReading.kanjiFormRestrictions !== void 0 ? dictReading.kanjiFormRestrictions.map(
|
|
2319
2469
|
(restriction) => `Reading restricted to ${restriction}`
|
|
2320
2470
|
) : [],
|
|
2321
|
-
...dictReading.notes ? dictReading.notes.map((note) => {
|
|
2471
|
+
...dictReading.notes !== void 0 ? dictReading.notes.map((note) => {
|
|
2322
2472
|
const noteAndTag = lookupWordNote(
|
|
2323
2473
|
note,
|
|
2324
2474
|
[],
|
|
2325
|
-
|
|
2475
|
+
word.tags
|
|
2326
2476
|
);
|
|
2327
2477
|
return capitalizeString(noteAndTag.note);
|
|
2328
2478
|
}) : []
|
|
2329
2479
|
]
|
|
2330
2480
|
} : {},
|
|
2331
|
-
...dictReading.commonness && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
2481
|
+
...dictReading.commonness !== void 0 && dictReading.commonness.length > 0 ? { common: true } : {}
|
|
2332
2482
|
}));
|
|
2333
|
-
|
|
2483
|
+
word.translations = [];
|
|
2334
2484
|
for (const dictMeaning of dictWord.meanings) {
|
|
2335
2485
|
const translationTypes = [];
|
|
2336
2486
|
const translations = dictMeaning.translations.map(
|
|
@@ -2341,7 +2491,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2341
2491
|
translation.type
|
|
2342
2492
|
);
|
|
2343
2493
|
translationTypes.push(translationNoteAndTag[1]);
|
|
2344
|
-
|
|
2494
|
+
word.tags.push(`word::${translationNoteAndTag[0]}`);
|
|
2345
2495
|
return translation.translation;
|
|
2346
2496
|
}
|
|
2347
2497
|
}
|
|
@@ -2358,15 +2508,15 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2358
2508
|
for (const t of translationTypes) notes.push(t);
|
|
2359
2509
|
wordAddNoteArray(
|
|
2360
2510
|
dictMeaning.partOfSpeech,
|
|
2361
|
-
(pos) => lookupWordNote(pos, notes,
|
|
2511
|
+
(pos) => lookupWordNote(pos, notes, word.tags)
|
|
2362
2512
|
);
|
|
2363
2513
|
wordAddNoteArray(
|
|
2364
2514
|
dictMeaning.fields,
|
|
2365
|
-
(field) => lookupWordNote(field, notes,
|
|
2515
|
+
(field) => lookupWordNote(field, notes, word.tags)
|
|
2366
2516
|
);
|
|
2367
2517
|
wordAddNoteArray(
|
|
2368
2518
|
dictMeaning.dialects,
|
|
2369
|
-
(dialect) => lookupWordNote(dialect, notes,
|
|
2519
|
+
(dialect) => lookupWordNote(dialect, notes, word.tags)
|
|
2370
2520
|
);
|
|
2371
2521
|
wordAddNoteArray(
|
|
2372
2522
|
dictMeaning.antonyms,
|
|
@@ -2378,45 +2528,45 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2378
2528
|
);
|
|
2379
2529
|
wordAddNoteArray(
|
|
2380
2530
|
dictMeaning.info,
|
|
2381
|
-
(info) => lookupWordNote(info, notes,
|
|
2531
|
+
(info) => lookupWordNote(info, notes, word.tags)
|
|
2382
2532
|
);
|
|
2383
2533
|
wordAddNoteArray(
|
|
2384
2534
|
dictMeaning.misc,
|
|
2385
|
-
(misc) => lookupWordNote(misc, notes,
|
|
2535
|
+
(misc) => lookupWordNote(misc, notes, word.tags)
|
|
2386
2536
|
);
|
|
2387
2537
|
for (let i = 0; i < notes.length; i++)
|
|
2388
2538
|
notes[i] = capitalizeString(notes[i]);
|
|
2389
|
-
|
|
2539
|
+
word.translations.push({
|
|
2390
2540
|
translation: translations.join("; "),
|
|
2391
2541
|
notes
|
|
2392
2542
|
});
|
|
2393
2543
|
}
|
|
2394
2544
|
if (dictWord.usuallyInKana === true) {
|
|
2395
|
-
|
|
2396
|
-
|
|
2545
|
+
word.usuallyInKana = true;
|
|
2546
|
+
word.tags.push("word::usually_in_kana_for_all_senses");
|
|
2397
2547
|
}
|
|
2398
|
-
if (kanjiDic &&
|
|
2548
|
+
if (kanjiDic !== void 0 && word.kanjiForms !== void 0) {
|
|
2399
2549
|
const kanji = [];
|
|
2400
2550
|
const seenChars = /* @__PURE__ */ new Set();
|
|
2401
|
-
for (const kanjiForm of
|
|
2551
|
+
for (const kanjiForm of word.kanjiForms)
|
|
2402
2552
|
for (const char of kanjiForm.kanjiForm.split("").filter((c) => regexps.kanji.test(c))) {
|
|
2403
2553
|
if (seenChars.has(char)) continue;
|
|
2404
2554
|
seenChars.add(char);
|
|
2405
2555
|
const kanjiEntry = kanjiDic instanceof Map ? kanjiDic.get(char) : void 0;
|
|
2406
2556
|
const kanjiObj = getKanji(
|
|
2407
|
-
kanjiEntry
|
|
2408
|
-
|
|
2557
|
+
kanjiEntry ?? char,
|
|
2558
|
+
!(kanjiDic instanceof Map) ? kanjiDic : void 0
|
|
2409
2559
|
);
|
|
2410
|
-
if (kanjiObj)
|
|
2560
|
+
if (kanjiObj !== void 0)
|
|
2411
2561
|
kanji.push({
|
|
2412
2562
|
kanji: kanjiObj.kanji,
|
|
2413
|
-
...kanjiObj.meanings && kanjiObj.meanings.length > 0 ? { meanings: kanjiObj.meanings } : {}
|
|
2563
|
+
...kanjiObj.meanings !== void 0 && kanjiObj.meanings.length > 0 ? { meanings: kanjiObj.meanings } : {}
|
|
2414
2564
|
});
|
|
2415
2565
|
}
|
|
2416
|
-
if (kanji.length > 0)
|
|
2566
|
+
if (kanji.length > 0) word.kanji = kanji;
|
|
2417
2567
|
}
|
|
2418
|
-
if (dictWord.hasPhrases !== void 0
|
|
2419
|
-
const exampleList =
|
|
2568
|
+
if (dictWord.hasPhrases === true && examples !== void 0) {
|
|
2569
|
+
const exampleList = examples instanceof Map ? examples.get(dictWord.id) ?? [] : examples;
|
|
2420
2570
|
const rkf = getValidForms(
|
|
2421
2571
|
dictWord.readings,
|
|
2422
2572
|
dictWord.kanjiForms,
|
|
@@ -2425,7 +2575,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2425
2575
|
const readings = new Set(
|
|
2426
2576
|
rkf.readings.map((r) => r.reading)
|
|
2427
2577
|
);
|
|
2428
|
-
const kanjiForms = rkf.kanjiForms ? new Set(rkf.kanjiForms.map((kf) => kf.form)) : void 0;
|
|
2578
|
+
const kanjiForms = rkf.kanjiForms !== void 0 ? new Set(rkf.kanjiForms.map((kf) => kf.form)) : void 0;
|
|
2429
2579
|
let kanjiFormExamples = [];
|
|
2430
2580
|
const readingMatchingKanjiFormExamples = [];
|
|
2431
2581
|
const readingExamples = [];
|
|
@@ -2436,7 +2586,7 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2436
2586
|
const readingAsReadingMatch = part.reading !== void 0 && readings.has(part.reading);
|
|
2437
2587
|
const readingAsInflectedFormMatch = part.inflectedForm !== void 0 && readings.has(part.inflectedForm);
|
|
2438
2588
|
const referenceIDMatch = part.referenceID === dictWord.id;
|
|
2439
|
-
if (kanjiForms && kanjiForms.has(part.baseForm) || referenceIDMatch) {
|
|
2589
|
+
if (kanjiForms !== void 0 && kanjiForms.has(part.baseForm) || referenceIDMatch) {
|
|
2440
2590
|
if (readingAsReadingMatch || readingAsInflectedFormMatch) {
|
|
2441
2591
|
readingMatchingKanjiFormExamples.push({
|
|
2442
2592
|
ex: example,
|
|
@@ -2452,16 +2602,16 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2452
2602
|
break;
|
|
2453
2603
|
}
|
|
2454
2604
|
const readingAsBaseFormMatch = readings.has(part.baseForm);
|
|
2455
|
-
if (
|
|
2605
|
+
if (readingAsBaseFormMatch && kanjiForms === void 0) {
|
|
2456
2606
|
readingExamples.push({ ex: example, partIndex: i });
|
|
2457
2607
|
break;
|
|
2458
2608
|
}
|
|
2459
2609
|
}
|
|
2460
2610
|
if (readingMatchingKanjiForms.size > 0)
|
|
2461
2611
|
kanjiFormExamples = kanjiFormExamples.filter(
|
|
2462
|
-
(ex) => ex.form && readingMatchingKanjiForms.has(ex.form)
|
|
2612
|
+
(ex) => ex.form !== void 0 && readingMatchingKanjiForms.has(ex.form)
|
|
2463
2613
|
);
|
|
2464
|
-
const includeKanjiFormExamples =
|
|
2614
|
+
const includeKanjiFormExamples = word.kanjiForms !== void 0;
|
|
2465
2615
|
let wordExamples = [
|
|
2466
2616
|
...includeKanjiFormExamples ? [...readingMatchingKanjiFormExamples, ...kanjiFormExamples] : readingExamples
|
|
2467
2617
|
];
|
|
@@ -2471,14 +2621,14 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2471
2621
|
readingMatchingKanjiForms.clear();
|
|
2472
2622
|
const glossSpecificExamples = [];
|
|
2473
2623
|
const seenPhrases = /* @__PURE__ */ new Set();
|
|
2474
|
-
for (let i = 0; i <
|
|
2624
|
+
for (let i = 0; i < word.translations.length; i++)
|
|
2475
2625
|
outer: for (const example of wordExamples) {
|
|
2476
2626
|
if (seenPhrases.has(example.ex.phrase)) continue;
|
|
2477
2627
|
for (let j = 0; j < example.ex.parts.length; j++) {
|
|
2478
2628
|
const part = example.ex.parts[j];
|
|
2479
2629
|
if (j === example.partIndex && part.glossNumber === i + 1) {
|
|
2480
2630
|
example.ex.glossNumber = {
|
|
2481
|
-
wordId:
|
|
2631
|
+
wordId: word.id,
|
|
2482
2632
|
glossNumber: i + 1
|
|
2483
2633
|
};
|
|
2484
2634
|
glossSpecificExamples.push(example);
|
|
@@ -2487,7 +2637,6 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2487
2637
|
}
|
|
2488
2638
|
}
|
|
2489
2639
|
}
|
|
2490
|
-
}
|
|
2491
2640
|
if (glossSpecificExamples.length > 0) {
|
|
2492
2641
|
if (glossSpecificExamples.length < 5) {
|
|
2493
2642
|
wordExamples = wordExamples.filter(
|
|
@@ -2502,205 +2651,49 @@ function getWord(word, dict, kanjiDic, examples, definitions, noteTypeName, deck
|
|
|
2502
2651
|
wordExamples = glossSpecificExamples;
|
|
2503
2652
|
}
|
|
2504
2653
|
if (wordExamples.length > 0) {
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
};
|
|
2513
|
-
});
|
|
2514
|
-
word2.tags.push("word::has_phrases");
|
|
2654
|
+
word.phrases = (glossSpecificExamples.length === 0 ? wordExamples.slice(0, 5) : wordExamples).map((ex) => ({
|
|
2655
|
+
phrase: ex.ex.furigana ?? ex.ex.phrase,
|
|
2656
|
+
translation: ex.ex.translation,
|
|
2657
|
+
originalPhrase: ex.ex.phrase,
|
|
2658
|
+
...ex.ex.glossNumber !== void 0 ? { glossNumber: ex.ex.glossNumber } : {}
|
|
2659
|
+
}));
|
|
2660
|
+
word.tags.push("word::has_phrases");
|
|
2515
2661
|
if (glossSpecificExamples.length > 0)
|
|
2516
|
-
|
|
2662
|
+
word.tags.push("word::has_meaning-specific_phrases");
|
|
2517
2663
|
}
|
|
2518
2664
|
}
|
|
2519
|
-
if (definitions) {
|
|
2520
|
-
const defs =
|
|
2521
|
-
|
|
2522
|
-
|
|
2665
|
+
if (definitions !== void 0) {
|
|
2666
|
+
const defs = definitions instanceof Map ? definitions.get(word.id) : definitions.find(
|
|
2667
|
+
(wdp) => wdp.wordID === word.id
|
|
2668
|
+
)?.definitions;
|
|
2669
|
+
if (defs !== void 0)
|
|
2670
|
+
word.definitions = [
|
|
2523
2671
|
...defs.toSorted(
|
|
2524
|
-
(a, b) =>
|
|
2672
|
+
(a, b) => (a.mayNotBeAccurate ?? 0) - (b.mayNotBeAccurate ?? 0)
|
|
2525
2673
|
)
|
|
2526
2674
|
];
|
|
2527
2675
|
}
|
|
2528
|
-
return
|
|
2529
|
-
} else return void 0;
|
|
2530
|
-
}
|
|
2531
|
-
function getKanji(kanji, dict, jmDict, svgList, noteTypeName, deckPath) {
|
|
2532
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2533
|
-
let dictKanji = void 0;
|
|
2534
|
-
if (typeof kanji === "string" && dict)
|
|
2535
|
-
dictKanji = Array.isArray(dict) ? dict.find((entry) => entry.kanji === kanji) : dict.get(kanji);
|
|
2536
|
-
else if (typeof kanji === "object") dictKanji = kanji;
|
|
2537
|
-
if (dictKanji) {
|
|
2538
|
-
const kanji2 = {
|
|
2539
|
-
kanji: dictKanji.kanji,
|
|
2540
|
-
strokes: dictKanji.misc.strokeNumber,
|
|
2541
|
-
...dictKanji.misc && dictKanji.misc.grade ? { grade: dictKanji.misc.grade } : {},
|
|
2542
|
-
...dictKanji.misc && dictKanji.misc.frequency ? { frequency: dictKanji.misc.frequency } : {},
|
|
2543
|
-
...dictKanji.misc && dictKanji.misc.jlpt ? { jlpt: dictKanji.misc.jlpt } : {},
|
|
2544
|
-
noteID: `kanji_${dictKanji.kanji}`,
|
|
2545
|
-
...noteTypeName ? { noteTypeName } : {},
|
|
2546
|
-
...deckPath ? { deckPath } : {},
|
|
2547
|
-
tags: []
|
|
2548
|
-
};
|
|
2549
|
-
if (dictKanji.readingMeaning && dictKanji.readingMeaning.length > 0) {
|
|
2550
|
-
const meanings = [];
|
|
2551
|
-
const nanori = [];
|
|
2552
|
-
const onyomi = [];
|
|
2553
|
-
const kunyomi = [];
|
|
2554
|
-
for (const rm of dictKanji.readingMeaning) {
|
|
2555
|
-
if (rm.nanori && rm.nanori.length > 0) nanori.push(...rm.nanori);
|
|
2556
|
-
for (const group of rm.groups) {
|
|
2557
|
-
if (group.readings) {
|
|
2558
|
-
onyomi.push(
|
|
2559
|
-
...group.readings.filter((reading) => reading.type === "ja_on").map((reading) => reading.reading)
|
|
2560
|
-
);
|
|
2561
|
-
kunyomi.push(
|
|
2562
|
-
...group.readings.filter(
|
|
2563
|
-
(reading) => reading.type === "ja_kun"
|
|
2564
|
-
).map((reading) => reading.reading)
|
|
2565
|
-
);
|
|
2566
|
-
}
|
|
2567
|
-
if (group.meanings && group.meanings.length > 0)
|
|
2568
|
-
meanings.push(...group.meanings);
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
if (meanings.length > 0) kanji2.meanings = meanings;
|
|
2572
|
-
if (nanori.length > 0) kanji2.nanori = nanori;
|
|
2573
|
-
if (onyomi.length > 0) kanji2.onyomi = onyomi;
|
|
2574
|
-
if (kunyomi.length > 0) kanji2.kunyomi = kunyomi;
|
|
2575
|
-
}
|
|
2576
|
-
if (jmDict) {
|
|
2577
|
-
let kanjiWords = Array.isArray(
|
|
2578
|
-
jmDict
|
|
2579
|
-
) ? jmDict : jmDict.get(kanji2.kanji);
|
|
2580
|
-
const firstKfWords = kanjiWords == null ? void 0 : kanjiWords.filter(
|
|
2581
|
-
(word) => word.kanjiForms && word.kanjiForms[0].form.includes(kanji2.kanji)
|
|
2582
|
-
);
|
|
2583
|
-
if (firstKfWords && firstKfWords.length > 0) kanjiWords = firstKfWords;
|
|
2584
|
-
if (kanjiWords) {
|
|
2585
|
-
const validWords = [];
|
|
2586
|
-
for (const word of kanjiWords) {
|
|
2587
|
-
const kanjiForm = (_a = firstKfWords && firstKfWords.length > 0 ? word.kanjiForms[0] : word.kanjiForms.find(
|
|
2588
|
-
(kf) => kf.form.includes(kanji2.kanji)
|
|
2589
|
-
)) == null ? void 0 : _a.form;
|
|
2590
|
-
if (kanjiForm) {
|
|
2591
|
-
const reading = (_b = firstKfWords && firstKfWords.length > 0 ? word.readings[0] : word.readings.find(
|
|
2592
|
-
(reading2) => reading2.kanjiFormRestrictions && reading2.kanjiFormRestrictions.includes(kanjiForm)
|
|
2593
|
-
)) == null ? void 0 : _b.reading;
|
|
2594
|
-
if (!reading) continue;
|
|
2595
|
-
const translation = (_c = firstKfWords && firstKfWords.length > 0 ? word.meanings[0] : word.meanings.find(
|
|
2596
|
-
(m) => m.translations && m.kanjiFormRestrictions && m.kanjiFormRestrictions.includes(kanjiForm)
|
|
2597
|
-
)) == null ? void 0 : _c.translations.map(
|
|
2598
|
-
(t) => typeof t === "string" ? t : t.translation
|
|
2599
|
-
)[0];
|
|
2600
|
-
if (!translation) continue;
|
|
2601
|
-
validWords.push({
|
|
2602
|
-
kanjiForms: [{ kanjiForm }],
|
|
2603
|
-
readings: [{ reading }],
|
|
2604
|
-
translations: [
|
|
2605
|
-
{
|
|
2606
|
-
translation
|
|
2607
|
-
}
|
|
2608
|
-
]
|
|
2609
|
-
});
|
|
2610
|
-
}
|
|
2611
|
-
if (validWords.length === 3) break;
|
|
2612
|
-
}
|
|
2613
|
-
if (validWords.length > 0) kanji2.words = validWords;
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
if (svgList) {
|
|
2617
|
-
const codePoint = kanji2.kanji.codePointAt(0).toString(16).toLowerCase();
|
|
2618
|
-
const svg = Array.isArray(svgList) ? svgList.find(
|
|
2619
|
-
(svgFile) => [`${codePoint}.svg`, `0${codePoint}.svg`].includes(
|
|
2620
|
-
svgFile.toLowerCase()
|
|
2621
|
-
)
|
|
2622
|
-
) : svgList.get(kanji2.kanji);
|
|
2623
|
-
if (svg) kanji2.svg = svg;
|
|
2624
|
-
}
|
|
2625
|
-
if (kanji2.tags && dictKanji.isKokuji === true) {
|
|
2626
|
-
kanji2.kokuji = true;
|
|
2627
|
-
kanji2.tags.push("kanji::kokuji");
|
|
2628
|
-
}
|
|
2629
|
-
kanji2.tags.push(
|
|
2630
|
-
`kanji::strokes::${kanji2.strokes}`,
|
|
2631
|
-
...kanji2.frequency ? [`kanji::frequency::${kanji2.frequency}`] : [],
|
|
2632
|
-
...kanji2.grade ? [`kanji::grade::${kanji2.grade}`] : [],
|
|
2633
|
-
...kanji2.jlpt ? [`kanji::pre-2010_jlpt::${kanji2.jlpt.toLowerCase()}`] : [],
|
|
2634
|
-
`kanji::onyomi::${(_e = (_d = kanji2.onyomi) == null ? void 0 : _d.length) != null ? _e : 0}`,
|
|
2635
|
-
`kanji::kunyomi::${(_g = (_f = kanji2.kunyomi) == null ? void 0 : _f.length) != null ? _g : 0}`,
|
|
2636
|
-
`kanji::nanori::${(_i = (_h = kanji2.nanori) == null ? void 0 : _h.length) != null ? _i : 0}`,
|
|
2637
|
-
`kanji::words::${(_k = (_j = kanji2.words) == null ? void 0 : _j.length) != null ? _k : 0}`,
|
|
2638
|
-
...kanji2.svg ? ["kanji::has_svg"] : []
|
|
2639
|
-
);
|
|
2640
|
-
return kanji2;
|
|
2641
|
-
} else return void 0;
|
|
2642
|
-
}
|
|
2643
|
-
function getKanjiExtended(info, kanji, dict, useWords, jmDict, svgList, noteTypeName, deckPath, sourceURL) {
|
|
2644
|
-
const kanjiObj = getKanji(
|
|
2645
|
-
kanji,
|
|
2646
|
-
dict,
|
|
2647
|
-
jmDict,
|
|
2648
|
-
svgList,
|
|
2649
|
-
noteTypeName,
|
|
2650
|
-
deckPath
|
|
2651
|
-
);
|
|
2652
|
-
if (kanjiObj) {
|
|
2653
|
-
let usedInfo = false;
|
|
2654
|
-
if (info.components) {
|
|
2655
|
-
kanjiObj.components = info.components;
|
|
2656
|
-
usedInfo = true;
|
|
2657
|
-
}
|
|
2658
|
-
if (info.mnemonic && info.mnemonic.length > 0) {
|
|
2659
|
-
kanjiObj.mnemonic = info.mnemonic;
|
|
2660
|
-
usedInfo = true;
|
|
2661
|
-
}
|
|
2662
|
-
if (useWords === true && info.words && info.words.length > 0) {
|
|
2663
|
-
kanjiObj.words = info.words;
|
|
2664
|
-
usedInfo = true;
|
|
2665
|
-
}
|
|
2666
|
-
if (kanjiObj.components)
|
|
2667
|
-
kanjiObj.tags.push(`kanji::components::${kanjiObj.components.length}`);
|
|
2668
|
-
if (kanjiObj.mnemonic && kanjiObj.mnemonic.length > 0)
|
|
2669
|
-
kanjiObj.tags.push("kanji::has_mnemonic");
|
|
2670
|
-
if (useWords === true && kanjiObj.words && info.words)
|
|
2671
|
-
kanjiObj.tags.forEach((tag, index) => {
|
|
2672
|
-
if (tag.startsWith("kanji::words::") && kanjiObj.words) {
|
|
2673
|
-
kanjiObj.tags.splice(
|
|
2674
|
-
index,
|
|
2675
|
-
1,
|
|
2676
|
-
`kanji::words::${kanjiObj.words.length}`
|
|
2677
|
-
);
|
|
2678
|
-
}
|
|
2679
|
-
});
|
|
2680
|
-
if (sourceURL && info.externalInfo === true && usedInfo)
|
|
2681
|
-
kanjiObj.source = sourceURL;
|
|
2682
|
-
return kanjiObj;
|
|
2676
|
+
return word;
|
|
2683
2677
|
} else return void 0;
|
|
2684
2678
|
}
|
|
2685
2679
|
function isWord(entry) {
|
|
2686
|
-
return entry
|
|
2680
|
+
return isObjectArray(Object.getOwnPropertyDescriptor(entry, "readings")?.value) && isObjectArray(Object.getOwnPropertyDescriptor(entry, "translations")?.value);
|
|
2687
2681
|
}
|
|
2688
2682
|
function isRadical(entry) {
|
|
2689
|
-
return entry
|
|
2683
|
+
return typeof Object.getOwnPropertyDescriptor(entry, "radical")?.value === "string";
|
|
2690
2684
|
}
|
|
2691
2685
|
function isKanji(entry) {
|
|
2692
|
-
return entry
|
|
2686
|
+
return !Object.hasOwn(entry, "translations") && !Object.hasOwn(entry, "readings") && !Object.hasOwn(entry, "radical") && typeof Object.getOwnPropertyDescriptor(entry, "kanji")?.value === "string";
|
|
2693
2687
|
}
|
|
2694
2688
|
function isKana(entry) {
|
|
2695
|
-
return entry
|
|
2689
|
+
return typeof Object.getOwnPropertyDescriptor(entry, "kana")?.value === "string";
|
|
2696
2690
|
}
|
|
2697
2691
|
function isGrammar(entry) {
|
|
2698
|
-
return entry
|
|
2692
|
+
return typeof Object.getOwnPropertyDescriptor(entry, "point")?.value === "string";
|
|
2699
2693
|
}
|
|
2700
2694
|
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>" : ""}`;
|
|
2701
|
-
var createEntry = (entry, notes, phrase, glossSpecific) => `<div class="entry${glossSpecific ? " gloss-specific" : ""}">${entry}${notes && notes.length > 0 ? createNotes(notes, phrase) : ""}</div>`;
|
|
2695
|
+
var createEntry = (entry, notes, phrase, glossSpecific) => `<div class="entry${glossSpecific === true ? " gloss-specific" : ""}">${entry}${notes !== void 0 && notes.length > 0 ? createNotes(notes, phrase) : ""}</div>`;
|
|
2702
2696
|
function generateAnkiNote(entry) {
|
|
2703
|
-
var _a, _b;
|
|
2704
2697
|
const fields = [];
|
|
2705
2698
|
if (isWord(entry)) {
|
|
2706
2699
|
const firstReading = createEntry(
|
|
@@ -2714,52 +2707,51 @@ function generateAnkiNote(entry) {
|
|
|
2714
2707
|
)
|
|
2715
2708
|
).join("")}</details>` : "";
|
|
2716
2709
|
const readingsField = `${firstReading}${otherReadings}`;
|
|
2717
|
-
const firstKanjiForm = entry.kanjiForms ? createEntry(
|
|
2710
|
+
const firstKanjiForm = entry.kanjiForms !== void 0 ? createEntry(
|
|
2718
2711
|
`<span class="word word-kanjiform"><ruby><rb>${entry.kanjiForms[0].kanjiForm}</rb><rt>${entry.readings[0].reading}</rt></ruby></span>`,
|
|
2719
2712
|
entry.kanjiForms[0].notes
|
|
2720
2713
|
) : void 0;
|
|
2721
|
-
const otherKanjiForms = entry.kanjiForms && entry.kanjiForms.length > 1 ? `<details><summary>Show other kanji forms</summary>${entry.kanjiForms.slice(1).map((kanjiFormEntry) => {
|
|
2714
|
+
const otherKanjiForms = entry.kanjiForms !== void 0 && entry.kanjiForms.length > 1 ? `<details><summary>Show other kanji forms</summary>${entry.kanjiForms.slice(1).map((kanjiFormEntry) => {
|
|
2722
2715
|
const restrictedReading = entry.readings.find(
|
|
2723
|
-
(r) => r.notes && r.notes.includes(
|
|
2716
|
+
(r) => r.notes !== void 0 && r.notes.includes(
|
|
2724
2717
|
`Reading restricted to ${kanjiFormEntry.kanjiForm}`
|
|
2725
2718
|
)
|
|
2726
2719
|
);
|
|
2727
|
-
return
|
|
2720
|
+
return createEntry(
|
|
2721
|
+
`<span class="word word-kanjiform">${restrictedReading !== void 0 ? "<ruby><rb>" : ""}${kanjiFormEntry.kanjiForm}${restrictedReading !== void 0 ? `</rb><rt>${restrictedReading.reading}</rt></ruby>` : ""}</span>`,
|
|
2722
|
+
kanjiFormEntry.notes
|
|
2723
|
+
);
|
|
2728
2724
|
}).join("")}</details>` : "";
|
|
2729
|
-
const kanjiFormsField = firstKanjiForm ? `${firstKanjiForm}${otherKanjiForms}` : '<span class="word word-kanjiform">(no kanji forms)</span>';
|
|
2725
|
+
const kanjiFormsField = firstKanjiForm !== void 0 ? `${firstKanjiForm}${otherKanjiForms}` : '<span class="word word-kanjiform">(no kanji forms)</span>';
|
|
2730
2726
|
const firstThreeTranslations = entry.translations.slice(0, 3).map(
|
|
2731
|
-
(translationEntry, index) =>
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
void 0
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
)) ? true : void 0
|
|
2740
|
-
);
|
|
2741
|
-
}
|
|
2727
|
+
(translationEntry, index) => createEntry(
|
|
2728
|
+
`<span class="word word-translation">${translationEntry.translation}</span>`,
|
|
2729
|
+
translationEntry.notes,
|
|
2730
|
+
void 0,
|
|
2731
|
+
entry.phrases !== void 0 ? entry.phrases.some(
|
|
2732
|
+
(phrase, index2) => index === index2 && phrase.glossNumber !== void 0 && phrase.glossNumber.wordId === entry.id && phrase.glossNumber.glossNumber === index + 1
|
|
2733
|
+
) ? true : void 0 : void 0
|
|
2734
|
+
)
|
|
2742
2735
|
).join("");
|
|
2743
2736
|
const otherTranslations = entry.translations.length > 3 ? `<details><summary>Show other translations</summary>${entry.translations.map((translationEntry, index) => {
|
|
2744
|
-
var _a2;
|
|
2745
2737
|
if (index < 3) return "null";
|
|
2746
2738
|
return createEntry(
|
|
2747
2739
|
`<span class="word word-translation">${translationEntry.translation}</span>`,
|
|
2748
2740
|
translationEntry.notes,
|
|
2749
2741
|
void 0,
|
|
2750
|
-
|
|
2751
|
-
(phrase, index2) => index === index2 && phrase.glossNumber && phrase.glossNumber.wordId === entry.id && phrase.glossNumber.glossNumber === index + 1
|
|
2752
|
-
)
|
|
2742
|
+
entry.phrases !== void 0 ? entry.phrases.some(
|
|
2743
|
+
(phrase, index2) => index === index2 && phrase.glossNumber !== void 0 && phrase.glossNumber.wordId === entry.id && phrase.glossNumber.glossNumber === index + 1
|
|
2744
|
+
) ? true : void 0 : void 0
|
|
2753
2745
|
);
|
|
2754
2746
|
}).filter((translation) => translation !== "null").join("")}</details>` : "";
|
|
2755
2747
|
const translationsField = `${firstThreeTranslations}${otherTranslations}`;
|
|
2756
|
-
const firstFivePhrases =
|
|
2748
|
+
const firstFivePhrases = entry.phrases?.slice(0, 5).map(
|
|
2757
2749
|
(phraseEntry, index) => createEntry(
|
|
2758
2750
|
`<span class="word word-phrase"><span class="word word-phrase-original">${phraseEntry.originalPhrase}</span><span class="word word-phrase-furigana">${phraseEntry.phrase}</span></span>`,
|
|
2759
2751
|
[phraseEntry.translation],
|
|
2760
2752
|
true,
|
|
2761
2753
|
entry.translations.some(
|
|
2762
|
-
(_translation, index2) => index === index2 && phraseEntry.glossNumber && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2754
|
+
(_translation, index2) => index === index2 && phraseEntry.glossNumber !== void 0 && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2763
2755
|
) ? true : void 0
|
|
2764
2756
|
)
|
|
2765
2757
|
).join("");
|
|
@@ -2770,40 +2762,34 @@ function generateAnkiNote(entry) {
|
|
|
2770
2762
|
[phraseEntry.translation],
|
|
2771
2763
|
true,
|
|
2772
2764
|
entry.translations.some(
|
|
2773
|
-
(_translation, index2) => index === index2 && phraseEntry.glossNumber && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2765
|
+
(_translation, index2) => index === index2 && phraseEntry.glossNumber !== void 0 && phraseEntry.glossNumber.wordId === entry.id && phraseEntry.glossNumber.glossNumber === index2 + 1
|
|
2774
2766
|
) ? true : void 0
|
|
2775
2767
|
);
|
|
2776
2768
|
}).filter((phrase) => phrase !== "null").join("")}</details>` : "";
|
|
2777
|
-
const phrasesField = firstFivePhrases ? `${firstFivePhrases}${otherPhrases}` : '<span class="word word-phrase">(no phrases) (Search on dictionaries!)</span>';
|
|
2778
|
-
const firstThreeDefinitions =
|
|
2779
|
-
(definitionEntry) =>
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
`<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a2 = definitionEntry.furigana) != null ? _a2 : definitionEntry.definition}</span></span>`
|
|
2783
|
-
);
|
|
2784
|
-
}
|
|
2769
|
+
const phrasesField = firstFivePhrases !== void 0 ? `${firstFivePhrases}${otherPhrases}` : '<span class="word word-phrase">(no phrases) (Search on dictionaries!)</span>';
|
|
2770
|
+
const firstThreeDefinitions = entry.definitions?.slice(0, 3).map(
|
|
2771
|
+
(definitionEntry) => createEntry(
|
|
2772
|
+
`<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">${definitionEntry.furigana ?? definitionEntry.definition}</span></span>`
|
|
2773
|
+
)
|
|
2785
2774
|
).join("");
|
|
2786
2775
|
const otherDefinitions = entry.definitions !== void 0 && entry.definitions.length > 3 ? `<details><summary>Show other definitions</summary>${entry.definitions.map(
|
|
2787
|
-
(definitionEntry, index) =>
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
`<span class="word word-definition${definitionEntry.mayNotBeAccurate === true ? " mnba" : ""}"><span class="word word-definition-original">${definitionEntry.definition}</span><span class="word word-definition-furigana">${(_a2 = definitionEntry.furigana) != null ? _a2 : definitionEntry.definition}</span></span>`
|
|
2791
|
-
)}` : "null";
|
|
2792
|
-
}
|
|
2776
|
+
(definitionEntry, index) => index > 2 ? createEntry(
|
|
2777
|
+
`<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">${definitionEntry.furigana ?? definitionEntry.definition}</span></span>`
|
|
2778
|
+
) : "null"
|
|
2793
2779
|
).filter((definition) => definition !== "null").join("")}</details>` : "";
|
|
2794
|
-
const definitionsField = firstThreeDefinitions ? `${firstThreeDefinitions}${otherDefinitions}` : '<span class="word word-definition">(no definitions)</span>';
|
|
2780
|
+
const definitionsField = firstThreeDefinitions !== void 0 ? `${firstThreeDefinitions}${otherDefinitions}` : '<span class="word word-definition">(no definitions)</span>';
|
|
2795
2781
|
fields.push(
|
|
2796
|
-
...entry.kanjiForms && !entry.usuallyInKana ? [kanjiFormsField, readingsField] : [readingsField, kanjiFormsField],
|
|
2782
|
+
...entry.kanjiForms !== void 0 && !entry.usuallyInKana ? [kanjiFormsField, readingsField] : [readingsField, kanjiFormsField],
|
|
2797
2783
|
translationsField,
|
|
2798
2784
|
phrasesField,
|
|
2799
2785
|
definitionsField,
|
|
2800
|
-
entry.kanji ? entry.kanji.map(
|
|
2786
|
+
entry.kanji !== void 0 ? entry.kanji.map(
|
|
2801
2787
|
(kanjiEntry) => createEntry(
|
|
2802
2788
|
`<span class="word word-kanji">${kanjiEntry.kanji}${kanjiEntry.meanings === void 0 ? " (no meanings)" : ""}</span>`,
|
|
2803
2789
|
kanjiEntry.meanings
|
|
2804
2790
|
)
|
|
2805
2791
|
).join("") : '<span class="word word-kanji">(no kanji)</span>',
|
|
2806
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2792
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2807
2793
|
entry.tags.map(
|
|
2808
2794
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2809
2795
|
).join(" ")
|
|
@@ -2823,19 +2809,19 @@ function generateAnkiNote(entry) {
|
|
|
2823
2809
|
`<span class="radical radical-meaning">${meaningEntry}</span>`
|
|
2824
2810
|
)
|
|
2825
2811
|
).join(""),
|
|
2826
|
-
entry.mnemonic ? createEntry(
|
|
2812
|
+
entry.mnemonic !== void 0 ? createEntry(
|
|
2827
2813
|
`<span class="radical radical-mnemonic">${entry.mnemonic}</span>`
|
|
2828
2814
|
) : '<span class="radical radical-mnemonic">(no mnemonic) (Come up with your own!)</span>',
|
|
2829
|
-
entry.kanji ? entry.kanji.map(
|
|
2815
|
+
entry.kanji !== void 0 ? entry.kanji.map(
|
|
2830
2816
|
(kanji) => createEntry(
|
|
2831
|
-
`<span class="radical radical-kanji">${kanji.kanji}${kanji.meanings && kanji.meanings.length
|
|
2817
|
+
`<span class="radical radical-kanji">${kanji.kanji}${kanji.meanings !== void 0 && kanji.meanings.length > 0 ? ` - ${kanji.meanings[0]}` : ""}</span>`
|
|
2832
2818
|
)
|
|
2833
2819
|
).join("") : '<span class="radical radical-kanji">(no "used-in" kanji)</span>',
|
|
2834
|
-
entry.strokes ? createEntry(
|
|
2835
|
-
`<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>`
|
|
2820
|
+
entry.strokes !== void 0 ? createEntry(
|
|
2821
|
+
`<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>`
|
|
2836
2822
|
) : '<span class="radical radical-strokes">(no stroke number)</span>',
|
|
2837
|
-
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>',
|
|
2838
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2823
|
+
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>',
|
|
2824
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2839
2825
|
entry.tags.map(
|
|
2840
2826
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2841
2827
|
).join(" ")
|
|
@@ -2844,44 +2830,44 @@ function generateAnkiNote(entry) {
|
|
|
2844
2830
|
if (isKanji(entry))
|
|
2845
2831
|
fields.push(
|
|
2846
2832
|
createEntry(`<span class="kanji kanji-character">${entry.kanji}</span>`),
|
|
2847
|
-
entry.meanings ? entry.meanings.map(
|
|
2833
|
+
entry.meanings !== void 0 ? entry.meanings.map(
|
|
2848
2834
|
(meaningEntry) => createEntry(
|
|
2849
2835
|
`<span class="kanji kanji-meaning">${meaningEntry}</span>`
|
|
2850
2836
|
)
|
|
2851
2837
|
).join("") : '<span class="kanji kanji-meaning">(no meanings)</span>',
|
|
2852
|
-
entry.onyomi ? entry.onyomi.map(
|
|
2838
|
+
entry.onyomi !== void 0 ? entry.onyomi.map(
|
|
2853
2839
|
(onyomiEntry) => createEntry(
|
|
2854
2840
|
`<span class="kanji kanji-onyomi">${onyomiEntry}</span>`
|
|
2855
2841
|
)
|
|
2856
2842
|
).join("") : `<span class="kanji kanji-onyomi">(no onyomi) ${entry.kokuji === true ? "(kokuji)" : ""}</span>`,
|
|
2857
|
-
entry.kunyomi ? entry.kunyomi.map(
|
|
2843
|
+
entry.kunyomi !== void 0 ? entry.kunyomi.map(
|
|
2858
2844
|
(kunyomiEntry) => createEntry(
|
|
2859
2845
|
`<span class="kanji kanji-kunyomi">${kunyomiEntry}</span>`
|
|
2860
2846
|
)
|
|
2861
2847
|
).join("") : `<span class="kanji kanji-kunyomi">(no kunyomi) ${entry.kokuji === true ? "(kokuji)" : ""}</span>`,
|
|
2862
|
-
entry.nanori ? entry.nanori.map(
|
|
2848
|
+
entry.nanori !== void 0 ? entry.nanori.map(
|
|
2863
2849
|
(nanoriEntry) => createEntry(
|
|
2864
2850
|
`<span class="kanji kanji-nanori">${nanoriEntry}</span>`
|
|
2865
2851
|
)
|
|
2866
2852
|
).join("") : '<span class="kanji kanji-nanori">(no nanori)</span>',
|
|
2867
|
-
entry.components ? entry.components.map(
|
|
2853
|
+
entry.components !== void 0 ? entry.components.map(
|
|
2868
2854
|
(componentEntry) => createEntry(
|
|
2869
|
-
`<span class="kanji kanji-component">${componentEntry.component}${componentEntry.meaning ? ` - ${componentEntry.meaning}` : ""}</span>`
|
|
2855
|
+
`<span class="kanji kanji-component">${componentEntry.component}${componentEntry.meaning !== void 0 ? ` - ${componentEntry.meaning}` : ""}</span>`
|
|
2870
2856
|
)
|
|
2871
2857
|
).join("") : '<span class="kanji kanji-component">(no components)</span>',
|
|
2872
|
-
entry.mnemonic ? createEntry(
|
|
2858
|
+
entry.mnemonic !== void 0 ? createEntry(
|
|
2873
2859
|
`<span class="kanji kanji-mnemonic">${entry.mnemonic}</span>`
|
|
2874
2860
|
) : '<span class="kanji kanji-mnemonic">(no mnemonic) (Come up with your own!)</span>',
|
|
2875
|
-
entry.words ? entry.words.map(
|
|
2861
|
+
entry.words !== void 0 ? entry.words.map(
|
|
2876
2862
|
(word) => createEntry(
|
|
2877
|
-
`<span class="kanji kanji-words">${word.kanjiForms
|
|
2863
|
+
`<span class="kanji kanji-words">${word.kanjiForms.find((kf) => kf.kanjiForm.includes(entry.kanji)).kanjiForm} / ${word.readings[0].reading} - ${word.translations[0].translation}</span>`
|
|
2878
2864
|
)
|
|
2879
2865
|
).join("") : '<span class="kanji kanji-words">(no words) (Search on dictionaries!)</span>',
|
|
2880
|
-
entry.strokes ? createEntry(
|
|
2881
|
-
`<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>`
|
|
2866
|
+
entry.strokes !== void 0 ? createEntry(
|
|
2867
|
+
`<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>`
|
|
2882
2868
|
) : '<span class="kanji kanji-strokes">(no stroke number)</span>',
|
|
2883
|
-
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>',
|
|
2884
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2869
|
+
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>',
|
|
2870
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2885
2871
|
entry.tags.map(
|
|
2886
2872
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2887
2873
|
).join(" ")
|
|
@@ -2893,10 +2879,10 @@ function generateAnkiNote(entry) {
|
|
|
2893
2879
|
createEntry(
|
|
2894
2880
|
`<span class="kana kana-reading">${entry.reading}${entry.audio !== void 0 ? `<br>[sound:${entry.audio}]` : ""}</span>`
|
|
2895
2881
|
),
|
|
2896
|
-
entry.svg ? createEntry(
|
|
2882
|
+
entry.svg !== void 0 ? createEntry(
|
|
2897
2883
|
`<img class="kana kana-stroke-order" src="${entry.svg}" alt="${entry.kana} stroke order SVG">`
|
|
2898
2884
|
) : "(no stroke order SVG available)",
|
|
2899
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2885
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2900
2886
|
entry.tags.map(
|
|
2901
2887
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2902
2888
|
).join(" ")
|
|
@@ -2905,28 +2891,28 @@ function generateAnkiNote(entry) {
|
|
|
2905
2891
|
if (isGrammar(entry))
|
|
2906
2892
|
fields.push(
|
|
2907
2893
|
createEntry(`<span class="grammar grammar-point">${entry.point}</span>`),
|
|
2908
|
-
entry.readings ? entry.readings.map(
|
|
2894
|
+
entry.readings !== void 0 ? entry.readings.map(
|
|
2909
2895
|
(readingEntry) => createEntry(
|
|
2910
2896
|
`<span class="grammar grammar-reading">${readingEntry.reading}</span>`
|
|
2911
2897
|
)
|
|
2912
2898
|
).join("") : '<span class="grammar grammar-reading">(no additional readings)</span>',
|
|
2913
2899
|
createEntry(
|
|
2914
|
-
`<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>`
|
|
2900
|
+
`<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>`
|
|
2915
2901
|
),
|
|
2916
|
-
entry.usages ? entry.usages.map(
|
|
2902
|
+
entry.usages !== void 0 ? entry.usages.map(
|
|
2917
2903
|
(usage) => createEntry(
|
|
2918
2904
|
`<span class="grammar grammar-usage">${usage}</span>`
|
|
2919
2905
|
)
|
|
2920
2906
|
).join("") : '<span class="grammar grammar-usage">(no usages)</span>',
|
|
2921
|
-
entry.phrases ? entry.phrases.map(
|
|
2907
|
+
entry.phrases !== void 0 ? entry.phrases.map(
|
|
2922
2908
|
(phraseEntry) => createEntry(
|
|
2923
2909
|
`<span class="grammar grammar-phrase"><span class="grammar grammar-phrase-original">${phraseEntry.originalPhrase}</span><span class="grammar grammar-phrase-furigana">${phraseEntry.phrase}</span></span>`,
|
|
2924
2910
|
[phraseEntry.translation],
|
|
2925
2911
|
true
|
|
2926
2912
|
)
|
|
2927
2913
|
).join("") : '<span class="grammar grammar-phrase">(no phrases) (Search on dictionaries!)</span>',
|
|
2928
|
-
entry.source ? `<span class="grammar grammar-source"><a href="${entry.source}" target="_blank">Source</a></span>` : '<span class="grammar grammar-source">(no source)</span>',
|
|
2929
|
-
...entry.tags && entry.tags.length > 0 ? [
|
|
2914
|
+
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>',
|
|
2915
|
+
...entry.tags !== void 0 && entry.tags.length > 0 ? [
|
|
2930
2916
|
entry.tags.map(
|
|
2931
2917
|
(tag) => tag.trim().toLowerCase().replaceAll(" ", "::")
|
|
2932
2918
|
).join(" ")
|
|
@@ -2938,8 +2924,9 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2938
2924
|
const headers = [noteHeaderKeys.separator, noteHeaderKeys.html];
|
|
2939
2925
|
let ankiNotes = "";
|
|
2940
2926
|
if (list.length > 0) {
|
|
2941
|
-
|
|
2942
|
-
|
|
2927
|
+
let noteInfo = {};
|
|
2928
|
+
if (defaultNoteInfo !== void 0) noteInfo = { ...defaultNoteInfo };
|
|
2929
|
+
const infoValues = Object.values(noteInfo);
|
|
2943
2930
|
let invalidList = false;
|
|
2944
2931
|
const firstEntry = list[0];
|
|
2945
2932
|
const firstEntryInfo = {
|
|
@@ -2949,7 +2936,7 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2949
2936
|
};
|
|
2950
2937
|
if (infoValues.length === 0 || infoValues.some((value) => value === true || value === void 0)) {
|
|
2951
2938
|
for (const res of list)
|
|
2952
|
-
if (
|
|
2939
|
+
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) {
|
|
2953
2940
|
invalidList = true;
|
|
2954
2941
|
break;
|
|
2955
2942
|
}
|
|
@@ -2958,26 +2945,28 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2958
2945
|
const hasHeader = { guid: false, noteType: false, deckPath: false, tags: false };
|
|
2959
2946
|
let headerCount = 0;
|
|
2960
2947
|
ankiNotes = list.filter((result) => result.doNotCreateNote === void 0).map((result) => {
|
|
2961
|
-
if (typeof
|
|
2962
|
-
if (isWord(result) && result.id
|
|
2948
|
+
if (typeof noteInfo.guid === "string" && result.noteID === void 0) {
|
|
2949
|
+
if (isWord(result) && result.id !== void 0)
|
|
2950
|
+
result.noteID = result.id;
|
|
2963
2951
|
if (isKanji(result)) result.noteID = result.kanji;
|
|
2964
2952
|
if (isRadical(result)) result.noteID = result.radical;
|
|
2965
2953
|
if (isKana(result)) result.noteID = result.kana;
|
|
2966
|
-
if (isGrammar(result) && result.id
|
|
2954
|
+
if (isGrammar(result) && result.id !== void 0)
|
|
2955
|
+
result.noteID = result.id;
|
|
2967
2956
|
}
|
|
2968
|
-
if (typeof
|
|
2969
|
-
result.noteTypeName =
|
|
2970
|
-
if (typeof
|
|
2971
|
-
result.deckPath =
|
|
2972
|
-
if (!hasHeader.guid && result.noteID) {
|
|
2957
|
+
if (typeof noteInfo.noteType === "string" && result.noteTypeName === void 0)
|
|
2958
|
+
result.noteTypeName = noteInfo.noteType;
|
|
2959
|
+
if (typeof noteInfo.deckPath === "string" && result.deckPath === void 0)
|
|
2960
|
+
result.deckPath = noteInfo.deckPath;
|
|
2961
|
+
if (!hasHeader.guid && result.noteID !== void 0) {
|
|
2973
2962
|
headers.push(`${noteHeaderKeys.guid}${++headerCount}`);
|
|
2974
2963
|
hasHeader.guid = true;
|
|
2975
2964
|
}
|
|
2976
|
-
if (!hasHeader.noteType && result.noteTypeName) {
|
|
2965
|
+
if (!hasHeader.noteType && result.noteTypeName !== void 0) {
|
|
2977
2966
|
headers.push(`${noteHeaderKeys.notetype}${++headerCount}`);
|
|
2978
2967
|
hasHeader.noteType = true;
|
|
2979
2968
|
}
|
|
2980
|
-
if (!hasHeader.deckPath && result.deckPath) {
|
|
2969
|
+
if (!hasHeader.deckPath && result.deckPath !== void 0) {
|
|
2981
2970
|
headers.push(`${noteHeaderKeys.deck}${++headerCount}`);
|
|
2982
2971
|
hasHeader.deckPath = true;
|
|
2983
2972
|
}
|
|
@@ -2986,7 +2975,7 @@ function generateAnkiNotesFile(list, defaultNoteInfo) {
|
|
|
2986
2975
|
headers.push(`${noteHeaderKeys.tags}${note.length + headerCount}`);
|
|
2987
2976
|
hasHeader.tags = true;
|
|
2988
2977
|
}
|
|
2989
|
-
return `${result.noteID ? `${result.noteID} ` : ""}${result.noteTypeName ? `${result.noteTypeName} ` : ""}${result.deckPath ? `${result.deckPath} ` : ""}${note.join(" ")}`;
|
|
2978
|
+
return `${result.noteID !== void 0 ? `${result.noteID} ` : ""}${result.noteTypeName !== void 0 ? `${result.noteTypeName} ` : ""}${result.deckPath !== void 0 ? `${result.deckPath} ` : ""}${note.join(" ")}`;
|
|
2990
2979
|
}).join("\n").trim();
|
|
2991
2980
|
}
|
|
2992
2981
|
return `${headers.join("\n")}
|
|
@@ -3013,6 +3002,7 @@ ${ankiNotes}`;
|
|
|
3013
3002
|
getWord,
|
|
3014
3003
|
getWordDefinitions,
|
|
3015
3004
|
getWordDefinitionsWithFurigana,
|
|
3005
|
+
hiraganaToKatakana,
|
|
3016
3006
|
isGrammar,
|
|
3017
3007
|
isKana,
|
|
3018
3008
|
isKanji,
|
|
@@ -3021,9 +3011,11 @@ ${ankiNotes}`;
|
|
|
3021
3011
|
isStringArray,
|
|
3022
3012
|
isValidArrayWithFirstElement,
|
|
3023
3013
|
isWord,
|
|
3014
|
+
katakanaToHiragana,
|
|
3024
3015
|
notSearchedForms,
|
|
3025
3016
|
noteHeaderKeys,
|
|
3026
3017
|
noteMap,
|
|
3018
|
+
posList,
|
|
3027
3019
|
regexps,
|
|
3028
3020
|
shuffleArray
|
|
3029
3021
|
});
|