TokenSearcherNER
NER task
This task uses TokenSearcherPredictor by default. For more details, see:
TokenSearcherPredictorSubclass of NERTask.
Module: implementation.tasks
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 TokenSearcherPredictor will be used. Defaults to None.
preprocess (Optional[Component], optional): Component executed before predictor. If equals to None, default component will be used. Defaults to None. Default component: TokenSearcherNERPreprocessor
postprocess (Optional[Component], optional): Component executed after predictor. If equals to None, default component will be used. Defaults to None. Default component: TokenSearcherNERPostprocessor
input_class (Type[Input], optional): Class for input validation. Defaults to TokenSearcherNERInput.
output_class (Type[NEROutputType], optional): Class for output validation. Defaults to TokenSearcherNEROutput.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
TokenSearcherNERInput
Subclass of IOModel.
__init__
Arguments:
text (str): Text to clean.
labels (List[str]): Labels for classification.
TokenSearcherNEROutput
Subclass of NEROutput. Type of NEROutput[ClassifiedEntity].
__init__
Arguments:
text (str): Input text.
output (List[ClassifiedEntity]): Classified entities.
TokenSearcherNERPreprocessor
Create prompts with providied text. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].
__init__
Arguments:
sents_batch (int): Chunks size in sentences. Defaults to 10.
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:
"text" (str): Text to process;
"labels" (List[str]): Labels for classification;
Returns:
Dict[str, Any]: Expected keys:
"inputs" (List[str]): Model inputs;
"chunks_starts" (List[int]): Chunks start positions. Used by postprocessor;
"prompt_lengths" (List[int]): Prompt lenghts. Used by postprocessor;
TokenSearcherNERPostprocessor
Format 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[List[Dict[str, Any]]]): Model output;
"labels" (List[str]): Labels for classification;
"text" (str): Processed text;
"chunks_starts" (List[int]): Chunks start positions;
"prompt_lengths" (List[int]): Prompt lenghts;
Returns:
Dict[str, Any]: Expected keys:
"text" (str): Processed text;
"output" (List[ClassifiedEntity]): Classified entities;
Last updated