garu-ko 0.2.0 → 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 +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +11 -0
- package/package.json +1 -1
- package/pkg/garu_wasm.js +2 -0
- package/pkg/garu_wasm_bg.wasm +0 -0
- package/pkg/package.json +1 -1
- package/pkg/snippets/garu-core-ea50edba4dc5fdae/inline0.js +1 -0
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
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 = {
|
|
@@ -142,6 +143,7 @@ function __wbg_get_imports() {
|
|
|
142
143
|
return {
|
|
143
144
|
__proto__: null,
|
|
144
145
|
"./garu_wasm_bg.js": import0,
|
|
146
|
+
"./snippets/garu-core-ea50edba4dc5fdae/inline0.js": import1,
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
149
|
|
package/pkg/garu_wasm_bg.wasm
CHANGED
|
Binary file
|
package/pkg/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function performance_now() { return performance.now(); }
|