@@ -332,31 +332,30 @@ def get_seg_flag(block, prev_block):
332
332
prev_block_bbox = prev_block ["block_bbox" ]
333
333
num_of_prev_lines = prev_block .get ("num_of_lines" )
334
334
pre_block_seg_end_coordinate = prev_block .get ("seg_end_coordinate" )
335
+ prev_end_space_small = (
336
+ prev_block_bbox [2 ] - pre_block_seg_end_coordinate < 10
337
+ )
338
+ prev_lines_more_than_one = num_of_prev_lines > 1
339
+
340
+ overlap_blocks = context_left_coordinate < prev_block_bbox [2 ]
335
341
336
342
# update context_left_coordinate and context_right_coordinate
337
- if context_left_coordinate < prev_block_bbox [ 2 ] :
343
+ if overlap_blocks :
338
344
context_left_coordinate = min (
339
345
prev_block_bbox [0 ], context_left_coordinate
340
346
)
341
347
context_right_coordinate = max (
342
348
prev_block_bbox [2 ], context_right_coordinate
343
349
)
350
+ prev_end_space_small = (
351
+ context_right_coordinate - pre_block_seg_end_coordinate < 10
352
+ )
344
353
345
- # 判断是否需要分段
346
- prev_end_space_small = (
347
- prev_block_bbox [2 ] - pre_block_seg_end_coordinate < 10
348
- )
349
354
current_start_space_small = (
350
355
seg_start_coordinate - context_left_coordinate < 10
351
356
)
352
- overlap_blocks = context_left_coordinate < prev_block_bbox [2 ]
353
- prev_lines_more_than_one = num_of_prev_lines > 1
354
357
355
358
if (
356
- overlap_blocks
357
- and current_start_space_small
358
- and prev_lines_more_than_one
359
- ) or (
360
359
prev_end_space_small
361
360
and current_start_space_small
362
361
and prev_lines_more_than_one
0 commit comments