Add parsing_report property
parent
9124e3374c
commit
73e52939f5
|
|
@ -1,3 +1,5 @@
|
||||||
|
import json
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -277,6 +279,17 @@ class Table(object):
|
||||||
def page(self, p):
|
def page(self, p):
|
||||||
self._page = p
|
self._page = p
|
||||||
|
|
||||||
|
@property
|
||||||
|
def parsing_report(self):
|
||||||
|
# pretty?
|
||||||
|
report = {
|
||||||
|
'accuracy': self._accuracy,
|
||||||
|
'whitespace': self._whitespace,
|
||||||
|
'order': self._order,
|
||||||
|
'page': self._page
|
||||||
|
}
|
||||||
|
return report
|
||||||
|
|
||||||
|
|
||||||
class TableList(list):
|
class TableList(list):
|
||||||
def __init__(self, tables):
|
def __init__(self, tables):
|
||||||
|
|
@ -286,6 +299,12 @@ class TableList(list):
|
||||||
return '<{} tables={}>'.format(
|
return '<{} tables={}>'.format(
|
||||||
self.__class__.__name__, len(self._tables))
|
self.__class__.__name__, len(self._tables))
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self._tables)
|
||||||
|
|
||||||
|
def __getitem__(self, idx):
|
||||||
|
return self._tables[idx]
|
||||||
|
|
||||||
|
|
||||||
class Geometry(object):
|
class Geometry(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ class Stream:
|
||||||
table.accuracy = accuracy
|
table.accuracy = accuracy
|
||||||
table.whitespace = whitespace
|
table.whitespace = whitespace
|
||||||
table.order = table_no + 1
|
table.order = table_no + 1
|
||||||
table.page = os.path.basename(bname).replace('page-', '')
|
table.page = int(os.path.basename(bname).replace('page-', ''))
|
||||||
|
|
||||||
_tables.append(table)
|
_tables.append(table)
|
||||||
|
|
||||||
|
|
@ -462,7 +462,7 @@ class Lattice:
|
||||||
table.accuracy = accuracy
|
table.accuracy = accuracy
|
||||||
table.whitespace = whitespace
|
table.whitespace = whitespace
|
||||||
table.order = table_no + 1
|
table.order = table_no + 1
|
||||||
table.page = os.path.basename(bname).replace('page-', '')
|
table.page = int(os.path.basename(bname).replace('page-', ''))
|
||||||
|
|
||||||
_tables.append(table)
|
_tables.append(table)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue