Remove jtol
parent
439059817d
commit
757ba0444a
|
|
@ -44,10 +44,6 @@ class Lattice:
|
|||
Scaling factor. Large scaling factor leads to smaller lines
|
||||
being detected. (optional, default: 15)
|
||||
|
||||
jtol : int
|
||||
Tolerance to account for when comparing joint and line
|
||||
coordinates. (optional, default: 2)
|
||||
|
||||
mtol : int
|
||||
Tolerance to account for when merging lines which are
|
||||
very close. (optional, default: 2)
|
||||
|
|
@ -66,13 +62,12 @@ class Lattice:
|
|||
Dictionary with page number as key and list of tables on that
|
||||
page as value.
|
||||
"""
|
||||
def __init__(self, table_area=None, fill=None, jtol=[2], mtol=[2], scale=15,
|
||||
def __init__(self, table_area=None, fill=None, mtol=[2], scale=15,
|
||||
invert=False, margins=(2.0, 0.5, 0.1), debug=None):
|
||||
|
||||
self.method = 'lattice'
|
||||
self.table_area = table_area
|
||||
self.fill = fill
|
||||
self.jtol = jtol
|
||||
self.mtol = mtol
|
||||
self.scale = scale
|
||||
self.invert = invert
|
||||
|
|
@ -135,8 +130,6 @@ class Lattice:
|
|||
contours = find_table_contours(vmask, hmask)
|
||||
table_bbox = find_table_joints(contours, vmask, hmask)
|
||||
|
||||
if len(self.jtol) == 1 and self.jtol[0] == 2:
|
||||
self.jtol = self.jtol * len(table_bbox)
|
||||
if len(self.mtol) == 1 and self.mtol[0] == 2:
|
||||
self.mtol = self.mtol * len(table_bbox)
|
||||
|
||||
|
|
@ -176,7 +169,7 @@ class Lattice:
|
|||
for i in range(0, len(rows) - 1)]
|
||||
table = Table(cols, rows)
|
||||
# set table edges to True using ver+hor lines
|
||||
table = table.set_edges(v_s, h_s, jtol=self.jtol[table_no])
|
||||
table = table.set_edges(v_s, h_s)
|
||||
nouse = table.nocont_ / (len(v_s) + len(h_s))
|
||||
table_data['line_p'] = 100 * (1 - nouse)
|
||||
# set spanning cells to True
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class Pdf:
|
|||
def debug_plot(self):
|
||||
"""Plots all text objects and various pdf geometries so that
|
||||
user can choose number of columns, columns x-coordinates for
|
||||
Stream or tweak Lattice parameters (scale, jtol, mtol).
|
||||
Stream or tweak Lattice parameters (mtol, scale).
|
||||
"""
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.patches as patches
|
||||
|
|
|
|||
|
|
@ -55,15 +55,13 @@ lattice_doc = """
|
|||
Lattice method looks for lines between text to form a table.
|
||||
|
||||
usage:
|
||||
camelot lattice [-t <tarea>...] [-F <fill>...] [-j <jtol>...]
|
||||
camelot lattice [-t <tarea>...] [-F <fill>...]
|
||||
[-m <mtol>...] [options] [--] <file>
|
||||
|
||||
options:
|
||||
-t, --tarea <tarea> Specific table areas to analyze.
|
||||
-F, --fill <fill> Fill data in horizontal and/or vertical spanning
|
||||
cells. Example: -F h, -F v, -F hv
|
||||
-j, --jtol <jtol> Tolerance to account for when comparing joint
|
||||
and line coordinates. [default: 2]
|
||||
-m, --mtol <mtol> Tolerance to account for when merging lines
|
||||
which are very close. [default: 2]
|
||||
-s, --scale <scale> Scaling factor. Large scaling factor leads to
|
||||
|
|
@ -341,9 +339,8 @@ if __name__ == '__main__':
|
|||
try:
|
||||
tarea = args['--tarea'] if args['--tarea'] else None
|
||||
fill = args['--fill'] if args['--fill'] else None
|
||||
jtol = [int(j) for j in args['--jtol']]
|
||||
mtol = [int(m) for m in args['--mtol']]
|
||||
manager = Pdf(Lattice(table_area=tarea, fill=fill, jtol=jtol,
|
||||
manager = Pdf(Lattice(table_area=tarea, fill=fill,
|
||||
mtol=mtol, scale=int(args['--scale']),
|
||||
invert=args['--invert'], margins=margins,
|
||||
debug=args['--debug']),
|
||||
|
|
|
|||
Loading…
Reference in New Issue