lindera-wasm-web-ipadic 1.2.1 → 1.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/lindera_wasm.js CHANGED
@@ -1,122 +1,11 @@
1
1
  let wasm;
2
2
 
3
- let cachedUint8ArrayMemory0 = null;
4
-
5
- function getUint8ArrayMemory0() {
6
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
7
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
8
- }
9
- return cachedUint8ArrayMemory0;
10
- }
11
-
12
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
13
-
14
- cachedTextDecoder.decode();
15
-
16
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
17
- let numBytesDecoded = 0;
18
- function decodeText(ptr, len) {
19
- numBytesDecoded += len;
20
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
21
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
22
- cachedTextDecoder.decode();
23
- numBytesDecoded = len;
24
- }
25
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
26
- }
27
-
28
- function getStringFromWasm0(ptr, len) {
29
- ptr = ptr >>> 0;
30
- return decodeText(ptr, len);
31
- }
32
-
33
- let WASM_VECTOR_LEN = 0;
34
-
35
- const cachedTextEncoder = new TextEncoder();
36
-
37
- if (!('encodeInto' in cachedTextEncoder)) {
38
- cachedTextEncoder.encodeInto = function (arg, view) {
39
- const buf = cachedTextEncoder.encode(arg);
40
- view.set(buf);
41
- return {
42
- read: arg.length,
43
- written: buf.length
44
- };
45
- }
46
- }
47
-
48
- function passStringToWasm0(arg, malloc, realloc) {
49
-
50
- if (realloc === undefined) {
51
- const buf = cachedTextEncoder.encode(arg);
52
- const ptr = malloc(buf.length, 1) >>> 0;
53
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
54
- WASM_VECTOR_LEN = buf.length;
55
- return ptr;
56
- }
57
-
58
- let len = arg.length;
59
- let ptr = malloc(len, 1) >>> 0;
60
-
61
- const mem = getUint8ArrayMemory0();
62
-
63
- let offset = 0;
64
-
65
- for (; offset < len; offset++) {
66
- const code = arg.charCodeAt(offset);
67
- if (code > 0x7F) break;
68
- mem[ptr + offset] = code;
69
- }
70
-
71
- if (offset !== len) {
72
- if (offset !== 0) {
73
- arg = arg.slice(offset);
74
- }
75
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
- const ret = cachedTextEncoder.encodeInto(arg, view);
78
-
79
- offset += ret.written;
80
- ptr = realloc(ptr, len, offset, 1) >>> 0;
81
- }
82
-
83
- WASM_VECTOR_LEN = offset;
84
- return ptr;
85
- }
86
-
87
- let cachedDataViewMemory0 = null;
88
-
89
- function getDataViewMemory0() {
90
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
91
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
92
- }
93
- return cachedDataViewMemory0;
94
- }
95
-
96
3
  function addToExternrefTable0(obj) {
97
4
  const idx = wasm.__externref_table_alloc();
98
- wasm.__wbindgen_export_4.set(idx, obj);
5
+ wasm.__wbindgen_externrefs.set(idx, obj);
99
6
  return idx;
100
7
  }
101
8
 
102
- function handleError(f, args) {
103
- try {
104
- return f.apply(this, args);
105
- } catch (e) {
106
- const idx = addToExternrefTable0(e);
107
- wasm.__wbindgen_exn_store(idx);
108
- }
109
- }
110
-
111
- function getArrayU8FromWasm0(ptr, len) {
112
- ptr = ptr >>> 0;
113
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
114
- }
115
-
116
- function isLikeNone(x) {
117
- return x === undefined || x === null;
118
- }
119
-
120
9
  function debugString(val) {
121
10
  // primitive types
122
11
  const type = typeof val;
@@ -181,43 +70,126 @@ function debugString(val) {
181
70
  // TODO we could test for more things here, like `Set`s and `Map`s.
182
71
  return className;
183
72
  }
184
- /**
185
- * Gets the version of the lindera-wasm library.
186
- *
187
- * # Returns
188
- *
189
- * The version string of the library (e.g., "1.0.0").
190
- *
191
- * # Examples
192
- *
193
- * ```javascript
194
- * import { getVersion } from 'lindera-wasm';
195
- * console.log(getVersion()); // "1.0.0"
196
- * ```
197
- * @returns {string}
198
- */
199
- export function getVersion() {
200
- let deferred1_0;
201
- let deferred1_1;
73
+
74
+ function getArrayU8FromWasm0(ptr, len) {
75
+ ptr = ptr >>> 0;
76
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
77
+ }
78
+
79
+ let cachedDataViewMemory0 = null;
80
+ function getDataViewMemory0() {
81
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
82
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
83
+ }
84
+ return cachedDataViewMemory0;
85
+ }
86
+
87
+ function getStringFromWasm0(ptr, len) {
88
+ ptr = ptr >>> 0;
89
+ return decodeText(ptr, len);
90
+ }
91
+
92
+ let cachedUint8ArrayMemory0 = null;
93
+ function getUint8ArrayMemory0() {
94
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
95
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
96
+ }
97
+ return cachedUint8ArrayMemory0;
98
+ }
99
+
100
+ function handleError(f, args) {
202
101
  try {
203
- const ret = wasm.getVersion();
204
- deferred1_0 = ret[0];
205
- deferred1_1 = ret[1];
206
- return getStringFromWasm0(ret[0], ret[1]);
207
- } finally {
208
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
102
+ return f.apply(this, args);
103
+ } catch (e) {
104
+ const idx = addToExternrefTable0(e);
105
+ wasm.__wbindgen_exn_store(idx);
209
106
  }
210
107
  }
