Skip to content

Commit 03af14e

Browse files
committed
Add note about single element slicing behavior
1 parent bc8b5aa commit 03af14e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

unstructured_inference/inference/elements.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ def __getitem__(self, indices) -> TextRegions:
250250

251251
def slice(self, indices) -> TextRegions:
252252
"""slice text regions based on indices"""
253+
# NOTE(alan): I would expect if I try to access a single element, it should return a
254+
# TextRegion, not a TextRegions. Currently, you get an error when trying to access a single
255+
# element.
253256
return TextRegions(
254257
element_coords=self.element_coords[indices],
255258
texts=self.texts[indices],

0 commit comments

Comments
 (0)