TokenSearcherRelationExtraction

Relation extraction task

This task uses TokenSearcherPredictor by default. For more details, see:

TokenSearcherPredictor

Subclass of Task.

Module: implementation.tasks

Methods and properties

Main methods and properties


__init__

Arguments:




TokenSearcherRelationExtractionPreprocessor

Create prompt with providied text. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]].


execute

Arguments:

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

    • "text" (str): Text to process;

    • "relations" (List[Relation]): Relations parameters;

    • "entities" (List[ClassifiedEntity]): Entities to use;

Returns:

  • Dict[str, Any]: Expected keys:

    • "source_entities" (List[ClassifiedEntity]): Source entities to use;

    • "relations_labels" (List[str]): Corresponding relations labels;

    • "inputs" (List[str]): Model inputs;

    • "prompt_lengths" (List[int]): Prompt lenghts. Used by postprocessor;




TokenSearcherRelationExtractionPostprocessor

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


__init__

Arguments:

  • threshold (float): Relations 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:

    • "text" (str): Processed text;

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

    • "relations" (List[Relation]): Relations parameters;

    • "source_entities" (List[ClassifiedEntity]): Used source entities;

    • "relations_labels" (List[str]): Corresponding relations labels;

    • "entities" (List[ClassifiedEntity]): Entities to use;

    • "prompt_lengths" (List[int]): Prompt lenghts;

Returns:

  • Dict[str, Any]: Expected keys:

    • "output" (List[Triplets]): Extracted relations;



Last updated