From 33cea4534683bdc77cd49348b5e650bdb68a9ad0 Mon Sep 17 00:00:00 2001 From: Vinayak Mehta Date: Thu, 13 Dec 2018 00:45:22 +0530 Subject: [PATCH] Fix #105 --- camelot/parsers/lattice.py | 4 ++-- camelot/parsers/stream.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/camelot/parsers/lattice.py b/camelot/parsers/lattice.py index cca6789..14430c8 100644 --- a/camelot/parsers/lattice.py +++ b/camelot/parsers/lattice.py @@ -273,8 +273,8 @@ class Lattice(BaseParser): t_bbox['vertical'] = text_in_bbox(tk, self.vertical_text) self.t_bbox = t_bbox - for direction in t_bbox: - t_bbox[direction].sort(key=lambda x: (-x.y0, x.x0)) + for direction in self.t_bbox: + self.t_bbox[direction].sort(key=lambda x: (x.x0, -x.y0)) cols, rows = zip(*self.table_bbox[tk]) cols, rows = list(cols), list(rows) diff --git a/camelot/parsers/stream.py b/camelot/parsers/stream.py index 0fbae71..d9481cc 100644 --- a/camelot/parsers/stream.py +++ b/camelot/parsers/stream.py @@ -296,7 +296,7 @@ class Stream(BaseParser): self.t_bbox = t_bbox for direction in self.t_bbox: - self.t_bbox[direction].sort(key=lambda x: (-x.y0, x.x0)) + self.t_bbox[direction].sort(key=lambda x: (x.x0, -x.y0)) text_x_min, text_y_min, text_x_max, text_y_max = self._text_bbox(self.t_bbox) rows_grouped = self._group_rows(self.t_bbox['horizontal'], row_close_tol=self.row_close_tol)