henkan 3.0.0 → 3.0.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/README.md +1 -1
- package/dist/index.cjs.js +29 -47
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.mjs +29 -47
- package/dist/index.mjs.map +2 -2
- package/dist/types/utils.d.ts.map +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/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 +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 +1 -1
- package/src/utils.ts +56 -140
|
@@ -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,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AAS,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,OAAO,CAIzD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,KAAK,CAOrD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,IAAI,CAInD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,OAAO,CAIzD;AAoBD;;;;;;GAMG;AACH,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
|
> **convertJMnedict**(`xmlString`, `examples?`): [`DictName`](../interfaces/DictName.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:470](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L470)
|
|
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:1269](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1269)
|
|
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:1242](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1242)
|
|
12
12
|
|
|
13
13
|
Converts and filters a `ja.wiktionary.org` JSONL dump (sync)
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertKanjiDic**(`xmlString`): [`DictKanji`](../interfaces/DictKanji.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:595](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L595)
|
|
12
12
|
|
|
13
13
|
Converts a KANJIDIC `kanjidic2.xml` file into an array of [DictKanji](../interfaces/DictKanji.md) objects.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertKradFile**(`kradBuffer`, `kanjiDic`, `katakanaList`): [`DictKanjiWithRadicals`](../interfaces/DictKanjiWithRadicals.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:866](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L866)
|
|
12
12
|
|
|
13
13
|
Converts a `kradfile2` file (EUC-JP encoded) into an array of [DictKanjiWithRadicals](../interfaces/DictKanjiWithRadicals.md) objects.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertRadkFile**(`radkBuffer`, `kanjiDic`): [`DictRadical`](../interfaces/DictRadical.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:805](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L805)
|
|
12
12
|
|
|
13
13
|
Converts a `radkfile2` file (EUC-JP encoded) into an array of [DictRadical](../interfaces/DictRadical.md) objects.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertTanakaCorpus**(`tanakaString`): [`TanakaExample`](../interfaces/TanakaExample.md)[]
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:692](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L692)
|
|
12
12
|
|
|
13
13
|
Converts a Tanaka Corpus `examples.utf` file into an array of [TanakaExample](../interfaces/TanakaExample.md) objects.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **convertTanakaCorpusWithFurigana**(`tanakaString`): `Promise`\<[`TanakaExample`](../interfaces/TanakaExample.md)[]\>
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:780](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L780)
|
|
12
12
|
|
|
13
13
|
Converts a Tanaka Corpus `examples.utf` file into an array of [TanakaExample](../interfaces/TanakaExample.md) objects (with furigana).
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **createEntryMaps**(`jmDict?`, `jmNedict?`, `kanjiDic?`, `tanakaExamples?`, `wordDefinitionPairs?`, `svgList?`): [`EntryMaps`](../interfaces/EntryMaps.md)
|
|
10
10
|
|
|
11
|
-
Defined in: [utils.ts:
|
|
11
|
+
Defined in: [utils.ts:950](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L950)
|
|
12
12
|
|
|
13
13
|
Maps entry properties (IDs and kanji) with other entries.
|
|
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:3067](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L3067)
|
|
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:3643](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L3643)
|
|
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:1986](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1986)
|
|
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:2186](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2186)
|
|
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:2725](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2725)
|
|
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:2257](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L2257)
|
|
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:1323](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1323)
|
|
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:1914](https://github.com/Ronokof/Henkan/blob/main/src/utils.ts#L1914)
|
|
12
12
|
|
|
13
13
|
Pairs Japanese definitions with JMdict word entries (with furigana)
|
|
14
14
|
|
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -300,9 +300,6 @@ export function convertJMdict(
|
|
|
300
300
|
example.parts.flatMap((part: ExamplePart) => [
|
|
301
301
|
part.baseForm,
|
|
302
302
|
...(part.reading !== undefined ? [part.reading] : []),
|
|
303
|
-
...(part.inflectedForm !== undefined
|
|
304
|
-
? [part.inflectedForm]
|
|
305
|
-
: []),
|
|
306
303
|
...(part.referenceID !== undefined ? [part.referenceID] : []),
|
|
307
304
|
]),
|
|
308
305
|
),
|
|
@@ -490,9 +487,6 @@ export function convertJMnedict(
|
|
|
490
487
|
example.parts.flatMap((part: ExamplePart) => [
|
|
491
488
|
part.baseForm,
|
|
492
489
|
...(part.reading !== undefined ? [part.reading] : []),
|
|
493
|
-
...(part.inflectedForm !== undefined
|
|
494
|
-
? [part.inflectedForm]
|
|
495
|
-
: []),
|
|
496
490
|
...(part.referenceID !== undefined ? [part.referenceID] : []),
|
|
497
491
|
]),
|
|
498
492
|
),
|
|
@@ -1070,18 +1064,6 @@ export function createEntryMaps(
|
|
|
1070
1064
|
if (exList === undefined) partExamplesMap.set(part.reading, [ex]);
|
|
1071
1065
|
else exList.push(ex);
|
|
1072
1066
|
}
|
|
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
1067
|
|
|
1086
1068
|
if (
|
|
1087
1069
|
part.referenceID !== undefined &&
|
|
@@ -1179,18 +1161,6 @@ export function createEntryMaps(
|
|
|
1179
1161
|
if (exList === undefined) partExamplesMap.set(part.reading, [ex]);
|
|
1180
1162
|
else exList.push(ex);
|
|
1181
1163
|
}
|
|
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
1164
|
}
|
|
1195
1165
|
|
|
1196
1166
|
for (const name of jmNedict) {
|
|
@@ -2529,14 +2499,10 @@ export function getWord(
|
|
|
2529
2499
|
const readingMatchingKanjiFormExamples: {
|
|
2530
2500
|
ex: TanakaExample;
|
|
2531
2501
|
partIndex: number;
|
|
2532
|
-
form: string;
|
|
2533
|
-
referenceIDMatch?: true | undefined;
|
|
2534
|
-
includesTranslation?: true | undefined;
|
|
2535
2502
|
}[] = [];
|
|
2536
2503
|
let kanjiFormExamples: {
|
|
2537
2504
|
ex: TanakaExample;
|
|
2538
2505
|
partIndex: number;
|
|
2539
|
-
form: string;
|
|
2540
2506
|
includesTranslation?: true | undefined;
|
|
2541
2507
|
}[] = [];
|
|
2542
2508
|
|
|
@@ -2547,44 +2513,40 @@ export function getWord(
|
|
|
2547
2513
|
includesTranslation?: true | undefined;
|
|
2548
2514
|
}[] = [];
|
|
2549
2515
|
|
|
2516
|
+
let hasKanjiFormExamplesWithTranslation: boolean = false;
|
|
2517
|
+
let hasReadingExamplesWithTranslation: boolean = false;
|
|
2518
|
+
|
|
2550
2519
|
for (const example of exampleList)
|
|
2551
2520
|
for (let i: number = 0; i < example.parts.length; i++) {
|
|
2552
2521
|
if (seenPhrases.has(example.phrase)) break;
|
|
2553
2522
|
|
|
2554
|
-
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2555
|
-
example.translation.includes(m),
|
|
2556
|
-
);
|
|
2557
|
-
|
|
2558
2523
|
const part: ExamplePart = example.parts[i]!;
|
|
2559
2524
|
|
|
2560
2525
|
const readingAsReadingMatch: boolean =
|
|
2561
2526
|
part.reading !== undefined && readings.has(part.reading);
|
|
2562
|
-
const readingAsInflectedFormMatch: boolean =
|
|
2563
|
-
part.inflectedForm !== undefined &&
|
|
2564
|
-
readings.has(part.inflectedForm);
|
|
2565
2527
|
|
|
2566
2528
|
const referenceIDMatch: boolean = part.referenceID === dictWord.id;
|
|
2567
2529
|
|
|
2568
2530
|
if (kanjiForms !== undefined && kanjiForms.has(part.baseForm)) {
|
|
2569
|
-
if (
|
|
2570
|
-
readingAsReadingMatch ||
|
|
2571
|
-
readingAsInflectedFormMatch ||
|
|
2572
|
-
referenceIDMatch
|
|
2573
|
-
)
|
|
2531
|
+
if (readingAsReadingMatch || referenceIDMatch)
|
|
2574
2532
|
readingMatchingKanjiFormExamples.push({
|
|
2575
2533
|
ex: example,
|
|
2576
2534
|
partIndex: i,
|
|
2577
|
-
form: part.baseForm,
|
|
2578
|
-
...(referenceIDMatch ? { referenceIDMatch: true } : {}),
|
|
2579
|
-
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
2580
2535
|
});
|
|
2581
|
-
else
|
|
2536
|
+
else {
|
|
2537
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2538
|
+
example.translation.includes(m),
|
|
2539
|
+
);
|
|
2540
|
+
|
|
2541
|
+
if (!hasKanjiFormExamplesWithTranslation && includesTranslation)
|
|
2542
|
+
hasKanjiFormExamplesWithTranslation = true;
|
|
2543
|
+
|
|
2582
2544
|
kanjiFormExamples.push({
|
|
2583
2545
|
ex: example,
|
|
2584
2546
|
partIndex: i,
|
|
2585
|
-
form: part.baseForm,
|
|
2586
2547
|
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
2587
2548
|
});
|
|
2549
|
+
}
|
|
2588
2550
|
|
|
2589
2551
|
seenPhrases.add(example.phrase);
|
|
2590
2552
|
|
|
@@ -2597,6 +2559,13 @@ export function getWord(
|
|
|
2597
2559
|
(readingAsBaseFormMatch || referenceIDMatch) &&
|
|
2598
2560
|
kanjiForms === undefined
|
|
2599
2561
|
) {
|
|
2562
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2563
|
+
example.translation.includes(m),
|
|
2564
|
+
);
|
|
2565
|
+
|
|
2566
|
+
if (!hasReadingExamplesWithTranslation && includesTranslation)
|
|
2567
|
+
hasReadingExamplesWithTranslation = true;
|
|
2568
|
+
|
|
2600
2569
|
readingExamples.push({
|
|
2601
2570
|
ex: example,
|
|
2602
2571
|
partIndex: i,
|
|
@@ -2610,34 +2579,13 @@ export function getWord(
|
|
|
2610
2579
|
}
|
|
2611
2580
|
}
|
|
2612
2581
|
|
|
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
|
-
)
|
|
2582
|
+
if (kanjiFormExamples.length > 0 && hasKanjiFormExamplesWithTranslation)
|
|
2629
2583
|
kanjiFormExamples = kanjiFormExamples.filter(
|
|
2630
2584
|
(ex: {
|
|
2631
2585
|
ex: TanakaExample;
|
|
2632
2586
|
partIndex: number;
|
|
2633
|
-
form: string;
|
|
2634
2587
|
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
|
-
),
|
|
2588
|
+
}) => ex.includesTranslation === true,
|
|
2641
2589
|
);
|
|
2642
2590
|
else if (
|
|
2643
2591
|
kanjiFormExamples.length > 0 &&
|
|
@@ -2645,17 +2593,7 @@ export function getWord(
|
|
|
2645
2593
|
)
|
|
2646
2594
|
kanjiFormExamples.length = 0;
|
|
2647
2595
|
|
|
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
|
-
)
|
|
2596
|
+
if (readingExamples.length > 0 && hasReadingExamplesWithTranslation)
|
|
2659
2597
|
readingExamples = readingExamples.filter(
|
|
2660
2598
|
(ex: {
|
|
2661
2599
|
ex: TanakaExample;
|
|
@@ -2665,20 +2603,12 @@ export function getWord(
|
|
|
2665
2603
|
}) => ex.includesTranslation === true || ex.referenceIDMatch === true,
|
|
2666
2604
|
);
|
|
2667
2605
|
|
|
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
|
-
)[] = [
|
|
2606
|
+
let wordExamples: {
|
|
2607
|
+
ex: TanakaExample;
|
|
2608
|
+
partIndex: number;
|
|
2609
|
+
referenceIDMatch?: true | undefined;
|
|
2610
|
+
includesTranslation?: true | undefined;
|
|
2611
|
+
}[] = [
|
|
2682
2612
|
...(word.kanjiForms !== undefined
|
|
2683
2613
|
? [...readingMatchingKanjiFormExamples, ...kanjiFormExamples]
|
|
2684
2614
|
: readingExamples),
|
|
@@ -2715,21 +2645,12 @@ export function getWord(
|
|
|
2715
2645
|
if (glossSpecificExamples.length > 0) {
|
|
2716
2646
|
if (glossSpecificExamples.length < 5) {
|
|
2717
2647
|
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),
|
|
2648
|
+
(ex: {
|
|
2649
|
+
ex: TanakaExample;
|
|
2650
|
+
partIndex: number;
|
|
2651
|
+
referenceIDMatch?: true | undefined;
|
|
2652
|
+
includesTranslation?: true | undefined;
|
|
2653
|
+
}) => !seenPhrases.has(ex.ex.phrase),
|
|
2733
2654
|
);
|
|
2734
2655
|
|
|
2735
2656
|
if (wordExamples.length > 0)
|
|
@@ -2749,21 +2670,12 @@ export function getWord(
|
|
|
2749
2670
|
? wordExamples.slice(0, 5)
|
|
2750
2671
|
: wordExamples
|
|
2751
2672
|
).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
|
-
) => ({
|
|
2673
|
+
(ex: {
|
|
2674
|
+
ex: TanakaExample;
|
|
2675
|
+
partIndex: number;
|
|
2676
|
+
referenceIDMatch?: true | undefined;
|
|
2677
|
+
includesTranslation?: true | undefined;
|
|
2678
|
+
}) => ({
|
|
2767
2679
|
phrase: ex.ex.furigana ?? ex.ex.phrase,
|
|
2768
2680
|
translation: ex.ex.translation,
|
|
2769
2681
|
originalPhrase: ex.ex.phrase,
|
|
@@ -2986,10 +2898,6 @@ export function getName(
|
|
|
2986
2898
|
for (let i: number = 0; i < example.parts.length; i++) {
|
|
2987
2899
|
if (seenPhrases.has(example.phrase)) break;
|
|
2988
2900
|
|
|
2989
|
-
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2990
|
-
example.translation.includes(m),
|
|
2991
|
-
);
|
|
2992
|
-
|
|
2993
2901
|
const part: ExamplePart = example.parts[i]!;
|
|
2994
2902
|
|
|
2995
2903
|
const readingAsReadingMatch: boolean =
|
|
@@ -3000,10 +2908,9 @@ export function getName(
|
|
|
3000
2908
|
kanjiForms.has(part.baseForm) &&
|
|
3001
2909
|
readingAsReadingMatch
|
|
3002
2910
|
) {
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
});
|
|
2911
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2912
|
+
example.translation.includes(m),
|
|
2913
|
+
);
|
|
3007
2914
|
|
|
3008
2915
|
if (
|
|
3009
2916
|
!hasReadingMatchingKanjiFormWithTranslation &&
|
|
@@ -3011,6 +2918,11 @@ export function getName(
|
|
|
3011
2918
|
)
|
|
3012
2919
|
hasReadingMatchingKanjiFormWithTranslation = true;
|
|
3013
2920
|
|
|
2921
|
+
readingMatchingKanjiFormExamples.push({
|
|
2922
|
+
ex: example,
|
|
2923
|
+
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
2924
|
+
});
|
|
2925
|
+
|
|
3014
2926
|
seenPhrases.add(example.phrase);
|
|
3015
2927
|
|
|
3016
2928
|
break;
|
|
@@ -3019,14 +2931,18 @@ export function getName(
|
|
|
3019
2931
|
const readingAsBaseFormMatch: boolean = readings.has(part.baseForm);
|
|
3020
2932
|
|
|
3021
2933
|
if (readingAsBaseFormMatch && kanjiForms === undefined) {
|
|
2934
|
+
const includesTranslation: boolean = meanings.some((m: string) =>
|
|
2935
|
+
example.translation.includes(m),
|
|
2936
|
+
);
|
|
2937
|
+
|
|
2938
|
+
if (!hasReadingWithTranslation && includesTranslation)
|
|
2939
|
+
hasReadingWithTranslation = true;
|
|
2940
|
+
|
|
3022
2941
|
readingExamples.push({
|
|
3023
2942
|
ex: example,
|
|
3024
2943
|
...(includesTranslation ? { includesTranslation: true } : {}),
|
|
3025
2944
|
});
|
|
3026
2945
|
|
|
3027
|
-
if (!hasReadingWithTranslation && includesTranslation)
|
|
3028
|
-
hasReadingWithTranslation = true;
|
|
3029
|
-
|
|
3030
2946
|
seenPhrases.add(example.phrase);
|
|
3031
2947
|
|
|
3032
2948
|
break;
|