<br />

Predicts the language of an input text.

**Signature:**

    export declare class LanguageDetector extends TaskRunner 

## Methods

| Method | Modifiers | Description |
|---|---|---|
| [createFromOptions(wasmFileset, textClassifierOptions)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.languagedetector#languagedetectorcreatefromoptions) | `static` | Initializes the Wasm runtime and creates a new language detector from the provided options. |
| [createFromModelBuffer(wasmFileset, modelAssetBuffer)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.languagedetector#languagedetectorcreatefrommodelbuffer) | `static` | Initializes the Wasm runtime and creates a new language detector based on the provided model asset buffer. |
| [createFromModelPath(wasmFileset, modelAssetPath)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.languagedetector#languagedetectorcreatefrommodelpath) | `static` | Initializes the Wasm runtime and creates a new language detector based on the path to the model asset. |
| [setOptions(options)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.languagedetector#languagedetectorsetoptions) |   | Sets new options for the language detector. 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`. |
| [detect(text)](https://developers.google.com/edge/api/mediapipe/js/tasks-text.languagedetector#languagedetectordetect) |   | Predicts the language of the input text. |

## LanguageDetector.createFromOptions() {#languagedetectorcreatefromoptions}

Initializes the Wasm runtime and creates a new language detector from the provided options.

**Signature:**

    static createFromOptions(wasmFileset: WasmFileset, textClassifierOptions: LanguageDetectorOptions): Promise<LanguageDetector>;

### Parameters

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

**Returns:**

Promise\<LanguageDetector\>

## LanguageDetector.createFromModelBuffer() {#languagedetectorcreatefrommodelbuffer}

Initializes the Wasm runtime and creates a new language detector based on the provided model asset buffer.

**Signature:**

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

### 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\<LanguageDetector\>

## LanguageDetector.createFromModelPath() {#languagedetectorcreatefrommodelpath}

Initializes the Wasm runtime and creates a new language detector based on the path to the model asset.

**Signature:**

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

### 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\<LanguageDetector\>

## LanguageDetector.setOptions() {#languagedetectorsetoptions}

Sets new options for the language detector. 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: LanguageDetectorOptions): Promise<void>;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| options | LanguageDetectorOptions | The options for the language detector. |

**Returns:**

Promise\<void\>

## LanguageDetector.detect() {#languagedetectordetect}

Predicts the language of the input text.

**Signature:**

    detect(text: string): LanguageDetectorResult;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| text | string | The text to process. |

**Returns:**

LanguageDetectorResult