mirror of
https://github.com/DS4SD/docling.git
synced 2025-08-02 07:22:14 +00:00
chore: rewrite cumbersome dictionary checking
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
8f79e95e74
commit
bdeeb74534
@ -209,23 +209,16 @@ class TableStructureModel(BasePageModel):
|
|||||||
tc.bbox = tc.bbox.scaled(1 / self.scale)
|
tc.bbox = tc.bbox.scaled(1 / self.scale)
|
||||||
table_cells.append(tc)
|
table_cells.append(tc)
|
||||||
|
|
||||||
|
assert "predict_details" in table_out
|
||||||
|
|
||||||
# Retrieving cols/rows, after post processing:
|
# Retrieving cols/rows, after post processing:
|
||||||
num_rows = 0
|
num_rows = table_out["predict_details"].get("num_rows", 0)
|
||||||
num_cols = 0
|
num_cols = table_out["predict_details"].get("num_cols", 0)
|
||||||
otsl_seq = []
|
otsl_seq = (
|
||||||
if "predict_details" in table_out:
|
table_out["predict_details"]
|
||||||
if "num_rows" in table_out["predict_details"]:
|
.get("prediction", {})
|
||||||
num_rows = table_out["predict_details"]["num_rows"]
|
.get("rs_seq", [])
|
||||||
if "num_cols" in table_out["predict_details"]:
|
)
|
||||||
num_cols = table_out["predict_details"]["num_cols"]
|
|
||||||
if "prediction" in table_out["predict_details"]:
|
|
||||||
if (
|
|
||||||
"rs_seq"
|
|
||||||
in table_out["predict_details"]["prediction"]
|
|
||||||
):
|
|
||||||
otsl_seq = table_out["predict_details"][
|
|
||||||
"prediction"
|
|
||||||
]["rs_seq"]
|
|
||||||
|
|
||||||
tbl = Table(
|
tbl = Table(
|
||||||
otsl_seq=otsl_seq,
|
otsl_seq=otsl_seq,
|
||||||
|
Loading…
Reference in New Issue
Block a user