> For the complete documentation index, see [llms.txt](https://utca.knowledgator.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utca.knowledgator.com/tasks/transformerstokenclassifier.md).

# TransformersTokenClassifier

NER task

Subclass of [**NERTask**](/tasks/task.md#nertask)**.**&#x20;

## Module: [implementation](/framework-structure.md#implementation).tasks

## Default predictor

This task uses [**TransformersModel**](/predictors/transformers-predictors.md#transformersmodel) by default with this configuration:

{% code overflow="wrap" fullWidth="false" %}

```python
TransformersPipeline(
    TransformersPipelineConfig(
        task="token-classification", 
        model="dbmdz/bert-large-cased-finetuned-conll03-english"
    ),
    input_class=TransformersBasicInput,
    output_class=TransformersBasicOutput
)
```

{% endcode %}

#### **See:**

* [**TransformersPipeline**](/predictors/transformers-predictors.md#transformerspipeline)&#x20;
* [**TransformersPipelineConfig**](/predictors/transformers-predictors.md#transformerspipelineconfig)
* [**TransformersBasicInput**](/predictors/transformers-schemas.md#transformersbasicinput)
* [**TransformersBasicOutput**](/predictors/transformers-schemas.md#transformersbasicoutput)

## Methods and properties

Main methods and properties

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**predictor**</mark>**&#x20;(**[**Predictor**](/predictors/predictor.md)**\[Any, Any], optional):** Predictor that will be used in task. If equals to None, [**default predictor**](#default-predictor) will be used. Defaults to None.
* <mark style="color:orange;">**preprocess**</mark>**&#x20;(Optional\[**[**Component**](/core/component.md)**], optional):** Component executed before predictor. Defaults to None.
* <mark style="color:orange;">**postprocess**</mark>**&#x20;(Optional\[**[**Component**](/core/component.md)**], optional):** Component executed after predictor. If equals to None, default component will be used. Defaults to None.\
  \
  Default component: \
  [**TokenClassifierPostprocessor**](#tokenclassifierpostprocessor)
* <mark style="color:orange;">**input\_class**</mark>**&#x20;(Type\[**[**Input**](/core/schemas.md#input)**], optional):** Class for input validation. Defaults to [**TransformersBasicInput**](/predictors/transformers-schemas.md#transformersbasicinput)**.**
* <mark style="color:orange;">**output\_class**</mark>**&#x20;(Type\[**[**Output**](/core/schemas.md#output)**], optional):** Class for output validation. Defaults to [**TransformersTokenClassifierOutput**](#transformerstokenclassifieroutput)**.**
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

***

***

## <mark style="color:green;">**TransformersTokenClassifierOutput**</mark>

Subclass of [**NEROutput**](/tasks/task.md#neroutput). Type of [**NEROutput**](/tasks/task.md#neroutput)**\[**[**ClassifiedEntity**](/tasks/objects.md#classifiedentity)**].**

***

***

***

## <mark style="color:green;">TokenClassifierPostprocessor</mark>

Format model output. Subclass of [**Action**](/core/action.md). Type of [**Action**](/core/action.md)**\[Dict\[str, Any], Dict\[str, Any]].**

***

### <mark style="color:blue;">\_\_init\_\_</mark>

#### Arguments:

* <mark style="color:orange;">**threshold**</mark>**&#x20;(float):** Entities threshold score. Defaults to 0.
* <mark style="color:orange;">**name**</mark>**&#x20;(Optional\[str], optional):** Name for identification. If equals to None, class name will be used. Defaults to None.

***

### <mark style="color:blue;">execute</mark>

#### Arguments:

* <mark style="color:orange;">**input\_data**</mark>**&#x20;(Dict\[str, Any]):** \
  Expected keys:
  * <mark style="color:red;">**"output"**</mark>**&#x20;(List\[Dict\[str, Any]]):** Model output;

#### Returns:

* **Dict\[str, Any]:** \
  Expected keys:
  * <mark style="color:red;">**"output"**</mark>**&#x20;(List\[**[**ClassifiedEntity**](/tasks/objects.md#classifiedentity)**]):** Classified entities;

***

***
