Performs Natural Language classification.
Signature:
export declare class TextClassifier extends TaskRunner
Extends: TaskRunner
Methods
Method | Modifiers | Description |
---|---|---|
classify(text) | Performs Natural Language classification on the provided text and waits synchronously for the response. | |
createFromModelBuffer(wasmFileset, modelAssetBuffer) | static |
Initializes the Wasm runtime and creates a new text classifier based on the provided model asset buffer. |
createFromModelPath(wasmFileset, modelAssetPath) | static |
Initializes the Wasm runtime and creates a new text classifier based on the path to the model asset. |
createFromOptions(wasmFileset, textClassifierOptions) | static |
Initializes the Wasm runtime and creates a new text classifier from the provided options. |
setOptions(options) | Sets new options for the text classifier.Calling setOptions() with a subset of options only affects those options. You can reset an option back to its default value by explicitly setting it to undefined . |
TextClassifier.classify()
Performs Natural Language classification on the provided text and waits synchronously for the response.
Signature:
classify(text: string): TextClassifierResult;
Parameters
Parameter | Type | Description |
---|---|---|
text | string | The text to process. The classification result of the text |
Returns:
TextClassifier.createFromModelBuffer()
Initializes the Wasm runtime and creates a new text classifier based on the provided model asset buffer.
Signature:
static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array): Promise<TextClassifier><