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

update: change pdf text parser to pymupdf4llm #139

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies = [
"pandas",
"openpyxl",
"pdfminer.six",
"pymupdf4llm",
"puremagic",
"pydub",
"youtube-transcript-api",
Expand Down
11 changes: 7 additions & 4 deletions src/markitdown/_markitdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import pandas as pd
import pdfminer
import pdfminer.high_level
import pymupdf4llm
import pptx

# File-format detection
Expand Down Expand Up @@ -684,10 +685,12 @@ def convert(self, local_path, **kwargs) -> Union[None, DocumentConverterResult]:
if extension.lower() != ".pdf":
return None

return DocumentConverterResult(
title=None,
text_content=pdfminer.high_level.extract_text(local_path),
)
# return DocumentConverterResult(
# title=None,
# text_content=pdfminer.high_level.extract_text(local_path),
# )
text_content = pymupdf4llm.to_markdown(local_path, show_progress=False)
return DocumentConverterResult(title=None, text_content=text_content)


class DocxConverter(HtmlConverter):
Expand Down