소스 검색

fix pdf_parser content confusion (#1458)

### What problem does this PR solve?

#1407 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.9.0
H 1 년 전
부모
커밋
dbb8f7b77b
No account linked to committer's email address
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13
    0
      deepdoc/parser/pdf_parser.py

+ 13
- 0
deepdoc/parser/pdf_parser.py 파일 보기

self.mean_height[-1] / 3 self.mean_height[-1] / 3
) )


# solve char content confusion
record_error_length = 0
for c in chars[0:128]:
ii = Recognizer.find_overlapped(c, bxs)
if ii is None:
continue
record_error_length += abs((bxs[ii]["bottom"] + bxs[ii]["bottom"] - c["bottom"] - c["top"]) / 2)

record_error_length = record_error_length / 128
for char in chars:
char["top"] -= record_error_length
char["bottom"] -= record_error_length
# merge chars in the same rect # merge chars in the same rect
for c in Recognizer.sort_X_firstly( for c in Recognizer.sort_X_firstly(
chars, self.mean_width[pagenum - 1] // 4): chars, self.mean_width[pagenum - 1] // 4):

Loading…
취소
저장