Update validation list

add-ocr
Vinayak Mehta 2020-11-18 18:51:09 +05:30
parent 674b5f4336
commit 0183f8f462
No known key found for this signature in database
GPG Key ID: 2170CDB940114C1D
3 changed files with 6 additions and 5 deletions

View File

@ -211,7 +211,7 @@ class Lattice(BaseParser):
from ..ext.ghostscript import Ghostscript from ..ext.ghostscript import Ghostscript
self.imagename = "".join([self.rootname, ".png"]) self.imagename = "".join([self.rootname, ".png"])
gs_call = "-q -sDEVICE=png16m -o {} -r300 {}".format( gs_call = "-q -sDEVICE=png16m -o {} -r900 {}".format(
self.imagename, self.filename self.imagename, self.filename
) )
gs_call = gs_call.encode().split() gs_call = gs_call.encode().split()
@ -329,6 +329,7 @@ class Lattice(BaseParser):
table = Table(cols, rows) table = Table(cols, rows)
# set table edges to True using ver+hor lines # set table edges to True using ver+hor lines
table = table.set_edges(v_s, h_s, joint_tol=self.joint_tol) table = table.set_edges(v_s, h_s, joint_tol=self.joint_tol)
# set table border edges to True # set table border edges to True
table = table.set_border() table = table.set_border()

View File

@ -93,7 +93,6 @@ def download_url(url):
return filepath return filepath
stream_kwargs = ["columns", "edge_tol", "row_tol", "column_tol"]
lattice_kwargs = [ lattice_kwargs = [
"process_background", "process_background",
"line_scale", "line_scale",
@ -106,6 +105,7 @@ lattice_kwargs = [
"iterations", "iterations",
"resolution", "resolution",
] ]
stream_kwargs = ["columns", "edge_tol", "row_tol", "column_tol"]
def validate_input(kwargs, flavor="lattice"): def validate_input(kwargs, flavor="lattice"):
@ -116,14 +116,14 @@ def validate_input(kwargs, flavor="lattice"):
f"{','.join(sorted(isec))} cannot be used with flavor='{flavor}'" f"{','.join(sorted(isec))} cannot be used with flavor='{flavor}'"
) )
if flavor == "lattice": if flavor in ["lattice", "lattice_ocr"]:
check_intersection(stream_kwargs, kwargs) check_intersection(stream_kwargs, kwargs)
else: else:
check_intersection(lattice_kwargs, kwargs) check_intersection(lattice_kwargs, kwargs)
def remove_extra(kwargs, flavor="lattice"): def remove_extra(kwargs, flavor="lattice"):
if flavor == "lattice": if flavor in ["lattice", "lattice_ocr"]:
for key in kwargs.keys(): for key in kwargs.keys():
if key in stream_kwargs: if key in stream_kwargs:
kwargs.pop(key) kwargs.pop(key)