henkan 3.0.0 → 3.0.2
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/README.md +1 -1
- package/dist/index.cjs.js +45 -69
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +45 -69
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/docs/api/functions/convertJMdict.md +1 -1
- package/docs/api/functions/convertJMnedict.md +1 -1
- package/docs/api/functions/convertJawiktionaryAsync.md +1 -1
- package/docs/api/functions/convertJawiktionarySync.md +1 -1
- package/docs/api/functions/generateAnkiNote.md +1 -1
- package/docs/api/functions/generateAnkiNotesFile.md +1 -1
- package/docs/api/functions/getKanji.md +1 -1
- package/docs/api/functions/getKanjiExtended.md +1 -1
- package/docs/api/functions/getName.md +1 -1
- package/docs/api/functions/getWord.md +1 -1
- package/docs/api/functions/getWordDefinitions.md +1 -1
- package/docs/api/functions/getWordDefinitionsWithFurigana.md +1 -1
- package/package.json +4 -4
- package/src/utils.ts +101 -179
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAYhC,OAAO,EACL,eAAe,EAEf,SAAS,EACT,aAAa,EAIb,qBAAqB,EAErB,QAAQ,EACR,WAAW,EACX,WAAW,EAEX,QAAQ,EACR,gBAAgB,EAChB,SAAS,EAET,OAAO,EACP,iBAAiB,EACjB,IAAI,EACJ,KAAK,EAEL,aAAa,EAEb,WAAW,EACX,aAAa,EACb,IAAI,EACJ,cAAc,EAId,OAAO,EAEP,sBAAsB,EACtB,MAAM,EACN,YAAY,EACZ,aAAa,EAGb,IAAI,EACJ,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACf,MAAM,SAAS,CAAC;AAKjB;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EA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ACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,MAAM,EAAE,CAkjBV;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,eAAe,CAAC,EAAE,eAAe,EACjC,UAAU,CAAC,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,EAAE,GACxB,MAAM,CAuIR"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertJMdict**(`xmlString`, `examples?`): [`DictWord`](../interfaces/DictWord.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:289](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L289)
|
|
12
12
|
|
|
13
13
|
Converts a JMdict `JMdict_e` file into an array of [DictWord](../interfaces/DictWord.md) objects.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertJMnedict**(`xmlString`, `examples?`): [`DictName`](../interfaces/DictName.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:476](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L476)
|
|
12
12
|
|
|
13
13
|
Converts a JMnedict `JMnedict.xml` file into an array of [DictWord](../interfaces/DictWord.md) objects.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertJawiktionaryAsync**(`stream`): `Promise`\<[`JaWiktionaryEntry`](../interfaces/JaWiktionaryEntry.md)[]\>
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:1275](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1275)
|
|
12
12
|
|
|
13
13
|
Converts and filters a `ja.wiktionary.org` JSONL dump (async)
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertJawiktionarySync**(`buffer`): [`JaWiktionaryEntry`](../interfaces/JaWiktionaryEntry.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:1248](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1248)
|
|
12
12
|
|
|
13
13
|
Converts and filters a `ja.wiktionary.org` JSONL dump (sync)
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **generateAnkiNote**(`entry`, `customData?`, `additionalTags?`): `string`[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:3073](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L3073)
|
|
12
12
|
|
|
13
13
|
Generates an array where each field holds an entry’s info wrapped in HTML tags.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **generateAnkiNotesFile**(`list`, `defaultNoteInfo?`, `customData?`, `additionalTags?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:3649](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L3649)
|
|
12
12
|
|
|
13
13
|
Generates an Anki notes file with each entry’s info organized into fields, either in HTML or plain text.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getKanji**(`searchedKanji`, `dict?`, `jmDict?`, `svgList?`, `noteTypeName?`, `deckPath?`): [`Kanji`](../interfaces/Kanji.md) \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:1992](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1992)
|
|
12
12
|
|
|
13
13
|
Transforms a converted `KANJIDIC` entry into a more readable format, by providing either the kanji or the [DictKanji](../interfaces/DictKanji.md) object directly.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getKanjiExtended**(`info`, `kanji`, `dict?`, `useWords?`, `jmDict?`, `svgList?`, `noteTypeName?`, `deckPath?`, `sourceURL?`): [`Kanji`](../interfaces/Kanji.md) \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:2192](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2192)
|
|
12
12
|
|
|
13
13
|
Same as [getKanji](getKanji.md), but with possible extra info.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getName**(`searchedName`, `dict?`, `kanjiDic?`, `examples?`, `noteTypeName?`, `deckPath?`): [`Name`](../interfaces/Name.md) \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:2731](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2731)
|
|
12
12
|
|
|
13
13
|
Transforms a converted `JMnedict` entry into a more readable format, by providing either its JMnedict entry ID or the [DictName](../interfaces/DictName.md) object directly.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getWord**(`searchedWord`, `dict?`, `kanjiDic?`, `examples?`, `definitions?`, `noteTypeName?`, `deckPath?`): [`Word`](../interfaces/Word.md) \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:2263](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2263)
|
|
12
12
|
|
|
13
13
|
Transforms a converted `JMdict` entry into a more readable format, by providing either its JMdict entry ID or the [DictWord](../interfaces/DictWord.md) object directly.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getWordDefinitions**(`wiktionaryEntries`, `jmDict`): [`WordDefinitionPair`](../interfaces/WordDefinitionPair.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:1329](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1329)
|
|
12
12
|
|
|
13
13
|
Pairs Japanese definitions with JMdict word entries
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getWordDefinitionsWithFurigana**(`entryList`, `jmDict`): `Promise`\<[`WordDefinitionPair`](../interfaces/WordDefinitionPair.md)[]\>
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:1920](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1920)
|
|
12
12
|
|
|
13
13
|
Pairs Japanese definitions with JMdict word entries (with furigana)
|
|
14
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "henkan",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Converter & Simplifier for JMdict, JMnedict, KANJIDIC, KRADFILE2, RADKFILE2 and Tanaka Corpus",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fjsd",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "^24.10.9",
|
|
76
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
77
|
-
"@typescript-eslint/parser": "^8.
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
77
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
78
78
|
"@vitest/coverage-v8": "^4.0.18",
|
|
79
79
|
"esbuild": "^0.27.3",
|
|
80
80
|
"eslint": "^9.39.2",
|
|
81
81
|
"eslint-plugin-import": "^2.32.0",
|
|
82
|
-
"eslint-plugin-jsdoc": "^62.
|
|
82
|
+
"eslint-plugin-jsdoc": "^62.7.1",
|
|
83
83
|
"eslint-plugin-prettier": "^5.5.5",
|
|
84
84
|
"prettier": "^3.8.1",
|
|
85
85
|
"rimraf": "^6.1.3",
|
package/src/utils.ts
CHANGED
|
@@ -218,54 +218,60 @@ export function getValidForms(
|
|
|
218
218
|
): ReadingsKanjiFormsPair {
|
|
219
219
|
const kanjiFormRestrictions: Set<string> = new Set<string>();
|
|
220
220
|
|
|
221
|
-
const
|
|
222
|
-
(
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
) {
|
|
229
|
-
if (reading.kanjiFormRestrictions !== undefined) {
|
|
230
|
-
for (const kfr of reading.kanjiFormRestrictions)
|
|
231
|
-
kanjiFormRestrictions.add(kfr);
|
|
221
|
+
const existValidReadings: boolean = readings.some(
|
|
222
|
+
(r: DictReading) =>
|
|
223
|
+
r.commonness !== undefined ||
|
|
224
|
+
((r.notes === undefined ||
|
|
225
|
+
!r.notes.some((note: string) => notSearchedForms.has(note))) &&
|
|
226
|
+
(r.kanjiFormRestrictions !== undefined || wordIsCommon === undefined)),
|
|
227
|
+
);
|
|
232
228
|
|
|
233
|
-
|
|
234
|
-
|
|
229
|
+
const validReadings: DictReading[] = readings.filter((r: DictReading) => {
|
|
230
|
+
if (
|
|
231
|
+
!existValidReadings ||
|
|
232
|
+
r.commonness !== undefined ||
|
|
233
|
+
r.notes === undefined ||
|
|
234
|
+
!r.notes.some((note: string) => notSearchedForms.has(note))
|
|
235
|
+
) {
|
|
236
|
+
if (r.kanjiFormRestrictions !== undefined) {
|
|
237
|
+
for (const kfr of r.kanjiFormRestrictions)
|
|
238
|
+
kanjiFormRestrictions.add(kfr);
|
|
235
239
|
|
|
236
|
-
if (
|
|
240
|
+
if (
|
|
241
|
+
r.notes === undefined ||
|
|
242
|
+
!r.notes.some((note: string) => notSearchedForms.has(note))
|
|
243
|
+
)
|
|
237
244
|
return true;
|
|
238
245
|
}
|
|
239
246
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
247
|
+
if (
|
|
248
|
+
!existValidReadings ||
|
|
249
|
+
wordIsCommon === undefined ||
|
|
250
|
+
r.commonness !== undefined
|
|
251
|
+
)
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
243
254
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
255
|
+
return false;
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
const existValidKanjiForms: boolean | undefined = kanjiForms?.some(
|
|
259
|
+
(kf: DictKanjiForm) =>
|
|
260
|
+
kanjiFormRestrictions.has(kf.form) ||
|
|
261
|
+
kf.commonness !== undefined ||
|
|
262
|
+
((kf.notes === undefined ||
|
|
263
|
+
!kf.notes.some((note: string) => notSearchedForms.has(note))) &&
|
|
264
|
+
wordIsCommon === undefined),
|
|
251
265
|
);
|
|
252
266
|
|
|
253
267
|
const validKanjiForms: DictKanjiForm[] | undefined = kanjiForms?.filter(
|
|
254
|
-
(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
notSearchedForms.has(note),
|
|
262
|
-
) &&
|
|
263
|
-
(wordIsCommon === undefined ||
|
|
264
|
-
kanjiForm.commonness !== undefined)) ||
|
|
265
|
-
kanjiFormRestrictions.has(kanjiForm.form)
|
|
266
|
-
);
|
|
267
|
-
else return true;
|
|
268
|
-
},
|
|
268
|
+
(kf: DictKanjiForm) =>
|
|
269
|
+
existValidKanjiForms === false ||
|
|
270
|
+
kanjiFormRestrictions.has(kf.form) ||
|
|
271
|
+
kf.commonness !== undefined ||
|
|
272
|
+
((kf.notes === undefined ||
|
|
273
|
+
!kf.notes.some((note: string) => notSearchedForms.has(note))) &&
|
|
274
|
+
wordIsCommon === undefined),
|
|
269
275
|
);
|
|
270
276
|
|
|
271
277
|
return {
|
|
@@ -300,9 +306,6 @@ export function convertJMdict(
|
|
|
300
306
|
example.parts.flatMap((part: ExamplePart) => [
|
|
301
307
|
part.baseForm,
|
|
302
308
|
...(part.reading !== undefined ? [part.reading] : []),
|
|
303
|
-
...(part.inflectedForm !== undefined
|
|
304
|
-
? [part.inflectedForm]
|
|
305
|
-
: []),
|
|
306
309
|
...(part.referenceID !== undefined ? [part.referenceID] : []),
|
|
307
310
|
]),
|
|
308
311
|
),
|
|
@@ -490,9 +493,6 @@ export function convertJMnedict(
|
|
|
490
493
|
example.parts.flatMap((part: ExamplePart) => [
|
|
491
494
|
part.baseForm,
|
|
492
495
|
...(part.reading !== undefined ? [part.reading] : []),
|
|
493
|
-
...(part.inflectedForm !== undefined
|
|
494
|
-
? [part.inflectedForm]
|
|
495
|
-
: []),
|
|
496
496
|
...(part.referenceID !== undefined ? [part.referenceID] : []),
|
|
497
497
|
]),
|
|
498
498
|
),
|
|
@@ -1070,18 +1070,6 @@ export function createEntryMaps(
|
|
|
1070
1070
|
if (exList === undefined) partExamplesMap.set(part.reading, [ex]);
|
|
1071
1071
|
else exList.push(ex);
|
|
1072
1072
|
}
|
|
1073
|
-
if (
|
|
1074
|
-
part.inflectedForm !== undefined &&
|
|
1075
|
-
entryParts.has(part.inflectedForm)
|
|
1076
|
-
) {
|
|
1077
|
-
const exList: TanakaExample[] | undefined = partExamplesMap.get(
|
|
1078
|
-
part.inflectedForm,
|
|
1079
|
-
);
|
|
1080
|
-
|
|
1081
|
-
if (exList === undefined)
|
|
1082
|
-
partExamplesMap.set(part.inflectedForm, [ex]);
|
|
1083
|
-
else exList.push(ex);
|
|
1084
|
-
}
|
|
1085
1073
|
|
|
1086
1074
|
if (
|
|
1087
1075
|
part.referenceID !== undefined &&
|
|
@@ -1179,18 +1167,6 @@ export function createEntryMaps(
|
|
|
1179
1167
|
if (exList === undefined) partExamplesMap.set(part.reading, [ex]);
|
|
1180
1168
|
else exList.push(ex);
|
|
1181
1169
|
}
|
|
1182
|
-
if (
|
|
1183
|
-
part.inflectedForm !== undefined &&
|
|
1184
|
-
entryParts.has(part.inflectedForm)
|
|
1185
|
-
) {
|
|
1186
|
-
const exList: TanakaExample[] | undefined = partExamplesMap.get(
|
|
1187
|
-
part.inflectedForm,
|
|
1188
|
-
);
|
|
1189
|
-
|
|
1190
|
-
if (exList === undefined)
|
|
1191
|
-
partExamplesMap.set(part.inflectedForm, [ex]);
|
|
1192
|
-
else exList.push(ex);
|
|
1193
|
-
}
|
|
1194
1170
|
}
|
|
1195
1171
|
|
|
1196
1172
|
for (const name of jmNedict) {
|
|
@@ -2529,14 +2505,10 @@ export function getWord(
|
|
|
2529
2505
|
const readingMatchingKanjiFormExamples: {
|
|
2530
2506
|
ex: TanakaExample;
|
|
2531
2507
|
partIndex: number;
|
|
2532
|
-
form: string;
|
|
2533
|
-
referenceIDMatch?: true | undefined;
|
|
2534
|
-
includesTranslation?: true | undefined;
|
|
2535
2508
|
}[] = [];
|
|
2536
2509
|
let kanjiFormExamples: {
|
|
2537
2510
|
ex: TanakaExample;
|
|
2538
2511
|
partIndex: number;
|
|
2539
|
-
form: string;
|
|
2540
2512
|
includesTranslation?: true | undefined;
|
|
2541
2513
|
}[] = [];
|
|
2542
2514
|
|
|
@@ -2547,44 +2519,40 @@ export function getWord(
|
|
|
2547
2519
|
includesTranslation?: true | undefined;
|
|
2548
2520
|
}[] = [];
|
|
2549
2521
|
|
|
2522
|
+
let hasKanjiFormExamplesWithTranslation: boolean = false;
|
|
2523
|
+
let hasReadingExamplesWithTranslation: boolean = false;
|
|
2524
|
+
|
|
2550
2525
|
for (const example of exampleList)
|
|
2551
2526
|
for (let i: number = 0; i < example.parts.length; i++) {
|
|
2552
2527
|
if (seenPhrases.has(example.phrase)) break;
|
|
2553
2528
|
|
|
2554
|
-
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2555
|
-
example.translation.includes(m),
|
|
2556
|
-
);
|
|
2557
|
-
|
|
2558
2529
|
const part: ExamplePart = example.parts[i]!;
|
|
2559
2530
|
|
|
2560
2531
|
const readingAsReadingMatch: boolean =
|
|
2561
2532
|
part.reading !== undefined && readings.has(part.reading);
|
|
2562
|
-
const readingAsInflectedFormMatch: boolean =
|
|
2563
|
-
part.inflectedForm !== undefined &&
|
|
2564
|
-
readings.has(part.inflectedForm);
|
|
2565
2533
|
|
|
2566
2534
|
const referenceIDMatch: boolean = part.referenceID === dictWord.id;
|
|
2567
2535
|
|
|
2568
2536
|
if (kanjiForms !== undefined && kanjiForms.has(part.baseForm)) {
|
|
2569
|
-
if (
|
|
2570
|
-
readingAsReadingMatch ||
|
|
2571
|
-
readingAsInflectedFormMatch ||
|
|
2572
|
-
referenceIDMatch
|
|
2573
|
-
)
|
|
2537
|
+
if (readingAsReadingMatch || referenceIDMatch)
|
|
2574
2538
|
readingMatchingKanjiFormExamples.push({
|
|
2575
2539
|
ex: example,
|
|
2576
2540
|
partIndex: i,
|
|
2577
|
-
form: part.baseForm,
|
|
2578
|
-
...(referenceIDMatch ? { referenceIDMatch: true } : {}),
|
|
2579
|
-
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
2580
2541
|
});
|
|
2581
|
-
else
|
|
2542
|
+
else {
|
|
2543
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2544
|
+
example.translation.includes(m),
|
|
2545
|
+
);
|
|
2546
|
+
|
|
2547
|
+
if (!hasKanjiFormExamplesWithTranslation && includesTranslation)
|
|
2548
|
+
hasKanjiFormExamplesWithTranslation = true;
|
|
2549
|
+
|
|
2582
2550
|
kanjiFormExamples.push({
|
|
2583
2551
|
ex: example,
|
|
2584
2552
|
partIndex: i,
|
|
2585
|
-
form: part.baseForm,
|
|
2586
2553
|
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
2587
2554
|
});
|
|
2555
|
+
}
|
|
2588
2556
|
|
|
2589
2557
|
seenPhrases.add(example.phrase);
|
|
2590
2558
|
|
|
@@ -2597,6 +2565,13 @@ export function getWord(
|
|
|
2597
2565
|
(readingAsBaseFormMatch || referenceIDMatch) &&
|
|
2598
2566
|
kanjiForms === undefined
|
|
2599
2567
|
) {
|
|
2568
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2569
|
+
example.translation.includes(m),
|
|
2570
|
+
);
|
|
2571
|
+
|
|
2572
|
+
if (!hasReadingExamplesWithTranslation && includesTranslation)
|
|
2573
|
+
hasReadingExamplesWithTranslation = true;
|
|
2574
|
+
|
|
2600
2575
|
readingExamples.push({
|
|
2601
2576
|
ex: example,
|
|
2602
2577
|
partIndex: i,
|
|
@@ -2610,34 +2585,13 @@ export function getWord(
|
|
|
2610
2585
|
}
|
|
2611
2586
|
}
|
|
2612
2587
|
|
|
2613
|
-
if (
|
|
2614
|
-
kanjiFormExamples.length > 0 &&
|
|
2615
|
-
kanjiFormExamples.some(
|
|
2616
|
-
(ex: {
|
|
2617
|
-
ex: TanakaExample;
|
|
2618
|
-
partIndex: number;
|
|
2619
|
-
form: string;
|
|
2620
|
-
includesTranslation?: true | undefined;
|
|
2621
|
-
}) =>
|
|
2622
|
-
ex.includesTranslation === true ||
|
|
2623
|
-
ex.ex.parts.some(
|
|
2624
|
-
(part: ExamplePart) =>
|
|
2625
|
-
ex.form === part.baseForm && part.glossNumber !== undefined,
|
|
2626
|
-
),
|
|
2627
|
-
)
|
|
2628
|
-
)
|
|
2588
|
+
if (kanjiFormExamples.length > 0 && hasKanjiFormExamplesWithTranslation)
|
|
2629
2589
|
kanjiFormExamples = kanjiFormExamples.filter(
|
|
2630
2590
|
(ex: {
|
|
2631
2591
|
ex: TanakaExample;
|
|
2632
2592
|
partIndex: number;
|
|
2633
|
-
form: string;
|
|
2634
2593
|
includesTranslation?: true | undefined;
|
|
2635
|
-
}) =>
|
|
2636
|
-
ex.includesTranslation === true ||
|
|
2637
|
-
ex.ex.parts.some(
|
|
2638
|
-
(part: ExamplePart) =>
|
|
2639
|
-
ex.form === part.baseForm && part.glossNumber !== undefined,
|
|
2640
|
-
),
|
|
2594
|
+
}) => ex.includesTranslation === true,
|
|
2641
2595
|
);
|
|
2642
2596
|
else if (
|
|
2643
2597
|
kanjiFormExamples.length > 0 &&
|
|
@@ -2645,17 +2599,7 @@ export function getWord(
|
|
|
2645
2599
|
)
|
|
2646
2600
|
kanjiFormExamples.length = 0;
|
|
2647
2601
|
|
|
2648
|
-
if (
|
|
2649
|
-
readingExamples.length > 0 &&
|
|
2650
|
-
readingExamples.some(
|
|
2651
|
-
(ex: {
|
|
2652
|
-
ex: TanakaExample;
|
|
2653
|
-
partIndex: number;
|
|
2654
|
-
referenceIDMatch?: true | undefined;
|
|
2655
|
-
includesTranslation?: true | undefined;
|
|
2656
|
-
}) => ex.includesTranslation === true || ex.referenceIDMatch === true,
|
|
2657
|
-
)
|
|
2658
|
-
)
|
|
2602
|
+
if (readingExamples.length > 0 && hasReadingExamplesWithTranslation)
|
|
2659
2603
|
readingExamples = readingExamples.filter(
|
|
2660
2604
|
(ex: {
|
|
2661
2605
|
ex: TanakaExample;
|
|
@@ -2665,20 +2609,12 @@ export function getWord(
|
|
|
2665
2609
|
}) => ex.includesTranslation === true || ex.referenceIDMatch === true,
|
|
2666
2610
|
);
|
|
2667
2611
|
|
|
2668
|
-
let wordExamples:
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
}
|
|
2675
|
-
| {
|
|
2676
|
-
ex: TanakaExample;
|
|
2677
|
-
partIndex: number;
|
|
2678
|
-
referenceIDMatch?: true | undefined;
|
|
2679
|
-
includesTranslation?: true | undefined;
|
|
2680
|
-
}
|
|
2681
|
-
)[] = [
|
|
2612
|
+
let wordExamples: {
|
|
2613
|
+
ex: TanakaExample;
|
|
2614
|
+
partIndex: number;
|
|
2615
|
+
referenceIDMatch?: true | undefined;
|
|
2616
|
+
includesTranslation?: true | undefined;
|
|
2617
|
+
}[] = [
|
|
2682
2618
|
...(word.kanjiForms !== undefined
|
|
2683
2619
|
? [...readingMatchingKanjiFormExamples, ...kanjiFormExamples]
|
|
2684
2620
|
: readingExamples),
|
|
@@ -2715,21 +2651,12 @@ export function getWord(
|
|
|
2715
2651
|
if (glossSpecificExamples.length > 0) {
|
|
2716
2652
|
if (glossSpecificExamples.length < 5) {
|
|
2717
2653
|
wordExamples = wordExamples.filter(
|
|
2718
|
-
(
|
|
2719
|
-
ex:
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
includesTranslation?: true | undefined;
|
|
2725
|
-
}
|
|
2726
|
-
| {
|
|
2727
|
-
ex: TanakaExample;
|
|
2728
|
-
partIndex: number;
|
|
2729
|
-
referenceIDMatch?: true | undefined;
|
|
2730
|
-
includesTranslation?: true | undefined;
|
|
2731
|
-
},
|
|
2732
|
-
) => !seenPhrases.has(ex.ex.phrase),
|
|
2654
|
+
(ex: {
|
|
2655
|
+
ex: TanakaExample;
|
|
2656
|
+
partIndex: number;
|
|
2657
|
+
referenceIDMatch?: true | undefined;
|
|
2658
|
+
includesTranslation?: true | undefined;
|
|
2659
|
+
}) => !seenPhrases.has(ex.ex.phrase),
|
|
2733
2660
|
);
|
|
2734
2661
|
|
|
2735
2662
|
if (wordExamples.length > 0)
|
|
@@ -2749,21 +2676,12 @@ export function getWord(
|
|
|
2749
2676
|
? wordExamples.slice(0, 5)
|
|
2750
2677
|
: wordExamples
|
|
2751
2678
|
).map(
|
|
2752
|
-
(
|
|
2753
|
-
ex:
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
includesTranslation?: true | undefined;
|
|
2759
|
-
}
|
|
2760
|
-
| {
|
|
2761
|
-
ex: TanakaExample;
|
|
2762
|
-
partIndex: number;
|
|
2763
|
-
referenceIDMatch?: true | undefined;
|
|
2764
|
-
includesTranslation?: true | undefined;
|
|
2765
|
-
},
|
|
2766
|
-
) => ({
|
|
2679
|
+
(ex: {
|
|
2680
|
+
ex: TanakaExample;
|
|
2681
|
+
partIndex: number;
|
|
2682
|
+
referenceIDMatch?: true | undefined;
|
|
2683
|
+
includesTranslation?: true | undefined;
|
|
2684
|
+
}) => ({
|
|
2767
2685
|
phrase: ex.ex.furigana ?? ex.ex.phrase,
|
|
2768
2686
|
translation: ex.ex.translation,
|
|
2769
2687
|
originalPhrase: ex.ex.phrase,
|
|
@@ -2986,10 +2904,6 @@ export function getName(
|
|
|
2986
2904
|
for (let i: number = 0; i < example.parts.length; i++) {
|
|
2987
2905
|
if (seenPhrases.has(example.phrase)) break;
|
|
2988
2906
|
|
|
2989
|
-
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2990
|
-
example.translation.includes(m),
|
|
2991
|
-
);
|
|
2992
|
-
|
|
2993
2907
|
const part: ExamplePart = example.parts[i]!;
|
|
2994
2908
|
|
|
2995
2909
|
const readingAsReadingMatch: boolean =
|
|
@@ -3000,10 +2914,9 @@ export function getName(
|
|
|
3000
2914
|
kanjiForms.has(part.baseForm) &&
|
|
3001
2915
|
readingAsReadingMatch
|
|
3002
2916
|
) {
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
});
|
|
2917
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2918
|
+
example.translation.includes(m),
|
|
2919
|
+
);
|
|
3007
2920
|
|
|
3008
2921
|
if (
|
|
3009
2922
|
!hasReadingMatchingKanjiFormWithTranslation &&
|
|
@@ -3011,6 +2924,11 @@ export function getName(
|
|
|
3011
2924
|
)
|
|
3012
2925
|
hasReadingMatchingKanjiFormWithTranslation = true;
|
|
3013
2926
|
|
|
2927
|
+
readingMatchingKanjiFormExamples.push({
|
|
2928
|
+
ex: example,
|
|
2929
|
+
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
2930
|
+
});
|
|
2931
|
+
|
|
3014
2932
|
seenPhrases.add(example.phrase);
|
|
3015
2933
|
|
|
3016
2934
|
break;
|
|
@@ -3019,14 +2937,18 @@ export function getName(
|
|
|
3019
2937
|
const readingAsBaseFormMatch: boolean = readings.has(part.baseForm);
|
|
3020
2938
|
|
|
3021
2939
|
if (readingAsBaseFormMatch && kanjiForms === undefined) {
|
|
2940
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2941
|
+
example.translation.includes(m),
|
|
2942
|
+
);
|
|
2943
|
+
|
|
2944
|
+
if (!hasReadingWithTranslation && includesTranslation)
|
|
2945
|
+
hasReadingWithTranslation = true;
|
|
2946
|
+
|
|
3022
2947
|
readingExamples.push({
|
|
3023
2948
|
ex: example,
|
|
3024
2949
|
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
3025
2950
|
});
|
|
3026
2951
|
|
|
3027
|
-
if (!hasReadingWithTranslation && includesTranslation)
|
|
3028
|
-
hasReadingWithTranslation = true;
|
|
3029
|
-
|
|
3030
2952
|
seenPhrases.add(example.phrase);
|
|
3031
2953
|
|
|
3032
2954
|
break;
|