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

return text elements #129

Closed
Closed
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
7 changes: 5 additions & 2 deletions marker/convert.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import warnings

from marker.schema.merged import FullyMergedBlock

warnings.filterwarnings("ignore", category=UserWarning) # Filter torch pytree user warnings

import pypdfium2 as pdfium
Expand Down Expand Up @@ -37,7 +40,7 @@ def convert_single_pdf(
metadata: Optional[Dict]=None,
langs: Optional[List[str]] = None,
batch_multiplier: int = 1
) -> Tuple[str, Dict[str, Image.Image], Dict]:
) -> Tuple[str, Dict[str, Image.Image], Dict, List[FullyMergedBlock]]:
# Set language needed for OCR
if langs is None:
langs = [settings.DEFAULT_LANG]
Expand Down Expand Up @@ -159,4 +162,4 @@ def convert_single_pdf(
out_meta["postprocess_stats"] = {"edit": edit_stats}
doc_images = images_to_dict(pages)

return full_text, doc_images, out_meta
return full_text, doc_images, out_meta, text_blocks
Loading