@mediapipe/tasks-text 0.10.4 → 0.10.6
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/package.json +3 -2
- package/text.d.ts +26 -1
- package/text_bundle.cjs +1 -1
- package/text_bundle.cjs.map +1 -1
- package/text_bundle.mjs +1 -1
- package/text_bundle.mjs.map +1 -1
- package/wasm/text_wasm_internal.js +2 -2
- package/wasm/text_wasm_internal.wasm +0 -0
- package/wasm/text_wasm_nosimd_internal.js +2 -2
- package/wasm/text_wasm_nosimd_internal.wasm +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediapipe/tasks-text",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"description": "MediaPipe Text Tasks",
|
|
5
5
|
"main": "text_bundle.cjs",
|
|
6
6
|
"browser": "text_bundle.mjs",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
"import": "./text_bundle.mjs",
|
|
10
10
|
"require": "./text_bundle.cjs",
|
|
11
|
-
"default": "./text_bundle.mjs"
|
|
11
|
+
"default": "./text_bundle.mjs",
|
|
12
|
+
"types": "./text_.d.ts"
|
|
12
13
|
},
|
|
13
14
|
"author": "mediapipe@google.com",
|
|
14
15
|
"license": "Apache-2.0",
|
package/text.d.ts
CHANGED
|
@@ -221,12 +221,14 @@ export declare class FilesetResolver {
|
|
|
221
221
|
* you can use `isSimdSupported()` to decide whether to load the SIMD-based
|
|
222
222
|
* assets.
|
|
223
223
|
*
|
|
224
|
+
* @export
|
|
224
225
|
* @return Whether SIMD support was detected in the current environment.
|
|
225
226
|
*/
|
|
226
227
|
static isSimdSupported(): Promise<boolean>;
|
|
227
228
|
/**
|
|
228
229
|
* Creates a fileset for the MediaPipe Audio tasks.
|
|
229
230
|
*
|
|
231
|
+
* @export
|
|
230
232
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
231
233
|
* files should be loaded from. If not specified, the Wasm files are
|
|
232
234
|
* loaded from the host's root directory.
|
|
@@ -237,6 +239,7 @@ export declare class FilesetResolver {
|
|
|
237
239
|
/**
|
|
238
240
|
* Creates a fileset for the MediaPipe Text tasks.
|
|
239
241
|
*
|
|
242
|
+
* @export
|
|
240
243
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
241
244
|
* files should be loaded from. If not specified, the Wasm files are
|
|
242
245
|
* loaded from the host's root directory.
|
|
@@ -247,6 +250,7 @@ export declare class FilesetResolver {
|
|
|
247
250
|
/**
|
|
248
251
|
* Creates a fileset for the MediaPipe Vision tasks.
|
|
249
252
|
*
|
|
253
|
+
* @export
|
|
250
254
|
* @param basePath An optional base path to specify the directory the Wasm
|
|
251
255
|
* files should be loaded from. If not specified, the Wasm files are
|
|
252
256
|
* loaded from the host's root directory.
|
|
@@ -261,6 +265,7 @@ export declare class LanguageDetector extends TaskRunner {
|
|
|
261
265
|
/**
|
|
262
266
|
* Initializes the Wasm runtime and creates a new language detector from the
|
|
263
267
|
* provided options.
|
|
268
|
+
* @export
|
|
264
269
|
* @param wasmFileset A configuration object that provides the location of the
|
|
265
270
|
* Wasm binary and its loader.
|
|
266
271
|
* @param textClassifierOptions The options for the language detector. Note
|
|
@@ -271,6 +276,7 @@ export declare class LanguageDetector extends TaskRunner {
|
|
|
271
276
|
/**
|
|
272
277
|
* Initializes the Wasm runtime and creates a new language detector based on
|
|
273
278
|
* the provided model asset buffer.
|
|
279
|
+
* @export
|
|
274
280
|
* @param wasmFileset A configuration object that provides the location of the
|
|
275
281
|
* Wasm binary and its loader.
|
|
276
282
|
* @param modelAssetBuffer A binary representation of the model.
|
|
@@ -279,6 +285,7 @@ export declare class LanguageDetector extends TaskRunner {
|
|
|
279
285
|
/**
|
|
280
286
|
* Initializes the Wasm runtime and creates a new language detector based on
|
|
281
287
|
* the path to the model asset.
|
|
288
|
+
* @export
|
|
282
289
|
* @param wasmFileset A configuration object that provides the location of the
|
|
283
290
|
* Wasm binary and its loader.
|
|
284
291
|
* @param modelAssetPath The path to the model asset.
|
|
@@ -292,12 +299,14 @@ export declare class LanguageDetector extends TaskRunner {
|
|
|
292
299
|
* You can reset an option back to its default value by explicitly setting it
|
|
293
300
|
* to `undefined`.
|
|
294
301
|
*
|
|
302
|
+
* @export
|
|
295
303
|
* @param options The options for the language detector.
|
|
296
304
|
*/
|
|
297
305
|
setOptions(options: LanguageDetectorOptions): Promise<void>;
|
|
298
306
|
/**
|
|
299
307
|
* Predicts the language of the input text.
|
|
300
308
|
*
|
|
309
|
+
* @export
|
|
301
310
|
* @param text The text to process.
|
|
302
311
|
* @return The languages detected in the input text.
|
|
303
312
|
*/
|
|
@@ -345,7 +354,10 @@ declare abstract class TaskRunner {
|
|
|
345
354
|
protected constructor();
|
|
346
355
|
/** Configures the task with custom options. */
|
|
347
356
|
abstract setOptions(options: TaskRunnerOptions): Promise<void>;
|
|
348
|
-
/**
|
|
357
|
+
/**
|
|
358
|
+
* Closes and cleans up the resources held by this task.
|
|
359
|
+
* @export
|
|
360
|
+
*/
|
|
349
361
|
close(): void;
|
|
350
362
|
}
|
|
351
363
|
|
|
@@ -360,6 +372,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
360
372
|
/**
|
|
361
373
|
* Initializes the Wasm runtime and creates a new text classifier from the
|
|
362
374
|
* provided options.
|
|
375
|
+
* @export
|
|
363
376
|
* @param wasmFileset A configuration object that provides the location of the
|
|
364
377
|
* Wasm binary and its loader.
|
|
365
378
|
* @param textClassifierOptions The options for the text classifier. Note that
|
|
@@ -370,6 +383,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
370
383
|
/**
|
|
371
384
|
* Initializes the Wasm runtime and creates a new text classifier based on the
|
|
372
385
|
* provided model asset buffer.
|
|
386
|
+
* @export
|
|
373
387
|
* @param wasmFileset A configuration object that provides the location of the
|
|
374
388
|
* Wasm binary and its loader.
|
|
375
389
|
* @param modelAssetBuffer A binary representation of the model.
|
|
@@ -378,6 +392,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
378
392
|
/**
|
|
379
393
|
* Initializes the Wasm runtime and creates a new text classifier based on the
|
|
380
394
|
* path to the model asset.
|
|
395
|
+
* @export
|
|
381
396
|
* @param wasmFileset A configuration object that provides the location of the
|
|
382
397
|
* Wasm binary and its loader.
|
|
383
398
|
* @param modelAssetPath The path to the model asset.
|
|
@@ -391,6 +406,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
391
406
|
* You can reset an option back to its default value by explicitly setting it
|
|
392
407
|
* to `undefined`.
|
|
393
408
|
*
|
|
409
|
+
* @export
|
|
394
410
|
* @param options The options for the text classifier.
|
|
395
411
|
*/
|
|
396
412
|
setOptions(options: TextClassifierOptions): Promise<void>;
|
|
@@ -398,6 +414,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
398
414
|
* Performs Natural Language classification on the provided text and waits
|
|
399
415
|
* synchronously for the response.
|
|
400
416
|
*
|
|
417
|
+
* @export
|
|
401
418
|
* @param text The text to process.
|
|
402
419
|
* @return The classification result of the text
|
|
403
420
|
*/
|
|
@@ -431,6 +448,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
431
448
|
/**
|
|
432
449
|
* Initializes the Wasm runtime and creates a new text embedder from the
|
|
433
450
|
* provided options.
|
|
451
|
+
* @export
|
|
434
452
|
* @param wasmFileset A configuration object that provides the location of the
|
|
435
453
|
* Wasm binary and its loader.
|
|
436
454
|
* @param textEmbedderOptions The options for the text embedder. Note that
|
|
@@ -441,6 +459,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
441
459
|
/**
|
|
442
460
|
* Initializes the Wasm runtime and creates a new text embedder based on the
|
|
443
461
|
* provided model asset buffer.
|
|
462
|
+
* @export
|
|
444
463
|
* @param wasmFileset A configuration object that provides the location of the
|
|
445
464
|
* Wasm binary and its loader.
|
|
446
465
|
* @param modelAssetBuffer A binary representation of the TFLite model.
|
|
@@ -449,6 +468,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
449
468
|
/**
|
|
450
469
|
* Initializes the Wasm runtime and creates a new text embedder based on the
|
|
451
470
|
* path to the model asset.
|
|
471
|
+
* @export
|
|
452
472
|
* @param wasmFileset A configuration object that provides the location of the
|
|
453
473
|
* Wasm binary and its loader.
|
|
454
474
|
* @param modelAssetPath The path to the TFLite model.
|
|
@@ -462,6 +482,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
462
482
|
* You can reset an option back to its default value by explicitly setting it
|
|
463
483
|
* to `undefined`.
|
|
464
484
|
*
|
|
485
|
+
* @export
|
|
465
486
|
* @param options The options for the text embedder.
|
|
466
487
|
*/
|
|
467
488
|
setOptions(options: TextEmbedderOptions): Promise<void>;
|
|
@@ -469,6 +490,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
469
490
|
* Performs embeding extraction on the provided text and waits synchronously
|
|
470
491
|
* for the response.
|
|
471
492
|
*
|
|
493
|
+
* @export
|
|
472
494
|
* @param text The text to process.
|
|
473
495
|
* @return The embedding resuls of the text
|
|
474
496
|
*/
|
|
@@ -479,6 +501,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
479
501
|
*
|
|
480
502
|
* [1]: https://en.wikipedia.org/wiki/Cosine_similarity
|
|
481
503
|
*
|
|
504
|
+
* @export
|
|
482
505
|
* @throws if the embeddings are of different types(float vs. quantized), have
|
|
483
506
|
* different sizes, or have an L2-norm of 0.
|
|
484
507
|
*/
|
|
@@ -530,6 +553,8 @@ declare interface WasmFileset {
|
|
|
530
553
|
wasmBinaryPath: string;
|
|
531
554
|
/** The optional path to the asset loader script. */
|
|
532
555
|
assetLoaderPath?: string;
|
|
556
|
+
/** The optional path to the assets binary. */
|
|
557
|
+
assetBinaryPath?: string;
|
|
533
558
|
}
|
|
534
559
|
|
|
535
560
|
export { }
|