Sfoglia il codice sorgente

refactor(pdf_parse): uncomment char bbox validation logic

- Restore commented code for filtering out characters with invalid bounding boxes
- This change may affect the filtering of unnecessary characters in PDF parsing
myhloli 10 mesi fa
parent
commit
1d08865f4a
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      magic_pdf/pdf_parse_union_core_v2.py

+ 4 - 3
magic_pdf/pdf_parse_union_core_v2.py

@@ -118,9 +118,10 @@ def fill_char_in_spans(spans, all_chars):
 
     for char in all_chars:
         # 跳过非法bbox的char
-        x1, y1, x2, y2 = char['bbox']
-        if abs(x1 - x2) <= 0.01 or abs(y1 - y2) <= 0.01:
-            continue
+        # x1, y1, x2, y2 = char['bbox']
+        # if abs(x1 - x2) <= 0.01 or abs(y1 - y2) <= 0.01:
+        #     continue
+
         for span in spans:
             if calculate_char_in_span(char['bbox'], span['bbox'], char['c']):
                 span['chars'].append(char)