Yaz Hobooti commited on
Commit
0b957fa
·
1 Parent(s): 6eab7c3

Fix Box constructor parameter names in text-based spell checking

Browse files

- Changed from top/left/bottom/right to y1/x1/y2/x2 parameters
- Box class expects (y1, x1, y2, x2, area) constructor arguments
- Fixed both coordinate mapping and fallback placeholder boxes

Files changed (1) hide show
  1. pdf_comparator.py +8 -8
pdf_comparator.py CHANGED
@@ -389,10 +389,10 @@ def find_misspell_boxes_from_text(
389
  if has_misspelling:
390
  bbox = span["bbox"] # [x0, y0, x1, y1]
391
  boxes.append(Box(
392
- top=bbox[1], # y0
393
- left=bbox[0], # x0
394
- bottom=bbox[3], # y1
395
- right=bbox[2], # x1
396
  area=(bbox[2] - bbox[0]) * (bbox[3] - bbox[1])
397
  ))
398
 
@@ -411,10 +411,10 @@ def find_misspell_boxes_from_text(
411
  if misspelled_words:
412
  # Create a placeholder box for the page
413
  boxes.append(Box(
414
- top=page_num * 1000,
415
- left=0,
416
- bottom=(page_num + 1) * 1000,
417
- right=800,
418
  area=800 * 1000
419
  ))
420
 
 
389
  if has_misspelling:
390
  bbox = span["bbox"] # [x0, y0, x1, y1]
391
  boxes.append(Box(
392
+ y1=bbox[1], # y0
393
+ x1=bbox[0], # x0
394
+ y2=bbox[3], # y1
395
+ x2=bbox[2], # x1
396
  area=(bbox[2] - bbox[0]) * (bbox[3] - bbox[1])
397
  ))
398
 
 
411
  if misspelled_words:
412
  # Create a placeholder box for the page
413
  boxes.append(Box(
414
+ y1=page_num * 1000,
415
+ x1=0,
416
+ y2=(page_num + 1) * 1000,
417
+ x2=800,
418
  area=800 * 1000
419
  ))
420