Skip to content

Commit 91d807c

Browse files
committed
NDTextEntity: fix "start >= end" test
LabelBox convention about text location is that "end" is the index of the *last* character of the substring (that is not the python convention). I.e.: substring = string[v["start"] : v["end"] + 1] So, v["start"] == v["end"] is a valid case corresponding to a 1-character substring.
1 parent 4245636 commit 91d807c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

labelbox/schema/bulk_import_request.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,9 @@ def is_valid_location(cls, v):
760760
f"A line must have at least 2 points to be valid. Found {v}")
761761
if v['start'] < 0:
762762
raise ValueError(f"Text location must be positive. Found {v}")
763-
if v['start'] >= v['end']:
763+
if v['start'] > v['end']:
764764
raise ValueError(
765-
f"Text start location must be less than end. Found {v}")
765+
f"Text start location must be less or equal than end. Found {v}")
766766
return v
767767

768768

0 commit comments

Comments
 (0)