remove nested list for figure detection response
This commit is contained in:
parent
954c2f17a5
commit
20267f2715
@ -1,6 +1,6 @@
|
||||
from operator import truth
|
||||
|
||||
from funcy import lmap
|
||||
from funcy import lmap, flatten
|
||||
|
||||
from cv_analysis.figure_detection.figure_detection import detect_figures
|
||||
from cv_analysis.table_parsing import parse_tables
|
||||
@ -32,7 +32,7 @@ def make_analysis_pipeline(analysis_fn, formatter, dpi):
|
||||
pages = convert_pages_to_images(pdf, index=index, dpi=dpi)
|
||||
results = map(parse_page, pages)
|
||||
|
||||
yield from filter(truth, results)
|
||||
yield from flatten(filter(truth, results))
|
||||
|
||||
return analyse_pipeline
|
||||
|
||||
|
||||
@ -35,20 +35,18 @@ def expected_formatted_analysis_result(operation):
|
||||
]
|
||||
if operation == "figure":
|
||||
return [
|
||||
[
|
||||
{
|
||||
"pageInfo": {
|
||||
"pageNumber": 0,
|
||||
"pageRotation": 0,
|
||||
"pageWidth": 595.0,
|
||||
"pageHeight": 842.0,
|
||||
"deRotationMatrix": (1.0, -0.0, -0.0, 1.0, 0.0, 0.0),
|
||||
"transformationMatrix": (1.0, 0.0, 0.0, -1.0, -0.0, 842.0),
|
||||
},
|
||||
"boundingBox": {"x0": 0.0, "y0": 0.0, "x1": 15.12, "y1": 15.12, "width": 15.12, "height": 15.12},
|
||||
"alpha": False,
|
||||
}
|
||||
]
|
||||
{
|
||||
"pageInfo": {
|
||||
"pageNumber": 0,
|
||||
"pageRotation": 0,
|
||||
"pageWidth": 595.0,
|
||||
"pageHeight": 842.0,
|
||||
"deRotationMatrix": (1.0, -0.0, -0.0, 1.0, 0.0, 0.0),
|
||||
"transformationMatrix": (1.0, 0.0, 0.0, -1.0, -0.0, 842.0),
|
||||
},
|
||||
"boundingBox": {"x0": 0.0, "y0": 0.0, "x1": 15.12, "y1": 15.12, "width": 15.12, "height": 15.12},
|
||||
"alpha": False,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user