yomitan-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +485 -0
- package/dist/anki-connect-BQyCGW3O.cjs +513 -0
- package/dist/anki-connect-BQyCGW3O.cjs.map +1 -0
- package/dist/anki-connect-CPPuhyiQ.js +6 -0
- package/dist/anki-connect-DbrQHphS.js +495 -0
- package/dist/anki-connect-DbrQHphS.js.map +1 -0
- package/dist/anki-connect-DcheJrp-.cjs +6 -0
- package/dist/anki.cjs +1758 -0
- package/dist/anki.cjs.map +1 -0
- package/dist/anki.d.cts +751 -0
- package/dist/anki.d.cts.map +1 -0
- package/dist/anki.d.ts +751 -0
- package/dist/anki.d.ts.map +1 -0
- package/dist/anki.js +1751 -0
- package/dist/anki.js.map +1 -0
- package/dist/audio-D9DvYyB7.d.cts +48 -0
- package/dist/audio-D9DvYyB7.d.cts.map +1 -0
- package/dist/audio-DQulUkDM.d.ts +48 -0
- package/dist/audio-DQulUkDM.d.ts.map +1 -0
- package/dist/audio-url-generator-BXvQaqUi.cjs +4 -0
- package/dist/audio-url-generator-Dy2hb2Mm.cjs +414 -0
- package/dist/audio-url-generator-Dy2hb2Mm.cjs.map +1 -0
- package/dist/audio-url-generator-Qi0rfzHz.js +4 -0
- package/dist/audio-url-generator-pFQAB5Nb.js +390 -0
- package/dist/audio-url-generator-pFQAB5Nb.js.map +1 -0
- package/dist/audio.cjs +7 -0
- package/dist/audio.d.cts +86 -0
- package/dist/audio.d.cts.map +1 -0
- package/dist/audio.d.ts +86 -0
- package/dist/audio.d.ts.map +1 -0
- package/dist/audio.js +4 -0
- package/dist/batch-processor-BR-gB3H3.js +84 -0
- package/dist/batch-processor-BR-gB3H3.js.map +1 -0
- package/dist/batch-processor-CSF1acTw.cjs +3 -0
- package/dist/batch-processor-DFqM_L-_.cjs +91 -0
- package/dist/batch-processor-DFqM_L-_.cjs.map +1 -0
- package/dist/batch-processor-Quo9jUyf.js +3 -0
- package/dist/chunk-BCwAaXi7.cjs +31 -0
- package/dist/cjk-util-Dp0ZU0sh.cjs +167 -0
- package/dist/cjk-util-Dp0ZU0sh.cjs.map +1 -0
- package/dist/cjk-util-DubXBGDG.js +94 -0
- package/dist/cjk-util-DubXBGDG.js.map +1 -0
- package/dist/core-BUpclilG.d.cts +102 -0
- package/dist/core-BUpclilG.d.cts.map +1 -0
- package/dist/core-DFUj5GtA.d.ts +102 -0
- package/dist/core-DFUj5GtA.d.ts.map +1 -0
- package/dist/database.cjs +7 -0
- package/dist/database.d.cts +4 -0
- package/dist/database.d.ts +4 -0
- package/dist/database.js +5 -0
- package/dist/dictionary-D7l-qFt1.d.cts +316 -0
- package/dist/dictionary-D7l-qFt1.d.cts.map +1 -0
- package/dist/dictionary-_vzfBLWi.d.ts +316 -0
- package/dist/dictionary-_vzfBLWi.d.ts.map +1 -0
- package/dist/dictionary-data-util-CHnRdYZ9.cjs +378 -0
- package/dist/dictionary-data-util-CHnRdYZ9.cjs.map +1 -0
- package/dist/dictionary-data-util-CfOLfEDE.js +323 -0
- package/dist/dictionary-data-util-CfOLfEDE.js.map +1 -0
- package/dist/dictionary-database-BDC2f9zc.d.ts +58 -0
- package/dist/dictionary-database-BDC2f9zc.d.ts.map +1 -0
- package/dist/dictionary-database-CU4TsvCC.js +393 -0
- package/dist/dictionary-database-CU4TsvCC.js.map +1 -0
- package/dist/dictionary-database-DsOi04Sg.d.cts +58 -0
- package/dist/dictionary-database-DsOi04Sg.d.cts.map +1 -0
- package/dist/dictionary-database-lvFvftnO.cjs +412 -0
- package/dist/dictionary-database-lvFvftnO.cjs.map +1 -0
- package/dist/dictionary-importer-BkQQSBhm.d.ts +237 -0
- package/dist/dictionary-importer-BkQQSBhm.d.ts.map +1 -0
- package/dist/dictionary-importer-Cen1z6co.js +1821 -0
- package/dist/dictionary-importer-Cen1z6co.js.map +1 -0
- package/dist/dictionary-importer-DYmmWmcX.cjs +8 -0
- package/dist/dictionary-importer-Da3AuTZw.d.cts +237 -0
- package/dist/dictionary-importer-Da3AuTZw.d.cts.map +1 -0
- package/dist/dictionary-importer-Dhn75iZ4.cjs +1834 -0
- package/dist/dictionary-importer-Dhn75iZ4.cjs.map +1 -0
- package/dist/dictionary-importer-xWkel0h-.js +8 -0
- package/dist/dictionary-update-checker-BNE4pGTx.js +4 -0
- package/dist/dictionary-update-checker-Byjvifd2.cjs +75 -0
- package/dist/dictionary-update-checker-Byjvifd2.cjs.map +1 -0
- package/dist/dictionary-update-checker-YdpalZ41.cjs +4 -0
- package/dist/dictionary-update-checker-kKukiovj.js +69 -0
- package/dist/dictionary-update-checker-kKukiovj.js.map +1 -0
- package/dist/display-generator-BGVWiI0t.js +746 -0
- package/dist/display-generator-BGVWiI0t.js.map +1 -0
- package/dist/display-generator-BMQmG5Ov.cjs +9 -0
- package/dist/display-generator-BxZ7mBjP.js +9 -0
- package/dist/display-generator-DyP-HNzP.cjs +758 -0
- package/dist/display-generator-DyP-HNzP.cjs.map +1 -0
- package/dist/errors-BSezaJwm.cjs +35 -0
- package/dist/errors-BSezaJwm.cjs.map +1 -0
- package/dist/errors-DuuDSO5N.js +22 -0
- package/dist/errors-DuuDSO5N.js.map +1 -0
- package/dist/frequency-ranking-BXjfhhUQ.js +3 -0
- package/dist/frequency-ranking-Cx1kkIrw.cjs +3 -0
- package/dist/frequency-ranking-DEJMTMdg.js +159 -0
- package/dist/frequency-ranking-DEJMTMdg.js.map +1 -0
- package/dist/frequency-ranking-DVYxTXN-.cjs +166 -0
- package/dist/frequency-ranking-DVYxTXN-.cjs.map +1 -0
- package/dist/furigana-5HK97CY8.js +4 -0
- package/dist/furigana-9bBI9-qe.d.ts +47 -0
- package/dist/furigana-9bBI9-qe.d.ts.map +1 -0
- package/dist/furigana-B3-0y231.js +471 -0
- package/dist/furigana-B3-0y231.js.map +1 -0
- package/dist/furigana-CjOhzvZt.d.cts +47 -0
- package/dist/furigana-CjOhzvZt.d.cts.map +1 -0
- package/dist/furigana-DpZLcues.cjs +609 -0
- package/dist/furigana-DpZLcues.cjs.map +1 -0
- package/dist/furigana-h3v2ub4-.cjs +4 -0
- package/dist/import.cjs +12 -0
- package/dist/import.d.cts +107 -0
- package/dist/import.d.cts.map +1 -0
- package/dist/import.d.ts +107 -0
- package/dist/import.d.ts.map +1 -0
- package/dist/import.js +9 -0
- package/dist/index.cjs +275 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +211 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +211 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +238 -0
- package/dist/index.js.map +1 -0
- package/dist/json-DGd-cunA.js +17 -0
- package/dist/json-DGd-cunA.js.map +1 -0
- package/dist/json-DKWp-B7Y.cjs +30 -0
- package/dist/json-DKWp-B7Y.cjs.map +1 -0
- package/dist/language-KN_u-nTR.d.ts +104 -0
- package/dist/language-KN_u-nTR.d.ts.map +1 -0
- package/dist/language-xAbQxgXc.d.cts +104 -0
- package/dist/language-xAbQxgXc.d.cts.map +1 -0
- package/dist/language.cjs +15626 -0
- package/dist/language.cjs.map +1 -0
- package/dist/language.d.cts +959 -0
- package/dist/language.d.cts.map +1 -0
- package/dist/language.d.ts +959 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +15522 -0
- package/dist/language.js.map +1 -0
- package/dist/log-D8KtR3aP.cjs +67 -0
- package/dist/log-D8KtR3aP.cjs.map +1 -0
- package/dist/log-hgSll-dS.js +60 -0
- package/dist/log-hgSll-dS.js.map +1 -0
- package/dist/lookup.cjs +13 -0
- package/dist/lookup.d.cts +161 -0
- package/dist/lookup.d.cts.map +1 -0
- package/dist/lookup.d.ts +161 -0
- package/dist/lookup.d.ts.map +1 -0
- package/dist/lookup.js +10 -0
- package/dist/media-loader-BABA_E4W.js +3 -0
- package/dist/media-loader-Ce9cuANS.cjs +21 -0
- package/dist/media-loader-Ce9cuANS.cjs.map +1 -0
- package/dist/media-loader-qRti-Q6h.js +14 -0
- package/dist/media-loader-qRti-Q6h.js.map +1 -0
- package/dist/media-loader-xlUGaJrx.cjs +3 -0
- package/dist/multi-language-transformer-AlxOM6b3.js +637 -0
- package/dist/multi-language-transformer-AlxOM6b3.js.map +1 -0
- package/dist/multi-language-transformer-MdbQBBOt.cjs +685 -0
- package/dist/multi-language-transformer-MdbQBBOt.cjs.map +1 -0
- package/dist/multi-language-transformer-SEhcJXEB.d.ts +63 -0
- package/dist/multi-language-transformer-SEhcJXEB.d.ts.map +1 -0
- package/dist/multi-language-transformer-Ul9mbRce.d.cts +63 -0
- package/dist/multi-language-transformer-Ul9mbRce.d.cts.map +1 -0
- package/dist/pronunciation-generator-BtBc4q_V.js +397 -0
- package/dist/pronunciation-generator-BtBc4q_V.js.map +1 -0
- package/dist/pronunciation-generator-CBYdXYou.js +4 -0
- package/dist/pronunciation-generator-CFbZlf5J.cjs +445 -0
- package/dist/pronunciation-generator-CFbZlf5J.cjs.map +1 -0
- package/dist/pronunciation-generator-DOz9hEuk.cjs +4 -0
- package/dist/render.cjs +2796 -0
- package/dist/render.cjs.map +1 -0
- package/dist/render.d.cts +424 -0
- package/dist/render.d.cts.map +1 -0
- package/dist/render.d.ts +424 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +2777 -0
- package/dist/render.js.map +1 -0
- package/dist/sentence-parser-BPAJNzqW.js +126 -0
- package/dist/sentence-parser-BPAJNzqW.js.map +1 -0
- package/dist/sentence-parser-BVIOI64h.cjs +132 -0
- package/dist/sentence-parser-BVIOI64h.cjs.map +1 -0
- package/dist/sentence-parser-BoHO3cHn.js +5 -0
- package/dist/sentence-parser-DQVLSW0z.cjs +5 -0
- package/dist/structured-content-generator-BtOApkTW.cjs +4 -0
- package/dist/structured-content-generator-Bx62RYa8.js +4 -0
- package/dist/structured-content-generator-CLnybumI.js +276 -0
- package/dist/structured-content-generator-CLnybumI.js.map +1 -0
- package/dist/structured-content-generator-DrwkB0-k.cjs +282 -0
- package/dist/structured-content-generator-DrwkB0-k.cjs.map +1 -0
- package/dist/text-utilities-B7PIythe.js +8 -0
- package/dist/text-utilities-B7PIythe.js.map +1 -0
- package/dist/text-utilities-Del2Ivkg.cjs +15 -0
- package/dist/text-utilities-Del2Ivkg.cjs.map +1 -0
- package/dist/translator-CRPlPzqi.cjs +1545 -0
- package/dist/translator-CRPlPzqi.cjs.map +1 -0
- package/dist/translator-CWgG5drA.js +1539 -0
- package/dist/translator-CWgG5drA.js.map +1 -0
- package/dist/translator-CaGtJvnQ.cjs +6 -0
- package/dist/translator-Cc6OGxrW.d.ts +180 -0
- package/dist/translator-Cc6OGxrW.d.ts.map +1 -0
- package/dist/translator-CcA-s-W4.d.cts +180 -0
- package/dist/translator-CcA-s-W4.d.cts.map +1 -0
- package/dist/translator-CuJOTK6l.js +6 -0
- package/dist/utilities-C-lbZaJE.cjs +52 -0
- package/dist/utilities-C-lbZaJE.cjs.map +1 -0
- package/dist/utilities-bi3EF-q5.js +33 -0
- package/dist/utilities-bi3EF-q5.js.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/util/log.ts
|
|
4
|
+
/**
|
|
5
|
+
* Simplified console logger for yomitan-core (no EventDispatcher dependency).
|
|
6
|
+
*/
|
|
7
|
+
var Logger = class {
|
|
8
|
+
_name;
|
|
9
|
+
constructor() {
|
|
10
|
+
this._name = "yomitan-core";
|
|
11
|
+
}
|
|
12
|
+
configure(name) {
|
|
13
|
+
this._name = name;
|
|
14
|
+
}
|
|
15
|
+
log(message, ...optionalParams) {
|
|
16
|
+
console.log(message, ...optionalParams);
|
|
17
|
+
}
|
|
18
|
+
warn(error) {
|
|
19
|
+
this.logGenericError(error, "warn");
|
|
20
|
+
}
|
|
21
|
+
error(error) {
|
|
22
|
+
this.logGenericError(error, "error");
|
|
23
|
+
}
|
|
24
|
+
logGenericError(error, level, context) {
|
|
25
|
+
if (typeof context === "undefined") context = { url: "unknown" };
|
|
26
|
+
let errorString;
|
|
27
|
+
try {
|
|
28
|
+
if (typeof error === "string") errorString = error;
|
|
29
|
+
else {
|
|
30
|
+
errorString = typeof error === "object" && error !== null ? error.toString() : `${error}`;
|
|
31
|
+
if (/^\[object \w+\]$/.test(errorString)) errorString = JSON.stringify(error);
|
|
32
|
+
}
|
|
33
|
+
} catch (_e) {
|
|
34
|
+
errorString = `${error}`;
|
|
35
|
+
}
|
|
36
|
+
let errorStack = "";
|
|
37
|
+
try {
|
|
38
|
+
if (error instanceof Error && typeof error.stack === "string") errorStack = error.stack.trimEnd();
|
|
39
|
+
} catch (_e) {}
|
|
40
|
+
if (errorStack.startsWith(errorString)) errorString = errorStack;
|
|
41
|
+
else if (errorStack.length > 0) errorString += `\n${errorStack}`;
|
|
42
|
+
let message = `${this._name} has encountered a problem.`;
|
|
43
|
+
message += `\nOriginating URL: ${context.url}\n`;
|
|
44
|
+
message += errorString;
|
|
45
|
+
switch (level) {
|
|
46
|
+
case "log":
|
|
47
|
+
console.log(message);
|
|
48
|
+
break;
|
|
49
|
+
case "warn":
|
|
50
|
+
console.warn(message);
|
|
51
|
+
break;
|
|
52
|
+
case "error":
|
|
53
|
+
console.error(message);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const log = new Logger();
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
Object.defineProperty(exports, 'log', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return log;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=log-D8KtR3aP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-D8KtR3aP.cjs","names":["name: string","message: unknown","error: unknown","level: LogLevel","context?: LogContext","errorString: string"],"sources":["../src/util/log.ts"],"sourcesContent":["export type LogLevel = 'log' | 'warn' | 'error';\n\nexport type LogContext = {\n url: string;\n};\n\n/**\n * Simplified console logger for yomitan-core (no EventDispatcher dependency).\n */\nclass Logger {\n private _name: string;\n\n constructor() {\n this._name = 'yomitan-core';\n }\n\n configure(name: string): void {\n this._name = name;\n }\n\n log(message: unknown, ...optionalParams: unknown[]): void {\n console.log(message, ...optionalParams);\n }\n\n warn(error: unknown): void {\n this.logGenericError(error, 'warn');\n }\n\n error(error: unknown): void {\n this.logGenericError(error, 'error');\n }\n\n logGenericError(error: unknown, level: LogLevel, context?: LogContext): void {\n if (typeof context === 'undefined') {\n context = { url: 'unknown' };\n }\n\n let errorString: string;\n try {\n if (typeof error === 'string') {\n errorString = error;\n } else {\n errorString = typeof error === 'object' && error !== null ? (error as object).toString() : `${error}`;\n if (/^\\[object \\w+\\]$/.test(errorString)) {\n errorString = JSON.stringify(error);\n }\n }\n } catch (_e) {\n errorString = `${error}`;\n }\n\n let errorStack = '';\n try {\n if (error instanceof Error && typeof error.stack === 'string') {\n errorStack = error.stack.trimEnd();\n }\n } catch (_e) {\n // NOP\n }\n\n if (errorStack.startsWith(errorString)) {\n errorString = errorStack;\n } else if (errorStack.length > 0) {\n errorString += `\\n${errorStack}`;\n }\n\n let message = `${this._name} has encountered a problem.`;\n message += `\\nOriginating URL: ${context.url}\\n`;\n message += errorString;\n\n switch (level) {\n case 'log':\n console.log(message);\n break;\n case 'warn':\n console.warn(message);\n break;\n case 'error':\n console.error(message);\n break;\n }\n }\n}\n\nexport const log = new Logger();\n"],"mappings":";;;;;;AASA,IAAM,SAAN,MAAa;CACT,AAAQ;CAER,cAAc;AACV,OAAK,QAAQ;CAChB;CAED,UAAUA,MAAoB;AAC1B,OAAK,QAAQ;CAChB;CAED,IAAIC,SAAkB,GAAG,gBAAiC;AACtD,UAAQ,IAAI,SAAS,GAAG,eAAe;CAC1C;CAED,KAAKC,OAAsB;AACvB,OAAK,gBAAgB,OAAO,OAAO;CACtC;CAED,MAAMA,OAAsB;AACxB,OAAK,gBAAgB,OAAO,QAAQ;CACvC;CAED,gBAAgBA,OAAgBC,OAAiBC,SAA4B;AACzE,aAAW,YAAY,YACnB,WAAU,EAAE,KAAK,UAAW;EAGhC,IAAIC;AACJ,MAAI;AACA,cAAW,UAAU,SACjB,eAAc;QACX;AACH,yBAAqB,UAAU,YAAY,UAAU,OAAO,AAAC,MAAiB,UAAU,IAAI,EAAE,MAAM;AACpG,QAAI,mBAAmB,KAAK,YAAY,CACpC,eAAc,KAAK,UAAU,MAAM;GAE1C;EACJ,SAAQ,IAAI;AACT,kBAAe,EAAE,MAAM;EAC1B;EAED,IAAI,aAAa;AACjB,MAAI;AACA,OAAI,iBAAiB,gBAAgB,MAAM,UAAU,SACjD,cAAa,MAAM,MAAM,SAAS;EAEzC,SAAQ,IAAI,CAEZ;AAED,MAAI,WAAW,WAAW,YAAY,CAClC,eAAc;WACP,WAAW,SAAS,EAC3B,iBAAgB,IAAI,WAAW;EAGnC,IAAI,WAAW,EAAE,KAAK,MAAM;AAC5B,cAAY,qBAAqB,QAAQ,IAAI;AAC7C,aAAW;AAEX,UAAQ,OAAR;GACI,KAAK;AACD,YAAQ,IAAI,QAAQ;AACpB;GACJ,KAAK;AACD,YAAQ,KAAK,QAAQ;AACrB;GACJ,KAAK;AACD,YAAQ,MAAM,QAAQ;AACtB;EACP;CACJ;AACJ;AAED,MAAa,MAAM,IAAI"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region src/util/log.ts
|
|
2
|
+
/**
|
|
3
|
+
* Simplified console logger for yomitan-core (no EventDispatcher dependency).
|
|
4
|
+
*/
|
|
5
|
+
var Logger = class {
|
|
6
|
+
_name;
|
|
7
|
+
constructor() {
|
|
8
|
+
this._name = "yomitan-core";
|
|
9
|
+
}
|
|
10
|
+
configure(name) {
|
|
11
|
+
this._name = name;
|
|
12
|
+
}
|
|
13
|
+
log(message, ...optionalParams) {
|
|
14
|
+
console.log(message, ...optionalParams);
|
|
15
|
+
}
|
|
16
|
+
warn(error) {
|
|
17
|
+
this.logGenericError(error, "warn");
|
|
18
|
+
}
|
|
19
|
+
error(error) {
|
|
20
|
+
this.logGenericError(error, "error");
|
|
21
|
+
}
|
|
22
|
+
logGenericError(error, level, context) {
|
|
23
|
+
if (typeof context === "undefined") context = { url: "unknown" };
|
|
24
|
+
let errorString;
|
|
25
|
+
try {
|
|
26
|
+
if (typeof error === "string") errorString = error;
|
|
27
|
+
else {
|
|
28
|
+
errorString = typeof error === "object" && error !== null ? error.toString() : `${error}`;
|
|
29
|
+
if (/^\[object \w+\]$/.test(errorString)) errorString = JSON.stringify(error);
|
|
30
|
+
}
|
|
31
|
+
} catch (_e) {
|
|
32
|
+
errorString = `${error}`;
|
|
33
|
+
}
|
|
34
|
+
let errorStack = "";
|
|
35
|
+
try {
|
|
36
|
+
if (error instanceof Error && typeof error.stack === "string") errorStack = error.stack.trimEnd();
|
|
37
|
+
} catch (_e) {}
|
|
38
|
+
if (errorStack.startsWith(errorString)) errorString = errorStack;
|
|
39
|
+
else if (errorStack.length > 0) errorString += `\n${errorStack}`;
|
|
40
|
+
let message = `${this._name} has encountered a problem.`;
|
|
41
|
+
message += `\nOriginating URL: ${context.url}\n`;
|
|
42
|
+
message += errorString;
|
|
43
|
+
switch (level) {
|
|
44
|
+
case "log":
|
|
45
|
+
console.log(message);
|
|
46
|
+
break;
|
|
47
|
+
case "warn":
|
|
48
|
+
console.warn(message);
|
|
49
|
+
break;
|
|
50
|
+
case "error":
|
|
51
|
+
console.error(message);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const log = new Logger();
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
export { log };
|
|
60
|
+
//# sourceMappingURL=log-hgSll-dS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-hgSll-dS.js","names":["name: string","message: unknown","error: unknown","level: LogLevel","context?: LogContext","errorString: string"],"sources":["../src/util/log.ts"],"sourcesContent":["export type LogLevel = 'log' | 'warn' | 'error';\n\nexport type LogContext = {\n url: string;\n};\n\n/**\n * Simplified console logger for yomitan-core (no EventDispatcher dependency).\n */\nclass Logger {\n private _name: string;\n\n constructor() {\n this._name = 'yomitan-core';\n }\n\n configure(name: string): void {\n this._name = name;\n }\n\n log(message: unknown, ...optionalParams: unknown[]): void {\n console.log(message, ...optionalParams);\n }\n\n warn(error: unknown): void {\n this.logGenericError(error, 'warn');\n }\n\n error(error: unknown): void {\n this.logGenericError(error, 'error');\n }\n\n logGenericError(error: unknown, level: LogLevel, context?: LogContext): void {\n if (typeof context === 'undefined') {\n context = { url: 'unknown' };\n }\n\n let errorString: string;\n try {\n if (typeof error === 'string') {\n errorString = error;\n } else {\n errorString = typeof error === 'object' && error !== null ? (error as object).toString() : `${error}`;\n if (/^\\[object \\w+\\]$/.test(errorString)) {\n errorString = JSON.stringify(error);\n }\n }\n } catch (_e) {\n errorString = `${error}`;\n }\n\n let errorStack = '';\n try {\n if (error instanceof Error && typeof error.stack === 'string') {\n errorStack = error.stack.trimEnd();\n }\n } catch (_e) {\n // NOP\n }\n\n if (errorStack.startsWith(errorString)) {\n errorString = errorStack;\n } else if (errorStack.length > 0) {\n errorString += `\\n${errorStack}`;\n }\n\n let message = `${this._name} has encountered a problem.`;\n message += `\\nOriginating URL: ${context.url}\\n`;\n message += errorString;\n\n switch (level) {\n case 'log':\n console.log(message);\n break;\n case 'warn':\n console.warn(message);\n break;\n case 'error':\n console.error(message);\n break;\n }\n }\n}\n\nexport const log = new Logger();\n"],"mappings":";;;;AASA,IAAM,SAAN,MAAa;CACT,AAAQ;CAER,cAAc;AACV,OAAK,QAAQ;CAChB;CAED,UAAUA,MAAoB;AAC1B,OAAK,QAAQ;CAChB;CAED,IAAIC,SAAkB,GAAG,gBAAiC;AACtD,UAAQ,IAAI,SAAS,GAAG,eAAe;CAC1C;CAED,KAAKC,OAAsB;AACvB,OAAK,gBAAgB,OAAO,OAAO;CACtC;CAED,MAAMA,OAAsB;AACxB,OAAK,gBAAgB,OAAO,QAAQ;CACvC;CAED,gBAAgBA,OAAgBC,OAAiBC,SAA4B;AACzE,aAAW,YAAY,YACnB,WAAU,EAAE,KAAK,UAAW;EAGhC,IAAIC;AACJ,MAAI;AACA,cAAW,UAAU,SACjB,eAAc;QACX;AACH,yBAAqB,UAAU,YAAY,UAAU,OAAO,AAAC,MAAiB,UAAU,IAAI,EAAE,MAAM;AACpG,QAAI,mBAAmB,KAAK,YAAY,CACpC,eAAc,KAAK,UAAU,MAAM;GAE1C;EACJ,SAAQ,IAAI;AACT,kBAAe,EAAE,MAAM;EAC1B;EAED,IAAI,aAAa;AACjB,MAAI;AACA,OAAI,iBAAiB,gBAAgB,MAAM,UAAU,SACjD,cAAa,MAAM,MAAM,SAAS;EAEzC,SAAQ,IAAI,CAEZ;AAED,MAAI,WAAW,WAAW,YAAY,CAClC,eAAc;WACP,WAAW,SAAS,EAC3B,iBAAgB,IAAI,WAAW;EAGnC,IAAI,WAAW,EAAE,KAAK,MAAM;AAC5B,cAAY,qBAAqB,QAAQ,IAAI;AAC7C,aAAW;AAEX,UAAQ,OAAR;GACI,KAAK;AACD,YAAQ,IAAI,QAAQ;AACpB;GACJ,KAAK;AACD,YAAQ,KAAK,QAAQ;AACrB;GACJ,KAAK;AACD,YAAQ,MAAM,QAAQ;AACtB;EACP;CACJ;AACJ;AAED,MAAa,MAAM,IAAI"}
|
package/dist/lookup.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require('./log-D8KtR3aP.cjs');
|
|
2
|
+
require('./cjk-util-Dp0ZU0sh.cjs');
|
|
3
|
+
require('./multi-language-transformer-MdbQBBOt.cjs');
|
|
4
|
+
const require_translator = require('./translator-CRPlPzqi.cjs');
|
|
5
|
+
require('./furigana-DpZLcues.cjs');
|
|
6
|
+
const require_sentence_parser = require('./sentence-parser-BVIOI64h.cjs');
|
|
7
|
+
const require_batch_processor = require('./batch-processor-DFqM_L-_.cjs');
|
|
8
|
+
const require_frequency_ranking = require('./frequency-ranking-DVYxTXN-.cjs');
|
|
9
|
+
|
|
10
|
+
exports.BatchProcessor = require_batch_processor.BatchProcessor
|
|
11
|
+
exports.FrequencyRanker = require_frequency_ranking.FrequencyRanker
|
|
12
|
+
exports.SentenceParser = require_sentence_parser.SentenceParser
|
|
13
|
+
exports.Translator = require_translator.Translator
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { TermDictionaryEntry } from "./dictionary-D7l-qFt1.cjs";
|
|
2
|
+
import "./dictionary-importer-Da3AuTZw.cjs";
|
|
3
|
+
import { DictionaryDB } from "./dictionary-database-DsOi04Sg.cjs";
|
|
4
|
+
import { FindTermsMode, Translator } from "./translator-CcA-s-W4.cjs";
|
|
5
|
+
import { FuriganaSegment } from "./furigana-CjOhzvZt.cjs";
|
|
6
|
+
|
|
7
|
+
//#region src/lookup/sentence-parser.d.ts
|
|
8
|
+
interface ParsedSegment {
|
|
9
|
+
/** The surface text of this segment. */
|
|
10
|
+
text: string;
|
|
11
|
+
/** The reading (furigana) for this segment, or empty string if no reading. */
|
|
12
|
+
reading: string;
|
|
13
|
+
/** The dictionary form (headword term) matched for this segment, or the surface text if no match. */
|
|
14
|
+
term: string;
|
|
15
|
+
/** The dictionary entries found for this segment. */
|
|
16
|
+
entries: TermDictionaryEntry[];
|
|
17
|
+
/** Furigana distribution for this segment. */
|
|
18
|
+
furigana: FuriganaSegment[];
|
|
19
|
+
}
|
|
20
|
+
interface ParsedLine {
|
|
21
|
+
/** The parsed segments for this line. */
|
|
22
|
+
segments: ParsedSegment[];
|
|
23
|
+
}
|
|
24
|
+
interface SentenceParserOptions {
|
|
25
|
+
/** The enabled dictionary map for lookups. */
|
|
26
|
+
enabledDictionaryMap: Map<string, {
|
|
27
|
+
index: number;
|
|
28
|
+
priority: number;
|
|
29
|
+
}>;
|
|
30
|
+
/** Maximum character length for substring lookups. Defaults to 20. */
|
|
31
|
+
maxLength?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parses text into segments with dictionary lookups using a left-to-right
|
|
35
|
+
* sliding window (longest match) algorithm.
|
|
36
|
+
*/
|
|
37
|
+
declare class SentenceParser {
|
|
38
|
+
private _translator;
|
|
39
|
+
constructor(translator: Translator);
|
|
40
|
+
/**
|
|
41
|
+
* Parses the given text into lines of parsed segments.
|
|
42
|
+
* For each position, attempts to find the longest dictionary match by
|
|
43
|
+
* querying the translator with progressively shorter substrings.
|
|
44
|
+
* Generates furigana for Japanese text segments.
|
|
45
|
+
*/
|
|
46
|
+
parseText(text: string, language: string, options: SentenceParserOptions): Promise<ParsedLine[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Parses a single line of text into segments.
|
|
49
|
+
*/
|
|
50
|
+
private _parseLine;
|
|
51
|
+
/**
|
|
52
|
+
* Builds a FindTermDictionary map from the simplified input format.
|
|
53
|
+
*/
|
|
54
|
+
private _buildFindTermDictionaryMap;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a FindTermsOptions for simple lookup.
|
|
57
|
+
*/
|
|
58
|
+
private _createFindTermsOptions;
|
|
59
|
+
} //#endregion
|
|
60
|
+
//#region src/lookup/batch-processor.d.ts
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=sentence-parser.d.ts.map
|
|
63
|
+
interface BatchLookupConfig {
|
|
64
|
+
/** The language code for the lookup. Defaults to 'ja'. */
|
|
65
|
+
language?: string;
|
|
66
|
+
/** The enabled dictionary map for lookups. */
|
|
67
|
+
enabledDictionaryMap: Map<string, {
|
|
68
|
+
index: number;
|
|
69
|
+
priority: number;
|
|
70
|
+
}>;
|
|
71
|
+
/** Maximum number of concurrent lookups. Defaults to 5. */
|
|
72
|
+
concurrency?: number;
|
|
73
|
+
/** The find terms mode. Defaults to 'group'. */
|
|
74
|
+
mode?: FindTermsMode;
|
|
75
|
+
}
|
|
76
|
+
interface BatchResult {
|
|
77
|
+
/** The original input text. */
|
|
78
|
+
text: string;
|
|
79
|
+
/** The dictionary entries found for this text. */
|
|
80
|
+
entries: TermDictionaryEntry[];
|
|
81
|
+
/** The length of the original text that was matched. */
|
|
82
|
+
originalTextLength: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Processes multiple text lookups in batch with optional concurrency limiting.
|
|
86
|
+
* Shares the translator's tag cache across lookups for improved performance.
|
|
87
|
+
*/
|
|
88
|
+
declare class BatchProcessor {
|
|
89
|
+
private _translator;
|
|
90
|
+
constructor(translator: Translator);
|
|
91
|
+
/**
|
|
92
|
+
* Looks up multiple texts and returns a map of text to results.
|
|
93
|
+
* Texts are deduplicated before lookup. Concurrency is limited by the
|
|
94
|
+
* `concurrency` config option.
|
|
95
|
+
*/
|
|
96
|
+
batchLookup(texts: string[], config: BatchLookupConfig): Promise<Map<string, BatchResult>>;
|
|
97
|
+
/**
|
|
98
|
+
* Performs a single text lookup.
|
|
99
|
+
*/
|
|
100
|
+
private _lookupSingle;
|
|
101
|
+
/**
|
|
102
|
+
* Builds a FindTermDictionary map from the simplified input format.
|
|
103
|
+
*/
|
|
104
|
+
private _buildFindTermDictionaryMap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/lookup/frequency-ranking.d.ts
|
|
109
|
+
//# sourceMappingURL=batch-processor.d.ts.map
|
|
110
|
+
interface FrequencyRanking {
|
|
111
|
+
/** Per-dictionary frequency data. */
|
|
112
|
+
frequencies: {
|
|
113
|
+
dictionary: string;
|
|
114
|
+
frequency: number;
|
|
115
|
+
displayValue: string | null;
|
|
116
|
+
}[];
|
|
117
|
+
/** The harmonic mean across all dictionaries with positive frequency. */
|
|
118
|
+
harmonicMean: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Queries term frequency metadata from the database and computes
|
|
122
|
+
* aggregate frequency rankings across multiple dictionaries.
|
|
123
|
+
*/
|
|
124
|
+
declare class FrequencyRanker {
|
|
125
|
+
private _db;
|
|
126
|
+
private _numberRegex;
|
|
127
|
+
constructor(db: DictionaryDB);
|
|
128
|
+
/**
|
|
129
|
+
* Gets the frequency ranking for a term across all dictionaries that
|
|
130
|
+
* have frequency metadata for it.
|
|
131
|
+
*
|
|
132
|
+
* @param term The term to look up.
|
|
133
|
+
* @param dictionaries The set of dictionary names to query.
|
|
134
|
+
* @param reading Optional reading to filter frequency data. If not provided,
|
|
135
|
+
* all frequency entries for the term are included.
|
|
136
|
+
* @returns A FrequencyRanking object with per-dictionary frequencies and a harmonic mean.
|
|
137
|
+
*/
|
|
138
|
+
getFrequencyRanking(term: string, dictionaries: string[], reading?: string): Promise<FrequencyRanking>;
|
|
139
|
+
/**
|
|
140
|
+
* Gets frequency rankings for multiple terms at once.
|
|
141
|
+
*/
|
|
142
|
+
getFrequencyRankingBulk(terms: string[], dictionaries: string[]): Promise<Map<string, FrequencyRanking>>;
|
|
143
|
+
/**
|
|
144
|
+
* Computes the harmonic mean of positive frequency values.
|
|
145
|
+
*/
|
|
146
|
+
private _computeHarmonicMean;
|
|
147
|
+
/**
|
|
148
|
+
* Extracts numeric frequency value and display string from generic frequency data.
|
|
149
|
+
*/
|
|
150
|
+
private _getFrequencyInfo;
|
|
151
|
+
/**
|
|
152
|
+
* Converts a string to a number by extracting the first numeric value.
|
|
153
|
+
*/
|
|
154
|
+
private _convertStringToNumber;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
//#endregion
|
|
158
|
+
//# sourceMappingURL=frequency-ranking.d.ts.map
|
|
159
|
+
|
|
160
|
+
export { BatchLookupConfig, BatchProcessor, BatchResult, FindTermsMode, FrequencyRanker, FrequencyRanking, ParsedLine, ParsedSegment, SentenceParser, SentenceParserOptions, Translator };
|
|
161
|
+
//# sourceMappingURL=lookup.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.d.cts","names":[],"sources":["../src/lookup/sentence-parser.ts","../src/lookup/batch-processor.ts","../src/lookup/frequency-ranking.ts"],"sourcesContent":null,"mappings":";;;;;;;UAuBiB,aAAA;;;;EAAA,OAAA,EAAA,MAAA;EAAa;EAAA,IAQjB,EAAA,MAAA;EAAmB;EAEH,OAAA,EAFhB,mBAEgB,EAAA;EAGZ;EAKA,QAAA,EARH,eAQwB,EAAA;;UALrB,UAAA;;YAEH;AAcd;AAA2B,UAXV,qBAAA,CAWU;EAAA;EAGW,oBAUuB,EAtBnC,GAsBmC,CAAA,MAAA,EAAA;IAAgC,KAAA,EAAA,MAAA;IAAR,QAAA,EAAA,MAAA;EAAO,CAAA,CAAA;;;;AC5C5F;;;;AAQwB,cDuBX,cAAA,CCvBW;EAGP,QAAA,WAAW;0BDuBA;;;;ACV5B;;;EAGsC,SASS,CAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EDQc,qBCRd,CAAA,EDQsC,OCRtC,CDQ8C,UCR9C,EAAA,CAAA;EAAiB;;;EAAU,QAAA,UAAA;;;;ECpCzD,QAAA,2BAAgB;;;;;AAWjC,CAAA;;;;UDXiB,iBAAA;;;;wBAIS;IDFT,KAAA,EAAA,MAAa;IAAA,QAAA,EAAA,MAAA;EAAA,CAAA,CAAA;EAQE;EAEH,WAAA,CAAA,EAAA,MAAA;EAGZ;EAKA,IAAA,CAAA,ECZN,aDYM;;UCTA,WAAA;;;EDoBJ;EAAc,OAAA,EChBd,mBDgBc,EAAA;EAAA;EAGW,kBAUuB,EAAA,MAAA;;;AAA+B;;;cCpB/E,cAAA;EAxBI,QAAA,WAAA;EAAiB,WAAA,CAAA,UAAA,EA2BN,UA3BM;EAAA;;AAQV;AAGxB;;uCAyB+C,oBAAoB,QAAQ,YAAY;;;AAZvF;EAA2B,QAAA,aAAA;EAAA;;;EAYuE,QAAvB,2BAAA;;;;;AAAD;UCpCzD,gBAAA;;;;;;EFEA,CAAA,EAAA;EAAa;EAAA,YAQjB,EAAA,MAAA;;AAEgB;AAG7B;AAKA;;cETa,eAAA;;;EFoBA,WAAA,CAAA,EAAA,EEhBO,YFgBO;EAAA;;;;;AAaiE;;;;AC5C5F;EAAkC,mBAAA,CAAA,IAAA,EAAA,MAAA,EAAA,YAAA,EAAA,MAAA,EAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EC8BqD,OD9BrD,CC8B6D,gBD9B7D,CAAA;EAAA;;AAQV;EAGP,uBAAW,CAAA,KAIf,EAAA,MAAA,EAAA,EAAA,YAAmB,EAAA,MAAA,EAAA,CAAA,ECkE4C,ODlE5C,CCkEoD,GDlEpD,CAAA,MAAA,ECkEgE,gBDlEhE,CAAA,CAAA;;;;;EASnB;;;EAGyB,QASS,iBAAA;EAAiB;;;EAAU,QAAA,sBAAA"}
|
package/dist/lookup.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { TermDictionaryEntry } from "./dictionary-_vzfBLWi.js";
|
|
2
|
+
import "./dictionary-importer-BkQQSBhm.js";
|
|
3
|
+
import { DictionaryDB$1 as DictionaryDB } from "./dictionary-database-BDC2f9zc.js";
|
|
4
|
+
import { FindTermsMode, Translator$1 as Translator } from "./translator-Cc6OGxrW.js";
|
|
5
|
+
import { FuriganaSegment } from "./furigana-9bBI9-qe.js";
|
|
6
|
+
|
|
7
|
+
//#region src/lookup/sentence-parser.d.ts
|
|
8
|
+
interface ParsedSegment {
|
|
9
|
+
/** The surface text of this segment. */
|
|
10
|
+
text: string;
|
|
11
|
+
/** The reading (furigana) for this segment, or empty string if no reading. */
|
|
12
|
+
reading: string;
|
|
13
|
+
/** The dictionary form (headword term) matched for this segment, or the surface text if no match. */
|
|
14
|
+
term: string;
|
|
15
|
+
/** The dictionary entries found for this segment. */
|
|
16
|
+
entries: TermDictionaryEntry[];
|
|
17
|
+
/** Furigana distribution for this segment. */
|
|
18
|
+
furigana: FuriganaSegment[];
|
|
19
|
+
}
|
|
20
|
+
interface ParsedLine {
|
|
21
|
+
/** The parsed segments for this line. */
|
|
22
|
+
segments: ParsedSegment[];
|
|
23
|
+
}
|
|
24
|
+
interface SentenceParserOptions {
|
|
25
|
+
/** The enabled dictionary map for lookups. */
|
|
26
|
+
enabledDictionaryMap: Map<string, {
|
|
27
|
+
index: number;
|
|
28
|
+
priority: number;
|
|
29
|
+
}>;
|
|
30
|
+
/** Maximum character length for substring lookups. Defaults to 20. */
|
|
31
|
+
maxLength?: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parses text into segments with dictionary lookups using a left-to-right
|
|
35
|
+
* sliding window (longest match) algorithm.
|
|
36
|
+
*/
|
|
37
|
+
declare class SentenceParser {
|
|
38
|
+
private _translator;
|
|
39
|
+
constructor(translator: Translator);
|
|
40
|
+
/**
|
|
41
|
+
* Parses the given text into lines of parsed segments.
|
|
42
|
+
* For each position, attempts to find the longest dictionary match by
|
|
43
|
+
* querying the translator with progressively shorter substrings.
|
|
44
|
+
* Generates furigana for Japanese text segments.
|
|
45
|
+
*/
|
|
46
|
+
parseText(text: string, language: string, options: SentenceParserOptions): Promise<ParsedLine[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Parses a single line of text into segments.
|
|
49
|
+
*/
|
|
50
|
+
private _parseLine;
|
|
51
|
+
/**
|
|
52
|
+
* Builds a FindTermDictionary map from the simplified input format.
|
|
53
|
+
*/
|
|
54
|
+
private _buildFindTermDictionaryMap;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a FindTermsOptions for simple lookup.
|
|
57
|
+
*/
|
|
58
|
+
private _createFindTermsOptions;
|
|
59
|
+
} //#endregion
|
|
60
|
+
//#region src/lookup/batch-processor.d.ts
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=sentence-parser.d.ts.map
|
|
63
|
+
interface BatchLookupConfig {
|
|
64
|
+
/** The language code for the lookup. Defaults to 'ja'. */
|
|
65
|
+
language?: string;
|
|
66
|
+
/** The enabled dictionary map for lookups. */
|
|
67
|
+
enabledDictionaryMap: Map<string, {
|
|
68
|
+
index: number;
|
|
69
|
+
priority: number;
|
|
70
|
+
}>;
|
|
71
|
+
/** Maximum number of concurrent lookups. Defaults to 5. */
|
|
72
|
+
concurrency?: number;
|
|
73
|
+
/** The find terms mode. Defaults to 'group'. */
|
|
74
|
+
mode?: FindTermsMode;
|
|
75
|
+
}
|
|
76
|
+
interface BatchResult {
|
|
77
|
+
/** The original input text. */
|
|
78
|
+
text: string;
|
|
79
|
+
/** The dictionary entries found for this text. */
|
|
80
|
+
entries: TermDictionaryEntry[];
|
|
81
|
+
/** The length of the original text that was matched. */
|
|
82
|
+
originalTextLength: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Processes multiple text lookups in batch with optional concurrency limiting.
|
|
86
|
+
* Shares the translator's tag cache across lookups for improved performance.
|
|
87
|
+
*/
|
|
88
|
+
declare class BatchProcessor {
|
|
89
|
+
private _translator;
|
|
90
|
+
constructor(translator: Translator);
|
|
91
|
+
/**
|
|
92
|
+
* Looks up multiple texts and returns a map of text to results.
|
|
93
|
+
* Texts are deduplicated before lookup. Concurrency is limited by the
|
|
94
|
+
* `concurrency` config option.
|
|
95
|
+
*/
|
|
96
|
+
batchLookup(texts: string[], config: BatchLookupConfig): Promise<Map<string, BatchResult>>;
|
|
97
|
+
/**
|
|
98
|
+
* Performs a single text lookup.
|
|
99
|
+
*/
|
|
100
|
+
private _lookupSingle;
|
|
101
|
+
/**
|
|
102
|
+
* Builds a FindTermDictionary map from the simplified input format.
|
|
103
|
+
*/
|
|
104
|
+
private _buildFindTermDictionaryMap;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/lookup/frequency-ranking.d.ts
|
|
109
|
+
//# sourceMappingURL=batch-processor.d.ts.map
|
|
110
|
+
interface FrequencyRanking {
|
|
111
|
+
/** Per-dictionary frequency data. */
|
|
112
|
+
frequencies: {
|
|
113
|
+
dictionary: string;
|
|
114
|
+
frequency: number;
|
|
115
|
+
displayValue: string | null;
|
|
116
|
+
}[];
|
|
117
|
+
/** The harmonic mean across all dictionaries with positive frequency. */
|
|
118
|
+
harmonicMean: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Queries term frequency metadata from the database and computes
|
|
122
|
+
* aggregate frequency rankings across multiple dictionaries.
|
|
123
|
+
*/
|
|
124
|
+
declare class FrequencyRanker {
|
|
125
|
+
private _db;
|
|
126
|
+
private _numberRegex;
|
|
127
|
+
constructor(db: DictionaryDB);
|
|
128
|
+
/**
|
|
129
|
+
* Gets the frequency ranking for a term across all dictionaries that
|
|
130
|
+
* have frequency metadata for it.
|
|
131
|
+
*
|
|
132
|
+
* @param term The term to look up.
|
|
133
|
+
* @param dictionaries The set of dictionary names to query.
|
|
134
|
+
* @param reading Optional reading to filter frequency data. If not provided,
|
|
135
|
+
* all frequency entries for the term are included.
|
|
136
|
+
* @returns A FrequencyRanking object with per-dictionary frequencies and a harmonic mean.
|
|
137
|
+
*/
|
|
138
|
+
getFrequencyRanking(term: string, dictionaries: string[], reading?: string): Promise<FrequencyRanking>;
|
|
139
|
+
/**
|
|
140
|
+
* Gets frequency rankings for multiple terms at once.
|
|
141
|
+
*/
|
|
142
|
+
getFrequencyRankingBulk(terms: string[], dictionaries: string[]): Promise<Map<string, FrequencyRanking>>;
|
|
143
|
+
/**
|
|
144
|
+
* Computes the harmonic mean of positive frequency values.
|
|
145
|
+
*/
|
|
146
|
+
private _computeHarmonicMean;
|
|
147
|
+
/**
|
|
148
|
+
* Extracts numeric frequency value and display string from generic frequency data.
|
|
149
|
+
*/
|
|
150
|
+
private _getFrequencyInfo;
|
|
151
|
+
/**
|
|
152
|
+
* Converts a string to a number by extracting the first numeric value.
|
|
153
|
+
*/
|
|
154
|
+
private _convertStringToNumber;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
//#endregion
|
|
158
|
+
//# sourceMappingURL=frequency-ranking.d.ts.map
|
|
159
|
+
|
|
160
|
+
export { BatchLookupConfig, BatchProcessor, BatchResult, FindTermsMode, FrequencyRanker, FrequencyRanking, ParsedLine, ParsedSegment, SentenceParser, SentenceParserOptions, Translator };
|
|
161
|
+
//# sourceMappingURL=lookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.d.ts","names":[],"sources":["../src/lookup/sentence-parser.ts","../src/lookup/batch-processor.ts","../src/lookup/frequency-ranking.ts"],"sourcesContent":null,"mappings":";;;;;;;UAuBiB,aAAA;;;;EAAA,OAAA,EAAA,MAAA;EAAa;EAAA,IAQjB,EAAA,MAAA;EAAmB;EAEH,OAAA,EAFhB,mBAEgB,EAAA;EAGZ;EAKA,QAAA,EARH,eAQwB,EAAA;;UALrB,UAAA;;YAEH;AAcd;AAA2B,UAXV,qBAAA,CAWU;EAAA;EAGW,oBAUuB,EAtBnC,GAsBmC,CAAA,MAAA,EAAA;IAAgC,KAAA,EAAA,MAAA;IAAR,QAAA,EAAA,MAAA;EAAO,CAAA,CAAA;;;;AC5C5F;;;;AAQwB,cDuBX,cAAA,CCvBW;EAGP,QAAA,WAAW;0BDuBA;;;;ACV5B;;;EAGsC,SASS,CAAA,IAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EDQc,qBCRd,CAAA,EDQsC,OCRtC,CDQ8C,UCR9C,EAAA,CAAA;EAAiB;;;EAAU,QAAA,UAAA;;;;ECpCzD,QAAA,2BAAgB;;;;;AAWjC,CAAA;;;;UDXiB,iBAAA;;;;wBAIS;IDFT,KAAA,EAAA,MAAa;IAAA,QAAA,EAAA,MAAA;EAAA,CAAA,CAAA;EAQE;EAEH,WAAA,CAAA,EAAA,MAAA;EAGZ;EAKA,IAAA,CAAA,ECZN,aDYM;;UCTA,WAAA;;;EDoBJ;EAAc,OAAA,EChBd,mBDgBc,EAAA;EAAA;EAGW,kBAUuB,EAAA,MAAA;;;AAA+B;;;cCpB/E,cAAA;EAxBI,QAAA,WAAA;EAAiB,WAAA,CAAA,UAAA,EA2BN,UA3BM;EAAA;;AAQV;AAGxB;;uCAyB+C,oBAAoB,QAAQ,YAAY;;;AAZvF;EAA2B,QAAA,aAAA;EAAA;;;EAYuE,QAAvB,2BAAA;;;;;AAAD;UCpCzD,gBAAA;;;;;;EFEA,CAAA,EAAA;EAAa;EAAA,YAQjB,EAAA,MAAA;;AAEgB;AAG7B;AAKA;;cETa,eAAA;;;EFoBA,WAAA,CAAA,EAAA,EEhBO,YFgBO;EAAA;;;;;AAaiE;;;;AC5C5F;EAAkC,mBAAA,CAAA,IAAA,EAAA,MAAA,EAAA,YAAA,EAAA,MAAA,EAAA,EAAA,OAAA,CAAA,EAAA,MAAA,CAAA,EC8BqD,OD9BrD,CC8B6D,gBD9B7D,CAAA;EAAA;;AAQV;EAGP,uBAAW,CAAA,KAIf,EAAA,MAAA,EAAA,EAAA,YAAmB,EAAA,MAAA,EAAA,CAAA,ECkE4C,ODlE5C,CCkEoD,GDlEpD,CAAA,MAAA,ECkEgE,gBDlEhE,CAAA,CAAA;;;;;EASnB;;;EAGyB,QASS,iBAAA;EAAiB;;;EAAU,QAAA,sBAAA"}
|
package/dist/lookup.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./log-hgSll-dS.js";
|
|
2
|
+
import "./cjk-util-DubXBGDG.js";
|
|
3
|
+
import "./multi-language-transformer-AlxOM6b3.js";
|
|
4
|
+
import { Translator } from "./translator-CWgG5drA.js";
|
|
5
|
+
import "./furigana-B3-0y231.js";
|
|
6
|
+
import { SentenceParser } from "./sentence-parser-BPAJNzqW.js";
|
|
7
|
+
import { BatchProcessor } from "./batch-processor-BR-gB3H3.js";
|
|
8
|
+
import { FrequencyRanker } from "./frequency-ranking-DEJMTMdg.js";
|
|
9
|
+
|
|
10
|
+
export { BatchProcessor, FrequencyRanker, SentenceParser, Translator };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//#region src/import/media-loader.ts
|
|
4
|
+
var NoOpMediaLoader = class {
|
|
5
|
+
async getImageDetails(content, _mediaType) {
|
|
6
|
+
return {
|
|
7
|
+
content,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
Object.defineProperty(exports, 'NoOpMediaLoader', {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return NoOpMediaLoader;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=media-loader-Ce9cuANS.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-loader-Ce9cuANS.cjs","names":["content: ArrayBuffer","_mediaType: string"],"sources":["../src/import/media-loader.ts"],"sourcesContent":["export interface MediaLoader {\n getImageDetails(\n content: ArrayBuffer,\n mediaType: string,\n ): Promise<{\n content: ArrayBuffer;\n width: number;\n height: number;\n }>;\n}\n\nexport class NoOpMediaLoader implements MediaLoader {\n async getImageDetails(\n content: ArrayBuffer,\n _mediaType: string,\n ): Promise<{\n content: ArrayBuffer;\n width: number;\n height: number;\n }> {\n return { content, width: 0, height: 0 };\n }\n}\n"],"mappings":";;;AAWA,IAAa,kBAAb,MAAoD;CAChD,MAAM,gBACFA,SACAC,YAKD;AACC,SAAO;GAAE;GAAS,OAAO;GAAG,QAAQ;EAAG;CAC1C;AACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/import/media-loader.ts
|
|
2
|
+
var NoOpMediaLoader = class {
|
|
3
|
+
async getImageDetails(content, _mediaType) {
|
|
4
|
+
return {
|
|
5
|
+
content,
|
|
6
|
+
width: 0,
|
|
7
|
+
height: 0
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { NoOpMediaLoader };
|
|
14
|
+
//# sourceMappingURL=media-loader-qRti-Q6h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-loader-qRti-Q6h.js","names":["content: ArrayBuffer","_mediaType: string"],"sources":["../src/import/media-loader.ts"],"sourcesContent":["export interface MediaLoader {\n getImageDetails(\n content: ArrayBuffer,\n mediaType: string,\n ): Promise<{\n content: ArrayBuffer;\n width: number;\n height: number;\n }>;\n}\n\nexport class NoOpMediaLoader implements MediaLoader {\n async getImageDetails(\n content: ArrayBuffer,\n _mediaType: string,\n ): Promise<{\n content: ArrayBuffer;\n width: number;\n height: number;\n }> {\n return { content, width: 0, height: 0 };\n }\n}\n"],"mappings":";AAWA,IAAa,kBAAb,MAAoD;CAChD,MAAM,gBACFA,SACAC,YAKD;AACC,SAAO;GAAE;GAAS,OAAO;GAAG,QAAQ;EAAG;CAC1C;AACJ"}
|