Add textedge plot type

This commit is contained in:
Vinayak Mehta
2018-12-12 07:36:07 +05:30
parent 451fac9e53
commit 87a2f4fdc9
4 changed files with 75 additions and 6 deletions
+1
View File
@@ -341,6 +341,7 @@ class Lattice(BaseParser):
table._text = _text
table._image = (self.image, self.table_bbox_unscaled)
table._segments = (self.vertical_segments, self.horizontal_segments)
table._textedges = None
return table
+3
View File
@@ -263,6 +263,7 @@ class Stream(BaseParser):
textedges.generate(textlines)
# select relevant edges
relevant_textedges = textedges.get_relevant()
self.textedges.extend(relevant_textedges)
# guess table areas using textlines and relevant edges
table_bbox = textedges.get_table_areas(textlines, relevant_textedges)
# treat whole page as table area if no table areas found
@@ -272,6 +273,7 @@ class Stream(BaseParser):
return table_bbox
def _generate_table_bbox(self):
self.textedges = []
if self.table_areas is not None:
table_bbox = {}
for area in self.table_areas:
@@ -378,6 +380,7 @@ class Stream(BaseParser):
table._text = _text
table._image = None
table._segments = None
table._textedges = self.textedges
return table