File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ def get_text_and_words(
139
139
final_text = add_id_to_html_tag (config .list_layout_prefix , self .id , config )
140
140
final_words = []
141
141
for i , child in enumerate (
142
- sorted (self .children , key = lambda x : x .reading_order )
142
+ sorted (filter ( lambda c : isinstance ( c , Layout ), self .children ) , key = lambda x : x .reading_order )
143
143
):
144
144
child_text , child_words = child .get_text_and_words (config )
145
145
child_prefix = add_id_to_html_tag (config .list_element_prefix , child .id , config )
Original file line number Diff line number Diff line change @@ -1363,15 +1363,15 @@ def parse_document_api_response(response: dict) -> Document:
1363
1363
# Using the kv_added returned by _create_table_objects, we try to match the remaining KVs
1364
1364
# to existing layout elements.
1365
1365
for layout in sorted (page .layouts , key = lambda x : x .bbox .y ):
1366
- if layout .layout_type == LAYOUT_ENTITY :
1366
+ if layout .layout_type in LAYOUT_ENTITY :
1367
1367
continue
1368
1368
for kv in sorted (key_values , key = lambda x : x .bbox .y ):
1369
1369
if (
1370
1370
layout .bbox .get_intersection (kv .bbox ).area > THRESHOLD * kv .bbox .area
1371
1371
and kv .id not in kv_added
1372
1372
):
1373
1373
# Ignore if the KV is already overlapping with a table
1374
- if any ([w .cell_id for w in kv .words ]):
1374
+ if any ([w .cell_id for w in kv .words ]) or layout . layout_type == LAYOUT_LIST :
1375
1375
kv_added .add (kv .id )
1376
1376
continue
1377
1377
# Removing the duplicate words
You can’t perform that action at this time.
0 commit comments