<br />

Performs Natural Language classification.

**Signature:**

    export declare class TextClassifier extends TaskRunner 

## Methods

| Method | Modifiers | Description |
|---|---|---|
| [createFromOptions(wasmFileset, textClassifierOptions)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.textclassifier#textclassifiercreatefromoptions) | `static` | Initializes the Wasm runtime and creates a new text classifier from the provided options. |
| [createFromModelBuffer(wasmFileset, modelAssetBuffer)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.textclassifier#textclassifiercreatefrommodelbuffer) | `static` | Initializes the Wasm runtime and creates a new text classifier based on the provided model asset buffer. |
| [createFromModelPath(wasmFileset, modelAssetPath)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.textclassifier#textclassifiercreatefrommodelpath) | `static` | Initializes the Wasm runtime and creates a new text classifier based on the path to the model asset. |
| [setOptions(options)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.textclassifier#textclassifiersetoptions) |   | 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`. |
| [classify(text)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.textclassifier#textclassifierclassify) |   | Performs Natural Language classification on the provided text and waits synchronously for the response. |

## TextClassifier.createFromOptions() {#textclassifiercreatefromoptions}

Initializes the Wasm runtime and creates a new text classifier from the provided options.

**Signature:**

    static createFromOptions(wasmFileset: WasmFileset, textClassifierOptions: TextClassifierOptions): Promise<TextClassifier>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| textClassifierOptions | TextClassifierOptions | The options for the text classifier. Note that either a path to the TFLite model or the model itself needs to be provided (via `baseOptions`). |

**Returns:**

Promise\<TextClassifier\>

## TextClassifier.createFromModelBuffer() {#textclassifiercreatefrommodelbuffer}

Initializes the Wasm runtime and creates a new text classifier based on the provided model asset buffer.

**Signature:**

    static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array | ReadableStreamDefaultReader): Promise<TextClassifier>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetBuffer | Uint8Array \| ReadableStreamDefaultReader | An array or a stream containing a binary representation of the model. |

**Returns:**

Promise\<TextClassifier\>

## TextClassifier.createFromModelPath() {#textclassifiercreatefrommodelpath}

Initializes the Wasm runtime and creates a new text classifier based on the path to the model asset.

**Signature:**

    static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextClassifier>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetPath | string | The path to the model asset. |

**Returns:**

Promise\<TextClassifier\>

## TextClassifier.setOptions() {#textclassifiersetoptions}

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`.

**Signature:**

    setOptions(options: TextClassifierOptions): Promise<void>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| options | TextClassifierOptions | The options for the text classifier. |

**Returns:**

Promise\<void\>

## TextClassifier.classify() {#textclassifierclassify}

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. |

**Returns:**

TextClassifierResult