Skip to content

Commit 99c8196

Browse files
authored
fix: deterministic ordering (#135)
Updated ordering method to rely on upper-left x-coordinate in case of a y-coordinate tie.
1 parent bd61292 commit 99c8196

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.5.4
2+
3+
* Tweak to element ordering to make it more deterministic
4+
15
## 0.5.3
26

37
* Refactor for large model
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.5.3" # pragma: no cover
1+
__version__ = "0.5.4" # pragma: no cover

unstructured_inference/inference/ordering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def order_layout(
2727
if len(layout) == 0:
2828
return []
2929

30-
layout.sort(key=lambda element: element.y1)
30+
layout.sort(key=lambda element: (element.y1, element.x1, element.y2, element.x2))
3131
# NOTE(alan): Temporarily revert to orginal logic pending fixing the new logic
3232
# See code prior to this commit for new logic.
3333
return layout

0 commit comments

Comments
 (0)