garu-ko 0.2.1 → 0.2.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 CHANGED
@@ -85,7 +85,7 @@ interface Token {
85
85
  }
86
86
  ```
87
87
 
88
- Set `options.topN > 1` to get N-best results as an array.
88
+ Set `options.topN > 1` to get N-best results as an array. Note: topN > 1 is not yet fully supported and may return fewer results.
89
89
 
90
90
  ### `garu.nouns(text): string[]`
91
91
 
package/dist/index.d.ts CHANGED
@@ -41,6 +41,8 @@ export declare class Garu {
41
41
  *
42
42
  * When `options.topN` is greater than 1, returns an array of N-best results.
43
43
  * Otherwise returns a single AnalyzeResult.
44
+ *
45
+ * Note: topN > 1 is not yet fully supported and may return fewer results.
44
46
  */
45
47
  analyze(text: string, options?: AnalyzeOptions): AnalyzeResult | AnalyzeResult[];
46
48
  /**
package/dist/index.js CHANGED
@@ -71,8 +71,13 @@ export class Garu {
71
71
  *
72
72
  * When `options.topN` is greater than 1, returns an array of N-best results.
73
73
  * Otherwise returns a single AnalyzeResult.
74
+ *
75
+ * Note: topN > 1 is not yet fully supported and may return fewer results.
74
76
  */
75
77
  analyze(text, options) {
78
+ if (!this._loaded) {
79
+ throw new Error('Garu instance has been destroyed');
80
+ }
76
81
  const topN = options?.topN ?? 1;
77
82
  if (topN > 1) {
78
83
  if (text === '') {
@@ -89,6 +94,9 @@ export class Garu {
89
94
  * Quick tokenisation — returns an array of surface-form strings.
90
95
  */
91
96
  tokenize(text) {
97
+ if (!this._loaded) {
98
+ throw new Error('Garu instance has been destroyed');
99
+ }
92
100
  if (text === '') {
93
101
  return [];
94
102
  }
@@ -98,6 +106,9 @@ export class Garu {
98
106
  * Extract nouns (NNG, NNP) from text.
99
107
  */
100
108
  nouns(text) {
109
+ if (!this._loaded) {
110
+ throw new Error('Garu instance has been destroyed');
111
+ }
101
112
  if (text === '') {
102
113
  return [];
103
114
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "garu-ko",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Ultra-lightweight Korean morphological analyzer for the web (1.7MB model, WASM 93KB, F1 95.3%)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/pkg/garu_wasm.js CHANGED
@@ -82,6 +82,7 @@ export class GaruWasm {
82
82
  }
83
83
  }
84
84
  if (Symbol.dispose) GaruWasm.prototype[Symbol.dispose] = GaruWasm.prototype.free;
85
+ import * as import1 from "./snippets/garu-core-ea50edba4dc5fdae/inline0.js"
85
86
 
86
87
  function __wbg_get_imports() {
87
88
  const import0 = {
@@ -108,10 +109,6 @@ function __wbg_get_imports() {
108
109
  const ret = new Object();
109
110
  return ret;
110
111
  },
111
- __wbg_now_16f0c993d5dd6c27: function() {
112
- const ret = Date.now();
113
- return ret;
114
- },
115
112
  __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
116
113
  arg0[arg1 >>> 0] = arg2;
117
114
  },
@@ -146,6 +143,7 @@ function __wbg_get_imports() {
146
143
  return {
147
144
  __proto__: null,
148
145
  "./garu_wasm_bg.js": import0,
146
+ "./snippets/garu-core-ea50edba4dc5fdae/inline0.js": import1,
149
147
  };
150
148
  }
151
149
 
Binary file
package/pkg/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "garu-wasm",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.1",
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(); }