211
108
 
109
+ function isLikeNone(x) {
110
+ return x === undefined || x === null;
111
+ }
112
+
113
+ function passStringToWasm0(arg, malloc, realloc) {
114
+ if (realloc === undefined) {
115
+ const buf = cachedTextEncoder.encode(arg);
116
+ const ptr = malloc(buf.length, 1) >>> 0;
117
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
118
+ WASM_VECTOR_LEN = buf.length;
119
+ return ptr;
120
+ }
121
+
122
+ let len = arg.length;
123
+ let ptr = malloc(len, 1) >>> 0;
124
+
125
+ const mem = getUint8ArrayMemory0();
126
+
127
+ let offset = 0;
128
+
129
+ for (; offset < len; offset++) {
130
+ const code = arg.charCodeAt(offset);
131
+ if (code > 0x7F) break;
132
+ mem[ptr + offset] = code;
133
+ }
134
+ if (offset !== len) {
135
+ if (offset !== 0) {
136
+ arg = arg.slice(offset);
137
+ }
138
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
139
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
140
+ const ret = cachedTextEncoder.encodeInto(arg, view);
141
+
142
+ offset += ret.written;
143
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
144
+ }
145
+
146
+ WASM_VECTOR_LEN = offset;
147
+ return ptr;
148
+ }
149
+
212
150
  function takeFromExternrefTable0(idx) {
213
- const value = wasm.__wbindgen_export_4.get(idx);
151
+ const value = wasm.__wbindgen_externrefs.get(idx);
214
152
  wasm.__externref_table_dealloc(idx);
215
153
  return value;
216
154
  }
217
155
 
156
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
157
+ cachedTextDecoder.decode();
158
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
159
+ let numBytesDecoded = 0;
160
+ function decodeText(ptr, len) {
161
+ numBytesDecoded += len;
162
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
163
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
164
+ cachedTextDecoder.decode();
165
+ numBytesDecoded = len;
166
+ }
167
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
168
+ }
169
+
170
+ const cachedTextEncoder = new TextEncoder();
171
+
172
+ if (!('encodeInto' in cachedTextEncoder)) {
173
+ cachedTextEncoder.encodeInto = function (arg, view) {
174
+ const buf = cachedTextEncoder.encode(arg);
175
+ view.set(buf);
176
+ return {
177
+ read: arg.length,
178
+ written: buf.length
179
+ };
180
+ }
181
+ }
182
+
183
+ let WASM_VECTOR_LEN = 0;
184
+
218
185
  const TokenizerFinalization = (typeof FinalizationRegistry === 'undefined')
219
186
  ? { register: () => {}, unregister: () => {} }
220
187
  : new FinalizationRegistry(ptr => wasm.__wbg_tokenizer_free(ptr >>> 0, 1));
188
+
189
+ const TokenizerBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
190
+ ? { register: () => {}, unregister: () => {} }
191
+ : new FinalizationRegistry(ptr => wasm.__wbg_tokenizerbuilder_free(ptr >>> 0, 1));
192
+
221
193
  /**
222
194
  * A tokenizer for morphological analysis.
223
195
  *
@@ -241,7 +213,6 @@ const TokenizerFinalization = (typeof FinalizationRegistry === 'undefined')
241
213
  * ```
242
214
  */
