-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
137 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from pathlib import Path | ||
|
||
from docling.backend.docling_parse_backend import DoclingParseDocumentBackend | ||
from docling.datamodel.base_models import InputFormat | ||
from docling.datamodel.pipeline_options import ( | ||
EasyOcrOptions, | ||
PdfPipelineOptions, | ||
TesseractCliOcrOptions, | ||
TesseractOcrOptions, | ||
) | ||
from docling.document_converter import DocumentConverter, PdfFormatOption | ||
|
||
|
||
def main(): | ||
input_doc = Path("./tests/data/2206.01062.pdf") | ||
|
||
pipeline_options = PdfPipelineOptions() | ||
pipeline_options.do_ocr = True | ||
pipeline_options.do_table_structure = True | ||
pipeline_options.table_structure_options.do_cell_matching = True | ||
|
||
# Any of the OCR options can be used:EasyOcrOptions, TesseractOcrOptions, TesseractCliOcrOptions | ||
# ocr_options = EasyOcrOptions(force_full_page_ocr=True) | ||
# ocr_options = TesseractOcrOptions(force_full_page_ocr=True) | ||
ocr_options = TesseractCliOcrOptions(force_full_page_ocr=True) | ||
pipeline_options.ocr_options = ocr_options | ||
|
||
converter = DocumentConverter( | ||
format_options={ | ||
InputFormat.PDF: PdfFormatOption( | ||
pipeline_options=pipeline_options, | ||
) | ||
} | ||
) | ||
|
||
doc = converter.convert(input_doc).document | ||
md = doc.export_to_markdown() | ||
print(md) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Get started | ||
|
||
Docling is used by the [Data Prep Kit \[↗\]](https://ibm.github.io/data-prep-kit/) open-source toolkit for preparing unstructured data for LLM application development ranging from laptop scale to datacenter scale. | ||
|
||
Below you find the Data Prep Kit modules powered by Docling. | ||
|
||
## PDF ingestion to Parquet | ||
- 💻 [GitHub \[↗\]](https://github.com/IBM/data-prep-kit/tree/dev/transforms/language/pdf2parquet) | ||
- 📖 [API docs \[↗\]](https://ibm.github.io/data-prep-kit/transforms/language/pdf2parquet/python/) | ||
|
||
## Document chunking | ||
- 💻 [GitHub \[↗\]](https://github.com/IBM/data-prep-kit/tree/dev/transforms/language/doc_chunk) | ||
- 📖 [API docs \[↗\]](https://ibm.github.io/data-prep-kit/transforms/language/doc_chunk/python/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "docling" | ||
version = "2.4.2" # DO NOT EDIT, updated automatically | ||
version = "2.5.0" # DO NOT EDIT, updated automatically | ||
description = "SDK and CLI for parsing PDF, DOCX, HTML, and more, to a unified document representation for powering downstream workflows such as gen AI applications." | ||
authors = ["Christoph Auer <[email protected]>", "Michele Dolfi <[email protected]>", "Maxim Lysak <[email protected]>", "Nikos Livathinos <[email protected]>", "Ahmed Nassar <[email protected]>", "Panos Vagenas <[email protected]>", "Peter Staar <[email protected]>"] | ||
license = "MIT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.