> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TextClassifierNode

> Text classifier node for content classification and topic detection. Analyzes text input and classifies it into predefined categories using ML models. Returns classification results with confidence scores. You can either use a pre-configured text classifier component that could be reused across multiple nodes or node will create a new component for you.

## Input

**Type:** `String`

The data type that TextClassifierNode accepts as input

## Output

**Type:** `GraphTypes.ClassificationResult`

The data type that TextClassifierNode outputs

## Examples

```typescript theme={"system"}
// Using component configuration
const classifierNode = new TextClassifierNode({
id: 'content-classifier',
modelWeightsPath: '/models/classifier_weights.json',
embedderComponentId: 'text_embedder_component',
supportedClasses: ['hategroup', 'selfharm', 'sexual', 'sexualminors', 'substance'],
classifierConfig: {
classes: [
{ label: 'hategroup', threshold: 0.8 },
{ label: 'selfharm', threshold: 0.9 }
]
}
});

// Using existing text classifier component
const classifierComponent = new TextClassifierComponent({
id: 'existing-classifier-component',
modelWeightsPath: '/models/classifier_weights.json',
embedderComponentId: 'text_embedder_component',
supportedClasses: ['hategroup', 'selfharm']
});
const classifierNodeWithComponent = new TextClassifierNode({
id: 'content-classifier',
textClassifierComponent: classifierComponent
});
```

## Constructors

* [constructor](#constructor)

## Interfaces

* [ClassifierClass](#classifierclass)
* [ClassifierConfig](#classifierconfig)
* [TextClassifierNodeProps](#textclassifiernodeprops)
* [TextClassifierNodeWithComponentProps](#textclassifiernodewithcomponentprops)

***

## Constructors

### constructor

```typescript theme={"system"}
new TextClassifierNode(props: TextClassifierNodeProps | TextClassifierNodeWithComponentProps): TextClassifierNode
```

Creates a new TextClassifierNode instance.

#### Parameters

<ParamField body="props" type="TextClassifierNodeProps | TextClassifierNodeWithComponentProps" required>
  Configuration for the text classifier node.
</ParamField>

#### Returns

`TextClassifierNode`

## Interfaces

### ClassifierClass

Configuration for a single classification class

#### Properties

**label**: `string`

The class label for the classification category (raw name like "hategroup", "selfharm")

**threshold**: `number`

Threshold value for classification confidence

### ClassifierConfig

Configuration for the text classifier

#### Properties

**classes**: `ClassifierClass[]`

Array of classes to classify with their thresholds

### TextClassifierNodeProps

Array of classes to classify with their thresholds

#### Properties

**modelWeightsPath**: `string`

Path to model weights for text classification

**embedderComponentId**: `string`

Text embedder component ID to use for semantic analysis

**supportedClasses**: `string[]`

List of supported classes that the model can classify

**classifierConfig**?: `ClassifierConfig`

Optional classifier configuration with classes and thresholds

**errorHandling**?: `NodeErrorConfig`

Optional error handling configuration for the node

### TextClassifierNodeWithComponentProps

Optional error handling configuration for the node

#### Properties

**textClassifierComponent**: `TextClassifierComponent`

Pre-configured text classifier component to reuse

**classifierConfig**?: `ClassifierConfig`

Optional classifier configuration with classes and thresholds

**errorHandling**?: `NodeErrorConfig`

Optional error handling configuration for the node
