Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync #1588

Closed
wants to merge 3 commits into from
Closed

sync #1588

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ debug_utils/
_build/


output/
output/
/magic_pdf.egg-info/
4 changes: 3 additions & 1 deletion magic_pdf/dict2md/ocr_mkcontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ def merge_para_with_text(para_block):
block_lang = detect_lang(block_text)

para_text = ''
last_line_content = ''
for i, line in enumerate(para_block['lines']):

if i >= 1 and line.get(ListLineTag.IS_LIST_START_LINE, False):
if i >= 1 and (line.get(ListLineTag.IS_LIST_START_LINE, False) or len(last_line_content) < 20):
para_text += ' \n'

for j, span in enumerate(line['spans']):
Expand All @@ -152,6 +153,7 @@ def merge_para_with_text(para_block):
content = f"\n$$\n{span['content']}\n$$\n"

content = content.strip()
last_line_content = re.sub(r'\s+', '', content)

if content:
langs = ['zh', 'ja', 'ko']
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ PyMuPDF>=1.24.9
scikit-learn>=1.0.2
torch>=2.2.2
transformers
pdfminer.six==20231228
pdfminer.six
# The requirements.txt must ensure that only necessary external dependencies are introduced. If there are new dependencies to add, please contact the project administrator.
3 changes: 0 additions & 3 deletions scripts/download_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ def download_and_modify_json(url, local_filename, modifications):
"models/Layout/LayoutLMv3/*",
"models/Layout/YOLO/*",
"models/MFD/YOLO/*",
"models/MFR/unimernet_small/*",
"models/TabRec/TableMaster/*",
"models/TabRec/StructEqTable/*",
]
model_dir = snapshot_download('opendatalab/PDF-Extract-Kit-1.0', allow_patterns=mineru_patterns)
layoutreader_model_dir = snapshot_download('ppaanngggg/layoutreader')
Expand Down
Loading