INNER CODE UNIT · Python

_get_spans

NorskRegnesentral/skweak · skweak/aggregation.py:144

    def _get_spans(self, agg_df: pandas.DataFrame, threshold=0.5) \
        -> List[Tuple[int,int,str]]:
        """Takes as input a 2D dataframe of shape (nb_entries, nb_labels)
        assocating each token/span to the probability of an output label, and 
        returns a list of tuples (start, end, label).        
        """
        raise NotImplementedError("must implement _get_spans")    


    @abstractmethod
    def _get_probs(self, agg_df: pandas.DataFrame, min_threshold=0.1) \
        -> Dict[Tuple[int,int],Dict[str,float]]:
        """Takes as input a 2D dataframe of shape (nb_entries, nb_labels)
        assocating each token/span to the probability of an output label, and 
        returns a dictionary associating each (start,end) span/token to a 
        mapping from labels to probabilities"""

        raise NotImplementedError("must implement _get_probs")   

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…