TransformersTokenClassifier

NER task

Subclass of NERTask.

Module: implementation.tasks

Default predictor

This task uses TransformersModel by default with this configuration:

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

See:

Methods and properties

Main methods and properties


__init__

Arguments:

  • predictor (Predictor[Any, Any], optional): Predictor that will be used in task. If equals to None, default predictor will be used. Defaults to None.

  • preprocess (Optional[Component], optional): Component executed before predictor. Defaults to None.

  • postprocess (Optional[Component], optional): Component executed after predictor. If equals to None, default component will be used. Defaults to None. Default component: TokenClassifierPostprocessor

  • input_class (Type[Input], optional): Class for input validation. Defaults to TransformersBasicInput.

  • output_class (Type[Output], optional): Class for output validation. Defaults to TransformersTokenClassifierOutput.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.




TransformersTokenClassifierOutput

Subclass of NEROutput. Type of NEROutput[ClassifiedEntity].




TokenClassifierPostprocessor

Format model output. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].


__init__

Arguments:

  • threshold (float): Entities threshold score. Defaults to 0.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "output" (List[Dict[str, Any]]): Model output;

Returns:

  • Dict[str, Any]: Expected keys:



Last updated