@frontierrnd/translation-consistency 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/README.md +96 -2
- package/dist/index.d.ts +183 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +211 -0
- package/dist/index.js.map +1 -0
- package/dist/wasm/fast_iso_wasm.d.ts +78 -0
- package/dist/wasm/fast_iso_wasm.js +771 -0
- package/dist/wasm/fast_iso_wasm_bg.wasm +0 -0
- package/dist/wasm/fast_iso_wasm_bg.wasm.d.ts +27 -0
- package/dist/wasm-loader.d.ts +12 -0
- package/dist/wasm-loader.d.ts.map +1 -0
- package/dist/wasm-loader.js +38 -0
- package/dist/wasm-loader.js.map +1 -0
- package/package.json +48 -4
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_wasmfastiso_free: (a: number, b: number) => void;
|
|
5
|
+
export const chrfPP: (a: number, b: number, c: number, d: number) => number;
|
|
6
|
+
export const latestVersion: () => [number, number];
|
|
7
|
+
export const peekSerializedVersion: (a: number, b: number) => [number, number, number, number];
|
|
8
|
+
export const supportedVersions: () => any;
|
|
9
|
+
export const wasmfastiso_corpusSize: (a: number) => number;
|
|
10
|
+
export const wasmfastiso_deserialize: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
11
|
+
export const wasmfastiso_engineVersion: (a: number) => [number, number];
|
|
12
|
+
export const wasmfastiso_extractGlossary: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
13
|
+
export const wasmfastiso_fit: (a: any, b: any) => [number, number, number];
|
|
14
|
+
export const wasmfastiso_lexicalSize: (a: number) => number;
|
|
15
|
+
export const wasmfastiso_localizeSpans: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
16
|
+
export const wasmfastiso_pickBest: (a: number, b: number, c: number, d: any, e: any) => [number, number, number];
|
|
17
|
+
export const wasmfastiso_scanPassageDrift: (a: number, b: any, c: any) => [number, number, number];
|
|
18
|
+
export const wasmfastiso_scoreBatch: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
19
|
+
export const wasmfastiso_serialize: (a: number) => [number, number, number, number];
|
|
20
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
21
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
22
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
23
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
24
|
+
export const __externref_table_alloc: () => number;
|
|
25
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
26
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
27
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as wasmModule from "./wasm/fast_iso_wasm.js";
|
|
2
|
+
export type WasmInitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
3
|
+
/**
|
|
4
|
+
* Initialize the FastIso WebAssembly module.
|
|
5
|
+
*
|
|
6
|
+
* - In **Browser / Web Workers / Vite / Webpack**: automatically loads the bundled `.wasm` asset.
|
|
7
|
+
* - In **Node.js**: automatically reads the bundled `.wasm` file from disk.
|
|
8
|
+
* - In **Cloudflare Workers / custom runtimes**: pass the imported `WebAssembly.Module` or bytes directly:
|
|
9
|
+
* `import wasm from "@frontierrnd/translation-consistency/wasm"; await initWasm(wasm);`
|
|
10
|
+
*/
|
|
11
|
+
export declare function initWasm(input?: WasmInitInput): Promise<typeof wasmModule>;
|
|
12
|
+
//# sourceMappingURL=wasm-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-loader.d.ts","sourceRoot":"","sources":["../js/src/wasm-loader.ts"],"names":[],"mappings":"AAAA,OAAiB,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAEhE,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,GAAG,GACH,QAAQ,GACR,YAAY,GACZ,WAAW,CAAC,MAAM,CAAC;AAIvB;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,UAAU,CAAC,CA6B1E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import wasmInit, * as wasmModule from "./wasm/fast_iso_wasm.js";
|
|
2
|
+
let initPromise = null;
|
|
3
|
+
/**
|
|
4
|
+
* Initialize the FastIso WebAssembly module.
|
|
5
|
+
*
|
|
6
|
+
* - In **Browser / Web Workers / Vite / Webpack**: automatically loads the bundled `.wasm` asset.
|
|
7
|
+
* - In **Node.js**: automatically reads the bundled `.wasm` file from disk.
|
|
8
|
+
* - In **Cloudflare Workers / custom runtimes**: pass the imported `WebAssembly.Module` or bytes directly:
|
|
9
|
+
* `import wasm from "@frontierrnd/translation-consistency/wasm"; await initWasm(wasm);`
|
|
10
|
+
*/
|
|
11
|
+
export function initWasm(input) {
|
|
12
|
+
if (initPromise)
|
|
13
|
+
return initPromise;
|
|
14
|
+
initPromise = (async () => {
|
|
15
|
+
if (input !== undefined) {
|
|
16
|
+
await wasmInit({ module_or_path: input });
|
|
17
|
+
return wasmModule;
|
|
18
|
+
}
|
|
19
|
+
const proc = globalThis.process;
|
|
20
|
+
const isNode = typeof proc?.versions?.node === "string";
|
|
21
|
+
if (isNode) {
|
|
22
|
+
// Dynamic specifier prevents browser/edge bundlers (Vite/esbuild) from trying to resolve node:fs.
|
|
23
|
+
const fsMod = "node:fs/promises";
|
|
24
|
+
const fs = (await import(/* @vite-ignore */ fsMod));
|
|
25
|
+
const wasmUrl = new URL("./wasm/fast_iso_wasm_bg.wasm", import.meta.url);
|
|
26
|
+
const bytes = await fs.readFile(wasmUrl);
|
|
27
|
+
await wasmInit({ module_or_path: bytes });
|
|
28
|
+
return wasmModule;
|
|
29
|
+
}
|
|
30
|
+
await wasmInit();
|
|
31
|
+
return wasmModule;
|
|
32
|
+
})().catch((err) => {
|
|
33
|
+
initPromise = null;
|
|
34
|
+
throw err;
|
|
35
|
+
});
|
|
36
|
+
return initPromise;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=wasm-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-loader.js","sourceRoot":"","sources":["../js/src/wasm-loader.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAShE,IAAI,WAAW,GAAsC,IAAI,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAqB;IAC5C,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IACpC,WAAW,GAAG,CAAC,KAAK,IAAI,EAAE;QACxB,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,QAAQ,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1C,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,MAAM,IAAI,GAAI,UAA6D,CAAC,OAAO,CAAC;QACpF,MAAM,MAAM,GAAG,OAAO,IAAI,EAAE,QAAQ,EAAE,IAAI,KAAK,QAAQ,CAAC;QAExD,IAAI,MAAM,EAAE,CAAC;YACX,kGAAkG;YAClG,MAAM,KAAK,GAAG,kBAAkB,CAAC;YACjC,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAEjD,CAAC;YACF,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,8BAA8B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzE,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACzC,MAAM,QAAQ,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1C,OAAO,UAAU,CAAC;QACpB,CAAC;QAED,MAAM,QAAQ,EAAE,CAAC;QACjB,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACjB,WAAW,GAAG,IAAI,CAAC;QACnB,MAAM,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontierrnd/translation-consistency",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Sub-millisecond, zero-pretraining, script-blind relational-geometry translation consistency scorer and anomaly detector (FastIso v1.2) compiled to WebAssembly.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/frontierrnd/translation-consistency.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/frontierrnd/translation-consistency#readme",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./wasm": "./dist/wasm/fast_iso_wasm_bg.wasm"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build:wasm": "wasm-pack build crates/fast-iso-wasm --target web --release --out-dir ../../dist/wasm --out-name fast_iso_wasm && rm -f dist/wasm/.gitignore dist/wasm/package.json",
|
|
26
|
+
"build:ts": "tsc -p tsconfig.json",
|
|
27
|
+
"build": "npm run build:wasm && npm run build:ts",
|
|
28
|
+
"test:rust": "cargo test --workspace",
|
|
29
|
+
"test:js": "node --test js/test/fast-iso.test.mjs",
|
|
30
|
+
"test": "npm run test:rust && npm run build && npm run test:js"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"translation",
|
|
34
|
+
"quality-estimation",
|
|
35
|
+
"anomaly-detection",
|
|
36
|
+
"relational-geometry",
|
|
37
|
+
"low-resource",
|
|
38
|
+
"chrf",
|
|
39
|
+
"mbr",
|
|
40
|
+
"wasm",
|
|
41
|
+
"nlp"
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"typescript": "^5.8.0"
|
|
49
|
+
}
|
|
50
|
+
}
|