RecconSpanExtractionPostprocessor

class RecconSpanExtractionPostprocessor(threshold: float = 0.7)[source]

Class to initialise the Postprocessor for RecconSpanExtraction model. Class to postprocess RecconSpanExtractionModel raw output to get the causal span and probabilities

Parameters

threshold (float, optional) – probability threshold value to extract causal span. Defaults to 0.7.

__call__(raw_pred: transformers.modeling_outputs.QuestionAnsweringModelOutput, evidences: List[Dict[str, Union[int, str]]], examples: List[transformers.data.processors.squad.SquadExample], features: List[transformers.data.processors.squad.SquadFeatures])Tuple[List[List[str]], List[List[int]], List[List[Union[int, float]]]][source]

Convert raw prediction (logits) to: 1. list of list of spans 2. List of list of integer to indicate if corresponding span is causal 3. List of list of float to indicate probability of corresponding span being causal

Parameters
  • raw_pred (QuestionAnsweringModelOutput) – output of RecconSpanExtractionModel

  • evidences (List[Dict[str, Union[int, str]]]) – List of evidence utterances

  • examples (List[SquadExample]) – List of SquadExample instance - output of RecconSpanExtractionPreprocessor

  • features (List[SquadFeatures]) – List of SquadFeatures instance - output of RecconSpanExtractionPreprocessor

Returns

  1. List of list of spans
    1. List of list of integer to

      indicate if corresponding span is causal

    2. List of list of int/float to indicate

      probability of corresponding span being causal. -1 indicates span is not causal

Return type

Tuple[List[List[str]], List[List[int]], List[List[Union[int, float]]]]