docling-core 2.32.0__tar.gz → 2.51.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docling_core-2.51.1/PKG-INFO +160 -0
- docling_core-2.51.1/README.md +99 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/cli/view.py +21 -5
- docling_core-2.51.1/docling_core/transforms/chunker/__init__.py +24 -0
- docling_core-2.51.1/docling_core/transforms/chunker/code_chunking/__init__.py +1 -0
- docling_core-2.51.1/docling_core/transforms/chunker/code_chunking/_language_code_chunkers.py +1664 -0
- docling_core-2.51.1/docling_core/transforms/chunker/code_chunking/_utils.py +152 -0
- docling_core-2.51.1/docling_core/transforms/chunker/code_chunking/base_code_chunking_strategy.py +22 -0
- docling_core-2.51.1/docling_core/transforms/chunker/code_chunking/code_chunk.py +43 -0
- docling_core-2.51.1/docling_core/transforms/chunker/code_chunking/standard_code_chunking_strategy.py +95 -0
- docling_core-2.51.1/docling_core/transforms/chunker/doc_chunk.py +92 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/hierarchical_chunker.py +27 -88
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/hybrid_chunker.py +7 -4
- docling_core-2.51.1/docling_core/transforms/chunker/page_chunker.py +59 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/base.py +77 -3
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/common.py +250 -104
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/doctags.py +157 -44
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/html.py +285 -128
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/markdown.py +328 -64
- docling_core-2.51.1/docling_core/transforms/visualizer/key_value_visualizer.py +217 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/visualizer/layout_visualizer.py +11 -4
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/visualizer/reading_order_visualizer.py +77 -6
- docling_core-2.51.1/docling_core/transforms/visualizer/table_visualizer.py +240 -0
- docling_core-2.51.1/docling_core/types/doc/__init__.py +98 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/doc/base.py +67 -2
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/doc/document.py +2448 -447
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/doc/labels.py +8 -3
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/doc/page.py +29 -4
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/doc/tokens.py +6 -0
- docling_core-2.51.1/docling_core/types/doc/utils.py +282 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/file.py +27 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/legacy.py +2 -3
- docling_core-2.51.1/docling_core.egg-info/PKG-INFO +160 -0
- docling_core-2.51.1/docling_core.egg-info/SOURCES.txt +118 -0
- docling_core-2.51.1/docling_core.egg-info/dependency_links.txt +1 -0
- docling_core-2.51.1/docling_core.egg-info/entry_points.txt +2 -0
- docling_core-2.51.1/docling_core.egg-info/requires.txt +30 -0
- docling_core-2.51.1/docling_core.egg-info/top_level.txt +1 -0
- docling_core-2.51.1/pyproject.toml +187 -0
- docling_core-2.51.1/setup.cfg +4 -0
- docling_core-2.51.1/test/test_base.py +295 -0
- docling_core-2.51.1/test/test_code_chunker.py +189 -0
- docling_core-2.51.1/test/test_code_chunking_strategy.py +210 -0
- docling_core-2.51.1/test/test_collection.py +158 -0
- docling_core-2.51.1/test/test_data_gen_flag.py +9 -0
- docling_core-2.51.1/test/test_doc_base.py +45 -0
- docling_core-2.51.1/test/test_doc_legacy_convert.py +40 -0
- docling_core-2.51.1/test/test_doc_schema.py +147 -0
- docling_core-2.51.1/test/test_doc_schema_extractor.py +31 -0
- docling_core-2.51.1/test/test_docling_doc.py +2366 -0
- docling_core-2.51.1/test/test_doctags_load.py +170 -0
- docling_core-2.51.1/test/test_hierarchical_chunker.py +73 -0
- docling_core-2.51.1/test/test_hybrid_chunker.py +384 -0
- docling_core-2.51.1/test/test_json_schema_to_search_mapper.py +106 -0
- docling_core-2.51.1/test/test_metadata.py +301 -0
- docling_core-2.51.1/test/test_nlp_qa.py +46 -0
- docling_core-2.51.1/test/test_otsl_table_export.py +284 -0
- docling_core-2.51.1/test/test_page.py +214 -0
- docling_core-2.51.1/test/test_page_chunker.py +36 -0
- docling_core-2.51.1/test/test_rec_schema.py +268 -0
- docling_core-2.51.1/test/test_search_meta.py +49 -0
- docling_core-2.51.1/test/test_serialization.py +587 -0
- docling_core-2.51.1/test/test_utils.py +94 -0
- docling_core-2.51.1/test/test_visualization.py +97 -0
- docling_core-2.32.0/PKG-INFO +0 -143
- docling_core-2.32.0/README.md +0 -97
- docling_core-2.32.0/docling_core/transforms/chunker/__init__.py +0 -13
- docling_core-2.32.0/docling_core/types/doc/__init__.py +0 -32
- docling_core-2.32.0/docling_core/types/doc/utils.py +0 -75
- docling_core-2.32.0/pyproject.toml +0 -168
- {docling_core-2.32.0 → docling_core-2.51.1}/LICENSE +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/cli/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/experimental/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/py.typed +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/doc/ANN.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/doc/DOC.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/doc/OCR-output.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/doc/RAW.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/generated/ccs_document_schema.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/generated/minimal_document_schema_flat.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/search/search_doc_mapping.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/resources/schemas/search/search_doc_mapping_v2.json +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/search/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/search/json_schema_to_search_mapper.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/search/mapping.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/search/meta.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/search/package.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/base.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/tokenizer/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/tokenizer/base.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/tokenizer/huggingface.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/chunker/tokenizer/openai.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/serializer/html_styles.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/visualizer/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/transforms/visualizer/base.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/base.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/gen/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/gen/generic.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/io/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/base.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/doc_ann.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/doc_ocr.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/doc_raw.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/document.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/legacy_doc/tokens.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/nlp/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/nlp/qa.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/nlp/qa_labels.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/attribute.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/base.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/predicate.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/record.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/statement.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/types/rec/subject.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/__init__.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/alias.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/generate_docs.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/generate_jsonschema.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/validate.py +0 -0
- {docling_core-2.32.0 → docling_core-2.51.1}/docling_core/utils/validators.py +0 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docling-core
|
|
3
|
+
Version: 2.51.1
|
|
4
|
+
Summary: A python library to define and validate data types in Docling.
|
|
5
|
+
Author-email: Cesar Berrospi Ramis <ceb@zurich.ibm.com>, Panos Vagenas <pva@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Christoph Auer <cau@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>
|
|
6
|
+
Maintainer-email: Panos Vagenas <pva@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Christoph Auer <cau@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>, Cesar Berrospi Ramis <ceb@zurich.ibm.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: homepage, https://github.com/docling-project
|
|
9
|
+
Project-URL: repository, https://github.com/docling-project/docling-core
|
|
10
|
+
Project-URL: issues, https://github.com/docling-project/docling-core/issues
|
|
11
|
+
Project-URL: changelog, https://github.com/docling-project/docling-core/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: docling,discovery,etl,information retrieval,analytics,database,database schema,schema,JSON
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Topic :: Database
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
29
|
+
Requires-Python: <4.0,>=3.9
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Requires-Dist: jsonschema<5.0.0,>=4.16.0
|
|
33
|
+
Requires-Dist: pydantic!=2.10.0,!=2.10.1,!=2.10.2,<3.0.0,>=2.6.0
|
|
34
|
+
Requires-Dist: jsonref<2.0.0,>=1.1.0
|
|
35
|
+
Requires-Dist: tabulate<0.10.0,>=0.9.0
|
|
36
|
+
Requires-Dist: pandas<3.0.0,>=2.1.4
|
|
37
|
+
Requires-Dist: pillow<13.0.0,>=10.0.0
|
|
38
|
+
Requires-Dist: pyyaml<7.0.0,>=5.1
|
|
39
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.12.2
|
|
40
|
+
Requires-Dist: typer<0.20.0,>=0.12.5
|
|
41
|
+
Requires-Dist: latex2mathml<4.0.0,>=3.77.0
|
|
42
|
+
Provides-Extra: chunking
|
|
43
|
+
Requires-Dist: semchunk<3.0.0,>=2.2.0; extra == "chunking"
|
|
44
|
+
Requires-Dist: tree-sitter<1.0.0,>=0.23.2; extra == "chunking"
|
|
45
|
+
Requires-Dist: tree-sitter-python<1.0.0,>=0.23.6; extra == "chunking"
|
|
46
|
+
Requires-Dist: tree-sitter-c<1.0.0,>=0.23.4; extra == "chunking"
|
|
47
|
+
Requires-Dist: tree-sitter-java<1.0.0,>=0.23.5; extra == "chunking"
|
|
48
|
+
Requires-Dist: tree-sitter-javascript<1.0.0,>=0.23.1; extra == "chunking"
|
|
49
|
+
Requires-Dist: tree-sitter-typescript<1.0.0,>=0.23.2; extra == "chunking"
|
|
50
|
+
Requires-Dist: transformers<5.0.0,>=4.34.0; extra == "chunking"
|
|
51
|
+
Provides-Extra: chunking-openai
|
|
52
|
+
Requires-Dist: semchunk<3.0.0,>=2.2.0; extra == "chunking-openai"
|
|
53
|
+
Requires-Dist: tree-sitter<1.0.0,>=0.23.2; extra == "chunking-openai"
|
|
54
|
+
Requires-Dist: tree-sitter-python<1.0.0,>=0.23.6; extra == "chunking-openai"
|
|
55
|
+
Requires-Dist: tree-sitter-c<1.0.0,>=0.23.4; extra == "chunking-openai"
|
|
56
|
+
Requires-Dist: tree-sitter-java<1.0.0,>=0.23.5; extra == "chunking-openai"
|
|
57
|
+
Requires-Dist: tree-sitter-javascript<1.0.0,>=0.23.1; extra == "chunking-openai"
|
|
58
|
+
Requires-Dist: tree-sitter-typescript<1.0.0,>=0.23.2; extra == "chunking-openai"
|
|
59
|
+
Requires-Dist: tiktoken<0.13.0,>=0.9.0; extra == "chunking-openai"
|
|
60
|
+
Dynamic: license-file
|
|
61
|
+
|
|
62
|
+
# Docling Core
|
|
63
|
+
|
|
64
|
+
[](https://pypi.org/project/docling-core/)
|
|
65
|
+

|
|
66
|
+
[](https://github.com/astral-sh/uv)
|
|
67
|
+
[](https://github.com/psf/black)
|
|
68
|
+
[](https://pycqa.github.io/isort/)
|
|
69
|
+
[](https://mypy-lang.org/)
|
|
70
|
+
[](https://pydantic.dev)
|
|
71
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
72
|
+
[](https://opensource.org/licenses/MIT)
|
|
73
|
+
|
|
74
|
+
Docling Core is a library that defines core data types and transformations in [Docling](https://github.com/docling-project/docling).
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
To use Docling Core, simply install `docling-core` from your package manager, e.g. pip:
|
|
79
|
+
```bash
|
|
80
|
+
pip install docling-core
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Development setup
|
|
84
|
+
|
|
85
|
+
To develop for Docling Core, you need Python 3.9 through 3.14 and the `uv` package. You can then install it from your local clone's root directory:
|
|
86
|
+
```bash
|
|
87
|
+
uv sync --all-extras
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
To run the pytest suite, execute:
|
|
91
|
+
```
|
|
92
|
+
uv run pytest -s test
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Main features
|
|
96
|
+
|
|
97
|
+
Docling Core provides the foundational DoclingDocument data model and API, as well as
|
|
98
|
+
additional APIs for tasks like serialization and chunking, which are key to developing
|
|
99
|
+
generative AI applications using Docling.
|
|
100
|
+
|
|
101
|
+
### DoclingDocument
|
|
102
|
+
|
|
103
|
+
Docling Core defines the DoclingDocument as a Pydantic model, allowing for advanced
|
|
104
|
+
data model control, customizability, and interoperability.
|
|
105
|
+
|
|
106
|
+
In addition to specifying the schema, it provides a handy API for building documents,
|
|
107
|
+
as well as for basic operations, e.g. exporting to various formats, like Markdown, HTML,
|
|
108
|
+
and others.
|
|
109
|
+
|
|
110
|
+
👉 More details:
|
|
111
|
+
- [Architecture docs](https://docling-project.github.io/docling/concepts/architecture/)
|
|
112
|
+
- [DoclingDocument docs](https://docling-project.github.io/docling/concepts/docling_document/)
|
|
113
|
+
|
|
114
|
+
### Serialization
|
|
115
|
+
|
|
116
|
+
Different users can have varying requirements when it comes to serialization.
|
|
117
|
+
To address this, the Serialization API introduces a design that allows easy extension,
|
|
118
|
+
while providing feature-rich built-in implementations (on which the respective
|
|
119
|
+
DoclingDocument helpers are actually based).
|
|
120
|
+
|
|
121
|
+
👉 More details:
|
|
122
|
+
- [Serialization docs](https://docling-project.github.io/docling/concepts/serialization/)
|
|
123
|
+
- [Serialization example](https://docling-project.github.io/docling/examples/serialization/)
|
|
124
|
+
|
|
125
|
+
### Chunking
|
|
126
|
+
|
|
127
|
+
Similarly to above, the Chunking API provides built-in chunking capabilities as well as
|
|
128
|
+
a design that enables easy extension, this way tackling customization requirements of
|
|
129
|
+
different use cases.
|
|
130
|
+
|
|
131
|
+
👉 More details:
|
|
132
|
+
- [Chunking docs](https://docling-project.github.io/docling/concepts/chunking/)
|
|
133
|
+
- [Hybrid chunking example](https://docling-project.github.io/docling/examples/hybrid_chunking/)
|
|
134
|
+
- [Advanced chunking and serialization](https://docling-project.github.io/docling/examples/advanced_chunking_and_serialization/)
|
|
135
|
+
|
|
136
|
+
## Contributing
|
|
137
|
+
|
|
138
|
+
Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
|
|
139
|
+
|
|
140
|
+
## References
|
|
141
|
+
|
|
142
|
+
If you use Docling Core in your projects, please consider citing the following:
|
|
143
|
+
|
|
144
|
+
```bib
|
|
145
|
+
@techreport{Docling,
|
|
146
|
+
author = "Deep Search Team",
|
|
147
|
+
month = 8,
|
|
148
|
+
title = "Docling Technical Report",
|
|
149
|
+
url = "https://arxiv.org/abs/2408.09869",
|
|
150
|
+
eprint = "2408.09869",
|
|
151
|
+
doi = "10.48550/arXiv.2408.09869",
|
|
152
|
+
version = "1.0.0",
|
|
153
|
+
year = 2024
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
The Docling Core codebase is under MIT license.
|
|
160
|
+
For individual model usage, please refer to the model licenses found in the original packages.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Docling Core
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/docling-core/)
|
|
4
|
+

|
|
5
|
+
[](https://github.com/astral-sh/uv)
|
|
6
|
+
[](https://github.com/psf/black)
|
|
7
|
+
[](https://pycqa.github.io/isort/)
|
|
8
|
+
[](https://mypy-lang.org/)
|
|
9
|
+
[](https://pydantic.dev)
|
|
10
|
+
[](https://github.com/pre-commit/pre-commit)
|
|
11
|
+
[](https://opensource.org/licenses/MIT)
|
|
12
|
+
|
|
13
|
+
Docling Core is a library that defines core data types and transformations in [Docling](https://github.com/docling-project/docling).
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
To use Docling Core, simply install `docling-core` from your package manager, e.g. pip:
|
|
18
|
+
```bash
|
|
19
|
+
pip install docling-core
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Development setup
|
|
23
|
+
|
|
24
|
+
To develop for Docling Core, you need Python 3.9 through 3.14 and the `uv` package. You can then install it from your local clone's root directory:
|
|
25
|
+
```bash
|
|
26
|
+
uv sync --all-extras
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To run the pytest suite, execute:
|
|
30
|
+
```
|
|
31
|
+
uv run pytest -s test
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Main features
|
|
35
|
+
|
|
36
|
+
Docling Core provides the foundational DoclingDocument data model and API, as well as
|
|
37
|
+
additional APIs for tasks like serialization and chunking, which are key to developing
|
|
38
|
+
generative AI applications using Docling.
|
|
39
|
+
|
|
40
|
+
### DoclingDocument
|
|
41
|
+
|
|
42
|
+
Docling Core defines the DoclingDocument as a Pydantic model, allowing for advanced
|
|
43
|
+
data model control, customizability, and interoperability.
|
|
44
|
+
|
|
45
|
+
In addition to specifying the schema, it provides a handy API for building documents,
|
|
46
|
+
as well as for basic operations, e.g. exporting to various formats, like Markdown, HTML,
|
|
47
|
+
and others.
|
|
48
|
+
|
|
49
|
+
👉 More details:
|
|
50
|
+
- [Architecture docs](https://docling-project.github.io/docling/concepts/architecture/)
|
|
51
|
+
- [DoclingDocument docs](https://docling-project.github.io/docling/concepts/docling_document/)
|
|
52
|
+
|
|
53
|
+
### Serialization
|
|
54
|
+
|
|
55
|
+
Different users can have varying requirements when it comes to serialization.
|
|
56
|
+
To address this, the Serialization API introduces a design that allows easy extension,
|
|
57
|
+
while providing feature-rich built-in implementations (on which the respective
|
|
58
|
+
DoclingDocument helpers are actually based).
|
|
59
|
+
|
|
60
|
+
👉 More details:
|
|
61
|
+
- [Serialization docs](https://docling-project.github.io/docling/concepts/serialization/)
|
|
62
|
+
- [Serialization example](https://docling-project.github.io/docling/examples/serialization/)
|
|
63
|
+
|
|
64
|
+
### Chunking
|
|
65
|
+
|
|
66
|
+
Similarly to above, the Chunking API provides built-in chunking capabilities as well as
|
|
67
|
+
a design that enables easy extension, this way tackling customization requirements of
|
|
68
|
+
different use cases.
|
|
69
|
+
|
|
70
|
+
👉 More details:
|
|
71
|
+
- [Chunking docs](https://docling-project.github.io/docling/concepts/chunking/)
|
|
72
|
+
- [Hybrid chunking example](https://docling-project.github.io/docling/examples/hybrid_chunking/)
|
|
73
|
+
- [Advanced chunking and serialization](https://docling-project.github.io/docling/examples/advanced_chunking_and_serialization/)
|
|
74
|
+
|
|
75
|
+
## Contributing
|
|
76
|
+
|
|
77
|
+
Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
|
|
78
|
+
|
|
79
|
+
## References
|
|
80
|
+
|
|
81
|
+
If you use Docling Core in your projects, please consider citing the following:
|
|
82
|
+
|
|
83
|
+
```bib
|
|
84
|
+
@techreport{Docling,
|
|
85
|
+
author = "Deep Search Team",
|
|
86
|
+
month = 8,
|
|
87
|
+
title = "Docling Technical Report",
|
|
88
|
+
url = "https://arxiv.org/abs/2408.09869",
|
|
89
|
+
eprint = "2408.09869",
|
|
90
|
+
doi = "10.48550/arXiv.2408.09869",
|
|
91
|
+
version = "1.0.0",
|
|
92
|
+
year = 2024
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
The Docling Core codebase is under MIT license.
|
|
99
|
+
For individual model usage, please refer to the model licenses found in the original packages.
|
|
@@ -39,9 +39,17 @@ def view(
|
|
|
39
39
|
typer.Argument(
|
|
40
40
|
...,
|
|
41
41
|
metavar="source",
|
|
42
|
-
help="Docling JSON file to view.",
|
|
42
|
+
help="Docling JSON or YAML file to view.",
|
|
43
43
|
),
|
|
44
44
|
],
|
|
45
|
+
split_view: Annotated[
|
|
46
|
+
bool,
|
|
47
|
+
typer.Option(
|
|
48
|
+
"--split-view",
|
|
49
|
+
"-s",
|
|
50
|
+
help="Split view of the document.",
|
|
51
|
+
),
|
|
52
|
+
] = False,
|
|
45
53
|
version: Annotated[
|
|
46
54
|
Optional[bool],
|
|
47
55
|
typer.Option(
|
|
@@ -52,11 +60,19 @@ def view(
|
|
|
52
60
|
),
|
|
53
61
|
] = None,
|
|
54
62
|
):
|
|
55
|
-
"""Display a
|
|
63
|
+
"""Display a DoclingDocument file on the default browser."""
|
|
56
64
|
path = resolve_source_to_path(source=source)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
if path.suffix == ".json":
|
|
66
|
+
doc = DoclingDocument.load_from_json(filename=path)
|
|
67
|
+
elif path.suffix in [".yaml", ".yml"]:
|
|
68
|
+
doc = DoclingDocument.load_from_yaml(filename=path)
|
|
69
|
+
else:
|
|
70
|
+
raise ValueError(f"Unsupported file type: {path.suffix}")
|
|
71
|
+
target_path = Path(tempfile.mkdtemp()) / f"{path.stem}.html"
|
|
72
|
+
html_output = doc.export_to_html(
|
|
73
|
+
image_mode=ImageRefMode.EMBEDDED,
|
|
74
|
+
split_page_view=split_view,
|
|
75
|
+
)
|
|
60
76
|
with open(target_path, "w", encoding="utf-8") as f:
|
|
61
77
|
f.write(html_output)
|
|
62
78
|
webbrowser.open(url=f"file://{target_path.absolute().resolve()}")
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright IBM Corp. 2024 - 2024
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
"""Define the chunker types."""
|
|
7
|
+
|
|
8
|
+
from docling_core.transforms.chunker.base import BaseChunk, BaseChunker, BaseMeta
|
|
9
|
+
from docling_core.transforms.chunker.code_chunking.base_code_chunking_strategy import (
|
|
10
|
+
BaseCodeChunkingStrategy,
|
|
11
|
+
)
|
|
12
|
+
from docling_core.transforms.chunker.code_chunking.code_chunk import (
|
|
13
|
+
CodeChunk,
|
|
14
|
+
CodeChunkType,
|
|
15
|
+
CodeDocMeta,
|
|
16
|
+
)
|
|
17
|
+
from docling_core.transforms.chunker.code_chunking.standard_code_chunking_strategy import (
|
|
18
|
+
StandardCodeChunkingStrategy,
|
|
19
|
+
)
|
|
20
|
+
from docling_core.transforms.chunker.doc_chunk import DocChunk, DocMeta
|
|
21
|
+
from docling_core.transforms.chunker.hierarchical_chunker import HierarchicalChunker
|
|
22
|
+
from docling_core.transforms.chunker.hybrid_chunker import HybridChunker
|
|
23
|
+
from docling_core.transforms.chunker.page_chunker import PageChunker
|
|
24
|
+
from docling_core.types.doc.labels import CodeLanguageLabel
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Code chunking package."""
|