def validate_utterance(self, utterance):
        """
        Validate the given utterance and return a list of uncovered segments (start, end).
        """
        uncovered_segments = []

        if self.label_list_idx in utterance.label_lists.keys():
            start = 0
            end = utterance.duration
            ll = utterance.label_lists[self.label_list_idx]
            ranges = list(ll.ranges(yield_ranges_without_labels=True))

            # Check coverage at start
            if ranges[0][0] - start > self.threshold:
                uncovered_segments.append((start, ranges[0][0]))

            # Check for empty ranges
            for range in ranges:
                if len(range[2]) == 0 and range[1] - range[0] > self.threshold:
                    uncovered_segments.append((range[0], range[1]))

            # Check coverage at end
            if ranges[-1][1] > 0 and end - ranges[-1][1] > self.threshold:
                uncovered_segments.append((ranges[-1][1], end))

        else:
            uncovered_segments.append((utterance.start, utterance.end))

        return uncovered_segments
def validate_utterance ( self , utterance ) : uncovered_segments = [ ] if self . label_list_idx in utterance . label_lists . keys ( ) : start = 0 end = utterance . duration ll = utterance . label_lists [ self . label_list_idx ] ranges = list ( ll . ranges ( yield_ranges_without_labels = True ) ) if ranges [ 0 ] [ 0 ] - start > self . threshold : uncovered_segments . append ( ( start , ranges [ 0 ] [ 0 ] ) ) for range in ranges : if len ( range [ 2 ] ) == 0 and range [ 1 ] - range [ 0 ] > self . threshold : uncovered_segments . append ( ( range [ 0 ] , range [ 1 ] ) ) if ranges [ - 1 ] [ 1 ] > 0 and end - ranges [ - 1 ] [ 1 ] > self . threshold : uncovered_segments . append ( ( ranges [ - 1 ] [ 1 ] , end ) ) else : uncovered_segments . append ( ( utterance . start , utterance . end ) ) return uncovered_segments
Validate the given utterance and return a list of uncovered segments (start, end).