Skip to content

Commit 5f8f06d

Browse files
committed
Update remove_overlapping method to be able to use Python3.6
1 parent b84953c commit 5f8f06d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

auto_labeling_pipeline/labels.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,13 @@ class SequenceLabels(Labels):
4848
def remove_overlapping(self) -> 'Labels':
4949
target = self.label_class(start_offset=0, end_offset=0, label='')
5050
labels = sorted(self.labels, key=operator.attrgetter('start_offset'))
51-
labels = [target := label for label in labels if not label.overlap_with(target)] # type: ignore
52-
return self.__class__([label.dict() for label in labels])
51+
_labels = []
52+
for label in labels:
53+
if label.overlap_with(target):
54+
continue
55+
target = label # type: ignore
56+
_labels.append(label)
57+
return self.__class__([label.dict() for label in _labels])
5358

5459

5560
class Seq2seqLabels(Labels):

0 commit comments

Comments
 (0)