garu-ko 0.7.3 → 0.8.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/dist/browser.js CHANGED
@@ -30,13 +30,7 @@ export class Garu extends GaruBase {
30
30
  }
31
31
  modelBytes = new Uint8Array(await response.arrayBuffer());
32
32
  }
33
- const cnnUrl = new URL('../models/cnn2.bin', import.meta.url).href;
34
- const cnnResp = await fetch(cnnUrl);
35
- if (!cnnResp.ok) {
36
- throw new Error(`Failed to fetch CNN model from ${cnnUrl}: ${cnnResp.status}`);
37
- }
38
- const cnnBytes = new Uint8Array(await cnnResp.arrayBuffer());
39
- const wasmInstance = new wasmModule.GaruWasm(modelBytes, cnnBytes);
40
- return new Garu(wasmInstance, modelBytes.byteLength + cnnBytes.byteLength);
33
+ const wasmInstance = new wasmModule.GaruWasm(modelBytes);
34
+ return new Garu(wasmInstance, modelBytes.byteLength);
41
35
  }
42
36
  }
package/dist/node.js CHANGED
@@ -31,9 +31,7 @@ export class Garu extends GaruBase {
31
31
  const buf = await readFile(join(dir, '..', 'models', 'base.gmdl'));
32
32
  modelBytes = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
33
33
  }
34
- const cnnBuf = await readFile(join(dir, '..', 'models', 'cnn2.bin'));
35
- const cnnBytes = new Uint8Array(cnnBuf.buffer, cnnBuf.byteOffset, cnnBuf.byteLength);
36
- const wasmInstance = new wasmModule.GaruWasm(modelBytes, cnnBytes);
37
- return new Garu(wasmInstance, modelBytes.byteLength + cnnBytes.byteLength);
34
+ const wasmInstance = new wasmModule.GaruWasm(modelBytes);
35
+ return new Garu(wasmInstance, modelBytes.byteLength);
38
36
  }
39
37
  }
package/models/base.gmdl CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "garu-ko",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "description": "Ultra-lightweight Korean morphological analyzer for the web (1.9MB model, WASM, F1 93.9%)",
5
5
  "type": "module",
6
6
  "main": "dist/node.js",
@@ -6,7 +6,7 @@ export class GaruWasm {
6
6
  [Symbol.dispose](): void;
7
7
  analyze(text: string): any;
8
8
  analyze_topn(text: string, n: number): any;
9
- constructor(model_data: Uint8Array, cnn_data: Uint8Array);
9
+ constructor(model_data: Uint8Array);
10
10
  tokenize(text: string): any;
11
11
  static version(): string;
12
12
  }
@@ -18,7 +18,7 @@ export interface InitOutput {
18
18
  readonly __wbg_garuwasm_free: (a: number, b: number) => void;
19
19
  readonly garuwasm_analyze: (a: number, b: number, c: number, d: number) => void;
20
20
  readonly garuwasm_analyze_topn: (a: number, b: number, c: number, d: number, e: number) => void;
21
- readonly garuwasm_new: (a: number, b: number, c: number, d: number, e: number) => void;
21
+ readonly garuwasm_new: (a: number, b: number, c: number) => void;
22
22
  readonly garuwasm_tokenize: (a: number, b: number, c: number, d: number) => void;
23
23
  readonly garuwasm_version: (a: number) => void;
24
24
  readonly __wbindgen_export: (a: number, b: number) => number;
package/pkg/garu_wasm.js CHANGED
@@ -56,16 +56,13 @@ export class GaruWasm {
56
56
  }
57
57
  /**
58
58
  * @param {Uint8Array} model_data
59
- * @param {Uint8Array} cnn_data
60
59
  */
61
- constructor(model_data, cnn_data) {
60
+ constructor(model_data) {
62
61
  try {
63
62
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
64
63
  const ptr0 = passArray8ToWasm0(model_data, wasm.__wbindgen_export);
65
64
  const len0 = WASM_VECTOR_LEN;
66
- const ptr1 = passArray8ToWasm0(cnn_data, wasm.__wbindgen_export);
67
- const len1 = WASM_VECTOR_LEN;
68
- wasm.garuwasm_new(retptr, ptr0, len0, ptr1, len1);
65
+ wasm.garuwasm_new(retptr, ptr0, len0);
69
66
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
70
67
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
71
68
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -121,7 +118,7 @@ export class GaruWasm {
121
118
  }
122
119
  }
123
120
  if (Symbol.dispose) GaruWasm.prototype[Symbol.dispose] = GaruWasm.prototype.free;
124
- import * as import1 from "./snippets/garu-core-996c7dd407e72272/inline0.js"
121
+ import * as import1 from "./snippets/garu-core-3f8b0a7607e8c8ca/inline0.js"
125
122
 
126
123
  function __wbg_get_imports() {
127
124
  const import0 = {
@@ -180,7 +177,7 @@ function __wbg_get_imports() {
180
177
  return {
181
178
  __proto__: null,
182
179
  "./garu_wasm_bg.js": import0,
183
- "./snippets/garu-core-996c7dd407e72272/inline0.js": import1,
180
+ "./snippets/garu-core-3f8b0a7607e8c8ca/inline0.js": import1,
184
181
  };
185
182
  }
186
183
 
Binary file
@@ -4,7 +4,7 @@ export const memory: WebAssembly.Memory;
4
4
  export const __wbg_garuwasm_free: (a: number, b: number) => void;
5
5
  export const garuwasm_analyze: (a: number, b: number, c: number, d: number) => void;
6
6
  export const garuwasm_analyze_topn: (a: number, b: number, c: number, d: number, e: number) => void;
7
- export const garuwasm_new: (a: number, b: number, c: number, d: number, e: number) => void;
7
+ export const garuwasm_new: (a: number, b: number, c: number) => void;
8
8
  export const garuwasm_tokenize: (a: number, b: number, c: number, d: number) => void;
9
9
  export const garuwasm_version: (a: number) => void;
10
10
  export const __wbindgen_export: (a: number, b: number) => number;
package/pkg/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "garu-wasm",
3
3
  "type": "module",
4
- "version": "0.7.3",
4
+ "version": "0.8.0",
5
5
  "files": [
6
6
  "garu_wasm_bg.wasm",
7
7
  "garu_wasm.js",
@@ -0,0 +1 @@
1
+ export function performance_now() { return performance.now(); }
package/models/cnn2.bin DELETED
Binary file