243
215
  export class Tokenizer {
244
-
245
216
  static __wrap(ptr) {
246
217
  ptr = ptr >>> 0;
247
218
  const obj = Object.create(Tokenizer.prototype);
@@ -249,14 +220,12 @@ export class Tokenizer {
249
220
  TokenizerFinalization.register(obj, obj.__wbg_ptr, obj);
250
221
  return obj;
251
222
  }
252
-
253
223
  __destroy_into_raw() {
254
224
  const ptr = this.__wbg_ptr;
255
225
  this.__wbg_ptr = 0;
256
226
  TokenizerFinalization.unregister(this);
257
227
  return ptr;
258
228
  }
259
-
260
229
  free() {
261
230
  const ptr = this.__destroy_into_raw();
262
231
  wasm.__wbg_tokenizer_free(ptr, 0);
@@ -306,9 +275,6 @@ export class Tokenizer {
306
275
  }
307
276
  if (Symbol.dispose) Tokenizer.prototype[Symbol.dispose] = Tokenizer.prototype.free;
308
277
 
309
- const TokenizerBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
310
- ? { register: () => {}, unregister: () => {} }
311
- : new FinalizationRegistry(ptr => wasm.__wbg_tokenizerbuilder_free(ptr >>> 0, 1));
312
278
  /**
313
279
  * Builder for creating a [`Tokenizer`] instance.
314
280
  *
@@ -330,127 +296,91 @@ const TokenizerBuilderFinalization = (typeof FinalizationRegistry === 'undefined
330
296
  * ```
331
297
  */
332
298
  export class TokenizerBuilder {
333
-
334
299
  __destroy_into_raw() {
335
300
  const ptr = this.__wbg_ptr;
336
301
  this.__wbg_ptr = 0;
337
302
  TokenizerBuilderFinalization.unregister(this);
338
303
  return ptr;
339
304
  }
340
-
341
305
  free() {
342
306
  const ptr = this.__destroy_into_raw();
343
307
  wasm.__wbg_tokenizerbuilder_free(ptr, 0);
344
308
  }
345
309
  /**
346
- * Creates a new `TokenizerBuilder` instance.
347
- *
348
- * # Returns
349
- *
350
- * A new `TokenizerBuilder` instance.
351
- *
352
- * # Errors
353
- *
354
- * Returns an error if the builder cannot be initialized.
355
- *
356
- * # Examples
357
- *
358
- * ```javascript
359
- * const builder = new TokenizerBuilder();
360
- * ```
361
- */
362
- constructor() {
363
- const ret = wasm.tokenizerbuilder_new();
364
- if (ret[2]) {
365
- throw takeFromExternrefTable0(ret[1]);
366
- }
367
- this.__wbg_ptr = ret[0] >>> 0;
368
- TokenizerBuilderFinalization.register(this, this.__wbg_ptr, this);
369
- return this;
370
- }
371
- /**
372
- * Builds and returns a configured [`Tokenizer`] instance.
373
- *
374
- * This method consumes the builder and creates the final tokenizer with all
375
- * configured settings.
376
- *
377
- * # Returns
378
- *
379
- * A configured `Tokenizer` instance.
310
+ * Sets the dictionary to use for tokenization.
380
311
  *
381
- * # Errors
312
+ * # Parameters
382
313
  *
383
- * Returns an error if the tokenizer cannot be built with the current configuration.
314
+ * - `uri`: The dictionary URI. Valid embedded dictionaries are:
315
+ * - `"embedded://ipadic"`: Japanese IPADIC dictionary
316
+ * - `"embedded://unidic"`: Japanese UniDic dictionary
317
+ * - `"embedded://ko-dic"`: Korean ko-dic dictionary
318
+ * - `"embedded://cc-cedict"`: Chinese CC-CEDICT dictionary
384
319
  *
385
320
  * # Examples
386
321
  *
387
322
  * ```javascript
388
- * const builder = new TokenizerBuilder();
389
323
  * builder.setDictionary("embedded://ipadic");
390
- * const tokenizer = builder.build();
391
324
  * ```
392
- * @returns {Tokenizer}
325
+ * @param {string} uri
393
326
  */
394
- build() {
395
- const ptr = this.__destroy_into_raw();
396
- const ret = wasm.tokenizerbuilder_build(ptr);
397
- if (ret[2]) {
398
- throw takeFromExternrefTable0(ret[1]);
327
+ setDictionary(uri) {
328
+ const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
329
+ const len0 = WASM_VECTOR_LEN;
330
+ const ret = wasm.tokenizerbuilder_setDictionary(this.__wbg_ptr, ptr0, len0);
331
+ if (ret[1]) {
332
+ throw takeFromExternrefTable0(ret[0]);
399
333
  }
400
- return Tokenizer.__wrap(ret[0]);
401
334
  }
402
335
  /**
403
- * Sets the tokenization mode.
336
+ * Appends a token filter to the tokenization pipeline.
337
+ *
338
+ * Token filters transform or filter the tokens after tokenization.
404
339
  *
405
340
  * # Parameters
406
341
  *
407
- * - `mode`: The tokenization mode. Valid values are:
408
- * - `"normal"`: Standard tokenization
409
- * - `"decompose"`: Decomposes compound words into their components
342
+ * - `name`: The name of the token filter (e.g., `"lowercase"`, `"japanese_number"`).
343
+ * - `args`: A JavaScript object containing filter-specific arguments.
410
344
  *
411
345
  * # Errors
412
346
  *
413
- * Returns an error if the mode string is invalid.
347
+ * Returns an error if the arguments cannot be parsed.
414
348
  *
415
349
  * # Examples
416
350
  *
417
351
  * ```javascript
418
- * builder.setMode("normal");
419
- * // or
420
- * builder.setMode("decompose");
352
+ * builder.appendTokenFilter("lowercase");
353
+ * builder.appendTokenFilter("japanese_number", { "tags": ["名詞,数"] });
421
354
  * ```
422
- * @param {string} mode
355
+ * @param {string} name
356
+ * @param {any} args
423
357
  */
424
- setMode(mode) {
425
- const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
358
+ appendTokenFilter(name, args) {
359
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
426
360
  const len0 = WASM_VECTOR_LEN;
427
- const ret = wasm.tokenizerbuilder_setMode(this.__wbg_ptr, ptr0, len0);
361
+ const ret = wasm.tokenizerbuilder_appendTokenFilter(this.__wbg_ptr, ptr0, len0, args);
428
362
  if (ret[1]) {
429
363
  throw takeFromExternrefTable0(ret[0]);
430
364
  }
431
365
  }
432
366
  /**
433
- * Sets the dictionary to use for tokenization.
367
+ * Sets whether to keep whitespace tokens in the output.
434
368
  *
435
369
  * # Parameters
436
370
  *
437
- * - `uri`: The dictionary URI. Valid embedded dictionaries are:
438
- * - `"embedded://ipadic"`: Japanese IPADIC dictionary
439
- * - `"embedded://unidic"`: Japanese UniDic dictionary
440
- * - `"embedded://ko-dic"`: Korean ko-dic dictionary
441
- * - `"embedded://cc-cedict"`: Chinese CC-CEDICT dictionary
371
+ * - `keep`: If `true`, whitespace tokens are preserved; if `false`, they are removed.
442
372
  *
443
373
  * # Examples
444
374
  *
445
375
  * ```javascript
446
- * builder.setDictionary("embedded://ipadic");
376
+ * builder.setKeepWhitespace(false); // Remove whitespace tokens
377
+ * // or
378
+ * builder.setKeepWhitespace(true); // Keep whitespace tokens
447
379
  * ```
448
- * @param {string} uri
380
+ * @param {boolean} keep
449
381
  */
450
- setDictionary(uri) {
451
- const ptr0 = passStringToWasm0(uri, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
452
- const len0 = WASM_VECTOR_LEN;
453
- const ret = wasm.tokenizerbuilder_setDictionary(this.__wbg_ptr, ptr0, len0);
382
+ setKeepWhitespace(keep) {
383
+ const ret = wasm.tokenizerbuilder_setKeepWhitespace(this.__wbg_ptr, keep);
454
384
  if (ret[1]) {
455
385
  throw takeFromExternrefTable0(ret[0]);
456
386
  }
@@ -480,28 +410,6 @@ export class TokenizerBuilder {
480
410
  throw takeFromExternrefTable0(ret[0]);
481
411
  }
482
412
  }
483
- /**
484
- * Sets whether to keep whitespace tokens in the output.
485
- *
486
- * # Parameters
487
- *
488
- * - `keep`: If `true`, whitespace tokens are preserved; if `false`, they are removed.
489
- *
490
- * # Examples
491
- *
492
- * ```javascript
493
- * builder.setKeepWhitespace(false); // Remove whitespace tokens
494
- * // or
495
- * builder.setKeepWhitespace(true); // Keep whitespace tokens
496
- * ```
497
- * @param {boolean} keep
498
- */
499
- setKeepWhitespace(keep) {
500
- const ret = wasm.tokenizerbuilder_setKeepWhitespace(this.__wbg_ptr, keep);
501
- if (ret[1]) {
502
- throw takeFromExternrefTable0(ret[0]);
503
- }
504
- }
505
413
  /**
506
414
  * Appends a character filter to the tokenization pipeline.
507
415
  *
@@ -533,32 +441,88 @@ export class TokenizerBuilder {
533
441
  }
534
442
  }
535
443
  /**
536
- * Appends a token filter to the tokenization pipeline.
444
+ * Creates a new `TokenizerBuilder` instance.
537
445
  *
538
- * Token filters transform or filter the tokens after tokenization.
446
+ * # Returns
447
+ *
448
+ * A new `TokenizerBuilder` instance.
449
+ *
450
+ * # Errors
451
+ *
452
+ * Returns an error if the builder cannot be initialized.
453
+ *
454
+ * # Examples
455
+ *
456
+ * ```javascript
457
+ * const builder = new TokenizerBuilder();
458
+ * ```
459
+ */
460
+ constructor() {
461
+ const ret = wasm.tokenizerbuilder_new();
462
+ if (ret[2]) {
463
+ throw takeFromExternrefTable0(ret[1]);
464
+ }
465
+ this.__wbg_ptr = ret[0] >>> 0;
466
+ TokenizerBuilderFinalization.register(this, this.__wbg_ptr, this);
467
+ return this;
468
+ }
469
+ /**
470
+ * Builds and returns a configured [`Tokenizer`] instance.
471
+ *
472
+ * This method consumes the builder and creates the final tokenizer with all
473
+ * configured settings.
474
+ *
475
+ * # Returns
476
+ *
477
+ * A configured `Tokenizer` instance.
478
+ *
479
+ * # Errors
480
+ *
481
+ * Returns an error if the tokenizer cannot be built with the current configuration.
482
+ *
483
+ * # Examples
484
+ *
485
+ * ```javascript
486
+ * const builder = new TokenizerBuilder();
487
+ * builder.setDictionary("embedded://ipadic");
488
+ * const tokenizer = builder.build();
489
+ * ```
490
+ * @returns {Tokenizer}
491
+ */
492
+ build() {
493
+ const ptr = this.__destroy_into_raw();
494
+ const ret = wasm.tokenizerbuilder_build(ptr);
495
+ if (ret[2]) {
496
+ throw takeFromExternrefTable0(ret[1]);
497
+ }
498
+ return Tokenizer.__wrap(ret[0]);
499
+ }
500
+ /**
501
+ * Sets the tokenization mode.
539
502
  *
540
503
  * # Parameters
541
504
  *
542
- * - `name`: The name of the token filter (e.g., `"lowercase"`, `"japanese_number"`).
543
- * - `args`: A JavaScript object containing filter-specific arguments.
505
+ * - `mode`: The tokenization mode. Valid values are:
506
+ * - `"normal"`: Standard tokenization
507
+ * - `"decompose"`: Decomposes compound words into their components
544
508
  *
545
509
  * # Errors
546
510
  *
547
- * Returns an error if the arguments cannot be parsed.
511
+ * Returns an error if the mode string is invalid.
548
512
  *
549
513
  * # Examples
550
514
  *
551
515
  * ```javascript
552
- * builder.appendTokenFilter("lowercase");
553
- * builder.appendTokenFilter("japanese_number", { "tags": ["名詞,数"] });
516
+ * builder.setMode("normal");
517
+ * // or
518
+ * builder.setMode("decompose");
554
519
  * ```
555
- * @param {string} name
556
- * @param {any} args
520
+ * @param {string} mode
557
521
  */
558
- appendTokenFilter(name, args) {
559
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
522
+ setMode(mode) {
523
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
560
524
  const len0 = WASM_VECTOR_LEN;
561
- const ret = wasm.tokenizerbuilder_appendTokenFilter(this.__wbg_ptr, ptr0, len0, args);
525
+ const ret = wasm.tokenizerbuilder_setMode(this.__wbg_ptr, ptr0, len0);
562
526
  if (ret[1]) {
563
527
  throw takeFromExternrefTable0(ret[0]);
564
528
  }
@@ -566,6 +530,34 @@ export class TokenizerBuilder {
566
530
  }
567
531
  if (Symbol.dispose) TokenizerBuilder.prototype[Symbol.dispose] = TokenizerBuilder.prototype.free;
568
532
 
533
+ /**
534
+ * Gets the version of the lindera-wasm library.
535
+ *
536
+ * # Returns
537
+ *
538
+ * The version string of the library (e.g., "1.0.0").
539
+ *
540
+ * # Examples
541
+ *
542
+ * ```javascript
543
+ * import { getVersion } from 'lindera-wasm';
544
+ * console.log(getVersion()); // "1.0.0"
545
+ * ```
546
+ * @returns {string}
547
+ */
548
+ export function getVersion() {
549
+ let deferred1_0;
550
+ let deferred1_1;
551
+ try {
552
+ const ret = wasm.getVersion();
553
+ deferred1_0 = ret[0];
554
+ deferred1_1 = ret[1];
555
+ return getStringFromWasm0(ret[0], ret[1]);
556
+ } finally {
557
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
558
+ }
559
+ }
560
+
569
561
  const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
570
562
 
571
563
  async function __wbg_load(module, imports) {
@@ -573,7 +565,6 @@ async function __wbg_load(module, imports) {
573
565
  if (typeof WebAssembly.instantiateStreaming === 'function') {
574
566
  try {
575
567
  return await WebAssembly.instantiateStreaming(module, imports);
576
-
577
568
  } catch (e) {
578
569
  const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
579
570
 
@@ -588,13 +579,11 @@ async function __wbg_load(module, imports) {
588
579
 
589
580
  const bytes = await module.arrayBuffer();
590
581
  return await WebAssembly.instantiate(bytes, imports);
591
-
592
582
  } else {
593
583
  const instance = await WebAssembly.instantiate(module, imports);
594
584
 
595
585
  if (instance instanceof WebAssembly.Instance) {
596
586
  return { instance, module };
597
-
598
587
  } else {
599
588
  return instance;
600
589
  }
@@ -604,7 +593,7 @@ async function __wbg_load(module, imports) {
604
593
  function __wbg_get_imports() {
605
594
  const imports = {};
606
595
  imports.wbg = {};
607
- imports.wbg.__wbg_Error_e17e777aac105295 = function(arg0, arg1) {
596
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
608
597
  const ret = Error(getStringFromWasm0(arg0, arg1));
609
598
  return ret;
610
599
  };
@@ -615,27 +604,87 @@ function __wbg_get_imports() {
615
604
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
616
605
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
617
606
  };
618
- imports.wbg.__wbg_call_13410aac570ffff7 = function() { return handleError(function (arg0, arg1) {
607
+ imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
608
+ const v = arg1;
609
+ const ret = typeof(v) === 'bigint' ? v : undefined;
610
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
611
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
612
+ };
613
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
614
+ const v = arg0;
615
+ const ret = typeof(v) === 'boolean' ? v : undefined;
616
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
617
+ };
618
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
619
+ const ret = debugString(arg1);
620
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
621
+ const len1 = WASM_VECTOR_LEN;
622
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
623
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
624
+ };
625
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
626
+ const ret = arg0 in arg1;
627
+ return ret;
628
+ };
629
+ imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
630
+ const ret = typeof(arg0) === 'bigint';
631
+ return ret;
632
+ };
633
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
634
+ const ret = typeof(arg0) === 'function';
635
+ return ret;
636
+ };
637
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
638
+ const val = arg0;
639
+ const ret = typeof(val) === 'object' && val !== null;
640
+ return ret;
641
+ };
642
+ imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
643
+ const ret = arg0 === arg1;
644
+ return ret;
645
+ };
646
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
647
+ const ret = arg0 == arg1;
648
+ return ret;
649
+ };
650
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
651
+ const obj = arg1;
652
+ const ret = typeof(obj) === 'number' ? obj : undefined;
653
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
654
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
655
+ };
656
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
657
+ const obj = arg1;
658
+ const ret = typeof(obj) === 'string' ? obj : undefined;
659
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
660
+ var len1 = WASM_VECTOR_LEN;
661
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
662
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
663
+ };
664
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
665
+ throw new Error(getStringFromWasm0(arg0, arg1));
666
+ };
667
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
619
668
  const ret = arg0.call(arg1);
620
669
  return ret;
621
670
  }, arguments) };
622
- imports.wbg.__wbg_done_75ed0ee6dd243d9d = function(arg0) {
671
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
623
672
  const ret = arg0.done;
624
673
  return ret;
625
674
  };
626
- imports.wbg.__wbg_entries_2be2f15bd5554996 = function(arg0) {
675
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
627
676
  const ret = Object.entries(arg0);
628
677
  return ret;
629
678
  };
630
- imports.wbg.__wbg_get_0da715ceaecea5c8 = function(arg0, arg1) {
679
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
631
680
  const ret = arg0[arg1 >>> 0];
632
681
  return ret;
633
682
  };
634
- imports.wbg.__wbg_get_458e874b43b18b25 = function() { return handleError(function (arg0, arg1) {
683
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
635
684
  const ret = Reflect.get(arg0, arg1);
636
685
  return ret;
637
686
  }, arguments) };
638
- imports.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd = function(arg0) {
687
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
639
688
  let result;
640
689
  try {
641
690
  result = arg0 instanceof ArrayBuffer;
@@ -645,7 +694,7 @@ function __wbg_get_imports() {
645
694
  const ret = result;
646
695
  return ret;
647
696
  };
648
- imports.wbg.__wbg_instanceof_Map_ebb01a5b6b5ffd0b = function(arg0) {
697
+ imports.wbg.__wbg_instanceof_Map_084be8da74364158 = function(arg0) {
649
698
  let result;
650
699
  try {
651
700
  result = arg0 instanceof Map;
@@ -655,7 +704,7 @@ function __wbg_get_imports() {
655
704
  const ret = result;
656
705
  return ret;
657
706
  };
658
- imports.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7 = function(arg0) {
707
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
659
708
  let result;
660
709
  try {
661
710
  result = arg0 instanceof Uint8Array;
@@ -665,121 +714,61 @@ function __wbg_get_imports() {
665
714
  const ret = result;
666
715
  return ret;
667
716
  };
668
- imports.wbg.__wbg_isArray_030cce220591fb41 = function(arg0) {
717
+ imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
669
718
  const ret = Array.isArray(arg0);
670
719
  return ret;
671
720
  };
672
- imports.wbg.__wbg_isSafeInteger_1c0d1af5542e102a = function(arg0) {
721
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
673
722
  const ret = Number.isSafeInteger(arg0);
674
723
  return ret;
675
724
  };
676
- imports.wbg.__wbg_iterator_f370b34483c71a1c = function() {
725
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
677
726
  const ret = Symbol.iterator;
678
727
  return ret;
679
728
  };
680
- imports.wbg.__wbg_length_186546c51cd61acd = function(arg0) {
729
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
681
730
  const ret = arg0.length;
682
731
  return ret;
683
732
  };
684
- imports.wbg.__wbg_length_6bb7e81f9d7713e4 = function(arg0) {
733
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
685
734
  const ret = arg0.length;
686
735
  return ret;
687
736
  };
688
- imports.wbg.__wbg_new_19c25a3f2fa63a02 = function() {
737
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
689
738
  const ret = new Object();
690
739
  return ret;
691
740
  };
692
- imports.wbg.__wbg_new_1f3a344cf3123716 = function() {
741
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
693
742
  const ret = new Array();
694
743
  return ret;
695
744
  };
696
- imports.wbg.__wbg_new_638ebfaedbf32a5e = function(arg0) {
745
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
697
746
  const ret = new Uint8Array(arg0);
698
747
  return ret;
699
748
  };
700
- imports.wbg.__wbg_next_5b3530e612fde77d = function(arg0) {
749
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
701
750
  const ret = arg0.next;
702
751
  return ret;
703
752
  };
704
- imports.wbg.__wbg_next_692e82279131b03c = function() { return handleError(function (arg0) {
753
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
705
754
  const ret = arg0.next();
706
755
  return ret;
707
756
  }, arguments) };
708
- imports.wbg.__wbg_prototypesetcall_3d4a26c1ed734349 = function(arg0, arg1, arg2) {
757
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
709
758
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
710
759
  };
711
- imports.wbg.__wbg_push_330b2eb93e4e1212 = function(arg0, arg1) {
760
+ imports.wbg.__wbg_push_7d9be8f38fc13975 = function(arg0, arg1) {
712
761
  const ret = arg0.push(arg1);
713
762
  return ret;
714
763
  };
715
- imports.wbg.__wbg_set_453345bcda80b89a = function() { return handleError(function (arg0, arg1, arg2) {
764
+ imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
716
765
  const ret = Reflect.set(arg0, arg1, arg2);
717
766
  return ret;
718
767
  }, arguments) };
719
- imports.wbg.__wbg_value_dd9372230531eade = function(arg0) {
768
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
720
769
  const ret = arg0.value;
721
770
  return ret;
722
771
  };
723
- imports.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1 = function(arg0, arg1) {
724
- const v = arg1;
725
- const ret = typeof(v) === 'bigint' ? v : undefined;
726
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
727
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
728
- };
729
- imports.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746 = function(arg0) {
730
- const v = arg0;
731
- const ret = typeof(v) === 'boolean' ? v : undefined;
732
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
733
- };
734
- imports.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d = function(arg0, arg1) {
735
- const ret = debugString(arg1);
736
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
737
- const len1 = WASM_VECTOR_LEN;
738
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
739
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
740
- };
741
- imports.wbg.__wbg_wbindgenin_d7a1ee10933d2d55 = function(arg0, arg1) {
742
- const ret = arg0 in arg1;
743
- return ret;
744
- };
745
- imports.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154 = function(arg0) {
746
- const ret = typeof(arg0) === 'bigint';
747
- return ret;
748
- };
749
- imports.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74 = function(arg0) {
750
- const ret = typeof(arg0) === 'function';
751
- return ret;
752
- };
753
- imports.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8 = function(arg0) {
754
- const val = arg0;
755
- const ret = typeof(val) === 'object' && val !== null;
756
- return ret;
757
- };
758
- imports.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58 = function(arg0, arg1) {
759
- const ret = arg0 === arg1;
760
- return ret;
761
- };
762
- imports.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1 = function(arg0, arg1) {
763
- const ret = arg0 == arg1;
764
- return ret;
765
- };
766
- imports.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb = function(arg0, arg1) {
767
- const obj = arg1;
768
- const ret = typeof(obj) === 'number' ? obj : undefined;
769
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
770
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
771
- };
772
- imports.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f = function(arg0, arg1) {
773
- const obj = arg1;
774
- const ret = typeof(obj) === 'string' ? obj : undefined;
775
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
776
- var len1 = WASM_VECTOR_LEN;
777
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
778
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
779
- };
780
- imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
781
- throw new Error(getStringFromWasm0(arg0, arg1));
782
- };
783
772
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
784
773
  // Cast intrinsic for `Ref(String) -> Externref`.
785
774
  const ret = getStringFromWasm0(arg0, arg1);
@@ -801,23 +790,18 @@ function __wbg_get_imports() {
801
790
  return ret;
802
791
  };
803
792
  imports.wbg.__wbindgen_init_externref_table = function() {
804
- const table = wasm.__wbindgen_export_4;
793
+ const table = wasm.__wbindgen_externrefs;
805
794
  const offset = table.grow(4);
806
795
  table.set(0, undefined);
807
796
  table.set(offset + 0, undefined);
808
797
  table.set(offset + 1, null);
809
798
  table.set(offset + 2, true);
810
799
  table.set(offset + 3, false);
811
- ;
812
800
  };
813
801
 
814
802
  return imports;
815
803
  }
816
804
 
817
- function __wbg_init_memory(imports, memory) {
818
-
819
- }
820
-
821
805
  function __wbg_finalize_init(instance, module) {
822
806
  wasm = instance.exports;
823
807
  __wbg_init.__wbindgen_wasm_module = module;
@@ -842,15 +826,10 @@ function initSync(module) {
842
826
  }
843
827
 
844
828
  const imports = __wbg_get_imports();
845
-
846
- __wbg_init_memory(imports);
847
-
848
829
  if (!(module instanceof WebAssembly.Module)) {
849
830
  module = new WebAssembly.Module(module);
850
831
  }
851
-
852
832
  const instance = new WebAssembly.Instance(module, imports);
853
-
854
833
  return __wbg_finalize_init(instance, module);
855
834
  }
856
835
 
@@ -875,8 +854,6 @@ async function __wbg_init(module_or_path) {
875
854
  module_or_path = fetch(module_or_path);
876
855
  }
877
856
 
878
- __wbg_init_memory(imports);
879
-
880
857
  const { instance, module } = await __wbg_load(await module_or_path, imports);
881
858
 
882
859
  return __wbg_finalize_init(instance, module);