docling-core 2.32.0__tar.gz → 2.33.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.

Potentially problematic release.


This version of docling-core might be problematic. Click here for more details.

Files changed (109) hide show
  1. docling_core-2.33.1/PKG-INFO +143 -0
  2. docling_core-2.33.1/README.md +99 -0
  3. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/base.py +38 -0
  4. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/document.py +23 -7
  5. docling_core-2.33.1/docling_core.egg-info/PKG-INFO +143 -0
  6. docling_core-2.33.1/docling_core.egg-info/SOURCES.txt +104 -0
  7. docling_core-2.33.1/docling_core.egg-info/dependency_links.txt +1 -0
  8. docling_core-2.33.1/docling_core.egg-info/entry_points.txt +2 -0
  9. docling_core-2.33.1/docling_core.egg-info/requires.txt +18 -0
  10. docling_core-2.33.1/docling_core.egg-info/top_level.txt +1 -0
  11. docling_core-2.33.1/pyproject.toml +157 -0
  12. docling_core-2.33.1/setup.cfg +4 -0
  13. docling_core-2.33.1/test/test_base.py +295 -0
  14. docling_core-2.33.1/test/test_collection.py +158 -0
  15. docling_core-2.33.1/test/test_data_gen_flag.py +9 -0
  16. docling_core-2.33.1/test/test_doc_base.py +45 -0
  17. docling_core-2.33.1/test/test_doc_legacy_convert.py +40 -0
  18. docling_core-2.33.1/test/test_doc_schema.py +147 -0
  19. docling_core-2.33.1/test/test_doc_schema_extractor.py +31 -0
  20. docling_core-2.33.1/test/test_docling_doc.py +1603 -0
  21. docling_core-2.33.1/test/test_doctags_load.py +143 -0
  22. docling_core-2.33.1/test/test_hierarchical_chunker.py +73 -0
  23. docling_core-2.33.1/test/test_hybrid_chunker.py +384 -0
  24. docling_core-2.33.1/test/test_json_schema_to_search_mapper.py +106 -0
  25. docling_core-2.33.1/test/test_nlp_qa.py +46 -0
  26. docling_core-2.33.1/test/test_otsl_table_export.py +284 -0
  27. docling_core-2.33.1/test/test_page.py +79 -0
  28. docling_core-2.33.1/test/test_rec_schema.py +268 -0
  29. docling_core-2.33.1/test/test_search_meta.py +49 -0
  30. docling_core-2.33.1/test/test_serialization.py +372 -0
  31. docling_core-2.33.1/test/test_utils.py +94 -0
  32. docling_core-2.33.1/test/test_visualization.py +42 -0
  33. docling_core-2.32.0/PKG-INFO +0 -143
  34. docling_core-2.32.0/README.md +0 -97
  35. docling_core-2.32.0/pyproject.toml +0 -168
  36. {docling_core-2.32.0 → docling_core-2.33.1}/LICENSE +0 -0
  37. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/__init__.py +0 -0
  38. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/cli/__init__.py +0 -0
  39. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/cli/view.py +0 -0
  40. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/experimental/__init__.py +0 -0
  41. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/py.typed +0 -0
  42. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/doc/ANN.json +0 -0
  43. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/doc/DOC.json +0 -0
  44. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/doc/OCR-output.json +0 -0
  45. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/doc/RAW.json +0 -0
  46. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/generated/ccs_document_schema.json +0 -0
  47. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/generated/minimal_document_schema_flat.json +0 -0
  48. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/search/search_doc_mapping.json +0 -0
  49. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/resources/schemas/search/search_doc_mapping_v2.json +0 -0
  50. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/search/__init__.py +0 -0
  51. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/search/json_schema_to_search_mapper.py +0 -0
  52. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/search/mapping.py +0 -0
  53. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/search/meta.py +0 -0
  54. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/search/package.py +0 -0
  55. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/__init__.py +0 -0
  56. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/__init__.py +0 -0
  57. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/base.py +0 -0
  58. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/hierarchical_chunker.py +0 -0
  59. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/hybrid_chunker.py +0 -0
  60. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/tokenizer/__init__.py +0 -0
  61. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/tokenizer/base.py +0 -0
  62. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/tokenizer/huggingface.py +0 -0
  63. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/chunker/tokenizer/openai.py +0 -0
  64. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/__init__.py +0 -0
  65. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/base.py +0 -0
  66. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/common.py +0 -0
  67. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/doctags.py +0 -0
  68. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/html.py +0 -0
  69. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/html_styles.py +0 -0
  70. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/serializer/markdown.py +0 -0
  71. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/visualizer/__init__.py +0 -0
  72. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/visualizer/base.py +0 -0
  73. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/visualizer/layout_visualizer.py +0 -0
  74. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/transforms/visualizer/reading_order_visualizer.py +0 -0
  75. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/__init__.py +0 -0
  76. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/base.py +0 -0
  77. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/__init__.py +0 -0
  78. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/labels.py +0 -0
  79. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/page.py +0 -0
  80. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/tokens.py +0 -0
  81. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/doc/utils.py +0 -0
  82. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/gen/__init__.py +0 -0
  83. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/gen/generic.py +0 -0
  84. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/io/__init__.py +0 -0
  85. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/__init__.py +0 -0
  86. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/base.py +0 -0
  87. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/doc_ann.py +0 -0
  88. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/doc_ocr.py +0 -0
  89. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/doc_raw.py +0 -0
  90. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/document.py +0 -0
  91. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/legacy_doc/tokens.py +0 -0
  92. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/nlp/__init__.py +0 -0
  93. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/nlp/qa.py +0 -0
  94. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/nlp/qa_labels.py +0 -0
  95. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/__init__.py +0 -0
  96. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/attribute.py +0 -0
  97. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/base.py +0 -0
  98. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/predicate.py +0 -0
  99. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/record.py +0 -0
  100. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/statement.py +0 -0
  101. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/types/rec/subject.py +0 -0
  102. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/__init__.py +0 -0
  103. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/alias.py +0 -0
  104. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/file.py +0 -0
  105. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/generate_docs.py +0 -0
  106. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/generate_jsonschema.py +0 -0
  107. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/legacy.py +0 -0
  108. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/validate.py +0 -0
  109. {docling_core-2.32.0 → docling_core-2.33.1}/docling_core/utils/validators.py +0 -0
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: docling-core
3
+ Version: 2.33.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: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Database
20
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Classifier: Programming Language :: Python :: 3
24
+ Requires-Python: <4.0,>=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: jsonschema<5.0.0,>=4.16.0
28
+ Requires-Dist: pydantic!=2.10.0,!=2.10.1,!=2.10.2,<3.0.0,>=2.6.0
29
+ Requires-Dist: jsonref<2.0.0,>=1.1.0
30
+ Requires-Dist: tabulate<0.10.0,>=0.9.0
31
+ Requires-Dist: pandas<3.0.0,>=2.1.4
32
+ Requires-Dist: pillow<12.0.0,>=10.0.0
33
+ Requires-Dist: pyyaml<7.0.0,>=5.1
34
+ Requires-Dist: typing-extensions<5.0.0,>=4.12.2
35
+ Requires-Dist: typer<0.17.0,>=0.12.5
36
+ Requires-Dist: latex2mathml<4.0.0,>=3.77.0
37
+ Provides-Extra: chunking
38
+ Requires-Dist: semchunk<3.0.0,>=2.2.0; extra == "chunking"
39
+ Requires-Dist: transformers<5.0.0,>=4.34.0; extra == "chunking"
40
+ Provides-Extra: chunking-openai
41
+ Requires-Dist: semchunk; extra == "chunking-openai"
42
+ Requires-Dist: tiktoken<0.10.0,>=0.9.0; extra == "chunking-openai"
43
+ Dynamic: license-file
44
+
45
+ # Docling Core
46
+
47
+ [![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)
48
+ ![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%20%203.11%20%7C%203.12%20%7C%203.13-blue)
49
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
50
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
51
+ [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
52
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
53
+ [![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
54
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
55
+ [![License MIT](https://img.shields.io/github/license/docling-project/docling-core)](https://opensource.org/licenses/MIT)
56
+
57
+ Docling Core is a library that defines core data types and transformations in [Docling](https://github.com/docling-project/docling).
58
+
59
+ ## Installation
60
+
61
+ To use Docling Core, simply install `docling-core` from your package manager, e.g. pip:
62
+ ```bash
63
+ pip install docling-core
64
+ ```
65
+
66
+ ### Development setup
67
+
68
+ To develop for Docling Core, you need Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 and uv. You can then install from your local clone's root dir:
69
+ ```bash
70
+ uv sync --all-extras
71
+ ```
72
+
73
+ To run the pytest suite, execute:
74
+ ```
75
+ uv run pytest -s test
76
+ ```
77
+
78
+ ## Main features
79
+
80
+ Docling Core provides the foundational DoclingDocument data model and API, as well as
81
+ additional APIs for tasks like serialization and chunking, which are key to developing
82
+ generative AI applications using Docling.
83
+
84
+ ### DoclingDocument
85
+
86
+ Docling Core defines the DoclingDocument as a Pydantic model, allowing for advanced
87
+ data model control, customizability, and interoperability.
88
+
89
+ In addition to specifying the schema, it provides a handy API for building documents,
90
+ as well as for basic operations, e.g. exporting to various formats, like Markdown, HTML,
91
+ and others.
92
+
93
+ 👉 More details:
94
+ - [Architecture docs](https://docling-project.github.io/docling/concepts/architecture/)
95
+ - [DoclingDocument docs](https://docling-project.github.io/docling/concepts/docling_document/)
96
+
97
+ ### Serialization
98
+
99
+ Different users can have varying requirements when it comes to serialization.
100
+ To address this, the Serialization API introduces a design that allows easy extension,
101
+ while providing feature-rich built-in implementations (on which the respective
102
+ DoclingDocument helpers are actually based).
103
+
104
+ 👉 More details:
105
+ - [Serialization docs](https://docling-project.github.io/docling/concepts/serialization/)
106
+ - [Serialization example](https://docling-project.github.io/docling/examples/serialization/)
107
+
108
+ ### Chunking
109
+
110
+ Similarly to above, the Chunking API provides built-in chunking capabilities as well as
111
+ a design that enables easy extension, this way tackling customization requirements of
112
+ different use cases.
113
+
114
+ 👉 More details:
115
+ - [Chunking docs](https://docling-project.github.io/docling/concepts/chunking/)
116
+ - [Hybrid chunking example](https://docling-project.github.io/docling/examples/hybrid_chunking/)
117
+ - [Advanced chunking and serialization](https://docling-project.github.io/docling/examples/advanced_chunking_and_serialization/)
118
+
119
+ ## Contributing
120
+
121
+ Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
122
+
123
+ ## References
124
+
125
+ If you use Docling Core in your projects, please consider citing the following:
126
+
127
+ ```bib
128
+ @techreport{Docling,
129
+ author = "Deep Search Team",
130
+ month = 8,
131
+ title = "Docling Technical Report",
132
+ url = "https://arxiv.org/abs/2408.09869",
133
+ eprint = "2408.09869",
134
+ doi = "10.48550/arXiv.2408.09869",
135
+ version = "1.0.0",
136
+ year = 2024
137
+ }
138
+ ```
139
+
140
+ ## License
141
+
142
+ The Docling Core codebase is under MIT license.
143
+ For individual model usage, please refer to the model licenses found in the original packages.
@@ -0,0 +1,99 @@
1
+ # Docling Core
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)
4
+ ![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%20%203.11%20%7C%203.12%20%7C%203.13-blue)
5
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
6
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
7
+ [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
8
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
9
+ [![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
10
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
11
+ [![License MIT](https://img.shields.io/github/license/docling-project/docling-core)](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 / 3.10 / 3.11 / 3.12 / 3.13 and uv. You can then install from your local clone's root dir:
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.
@@ -395,3 +395,41 @@ class BoundingBox(BaseModel):
395
395
  raise ValueError("BoundingBoxes have different CoordOrigin")
396
396
 
397
397
  return cls(l=left, t=top, r=right, b=bottom, coord_origin=origin)
398
+
399
+ def x_overlap_with(self, other: "BoundingBox") -> float:
400
+ """Calculates the horizontal overlap with another bounding box."""
401
+ if self.coord_origin != other.coord_origin:
402
+ raise ValueError("BoundingBoxes have different CoordOrigin")
403
+ return max(0.0, min(self.r, other.r) - max(self.l, other.l))
404
+
405
+ def y_overlap_with(self, other: "BoundingBox") -> float:
406
+ """Calculates the vertical overlap with another bounding box, respecting coordinate origin."""
407
+ if self.coord_origin != other.coord_origin:
408
+ raise ValueError("BoundingBoxes have different CoordOrigin")
409
+ if self.coord_origin == CoordOrigin.TOPLEFT:
410
+ return max(0.0, min(self.b, other.b) - max(self.t, other.t))
411
+ elif self.coord_origin == CoordOrigin.BOTTOMLEFT:
412
+ return max(0.0, min(self.t, other.t) - max(self.b, other.b))
413
+ raise ValueError("Unsupported CoordOrigin")
414
+
415
+ def union_area_with(self, other: "BoundingBox") -> float:
416
+ """Calculates the union area with another bounding box."""
417
+ if self.coord_origin != other.coord_origin:
418
+ raise ValueError("BoundingBoxes have different CoordOrigin")
419
+ return self.area() + other.area() - self.intersection_area_with(other)
420
+
421
+ def x_union_with(self, other: "BoundingBox") -> float:
422
+ """Calculates the horizontal union dimension with another bounding box."""
423
+ if self.coord_origin != other.coord_origin:
424
+ raise ValueError("BoundingBoxes have different CoordOrigin")
425
+ return max(0.0, max(self.r, other.r) - min(self.l, other.l))
426
+
427
+ def y_union_with(self, other: "BoundingBox") -> float:
428
+ """Calculates the vertical union dimension with another bounding box, respecting coordinate origin."""
429
+ if self.coord_origin != other.coord_origin:
430
+ raise ValueError("BoundingBoxes have different CoordOrigin")
431
+ if self.coord_origin == CoordOrigin.TOPLEFT:
432
+ return max(0.0, max(self.b, other.b) - min(self.t, other.t))
433
+ elif self.coord_origin == CoordOrigin.BOTTOMLEFT:
434
+ return max(0.0, max(self.t, other.t) - min(self.b, other.b))
435
+ raise ValueError("Unsupported CoordOrigin")
@@ -3237,6 +3237,11 @@ class DoclingDocument(BaseModel):
3237
3237
  "document_index": DocItemLabel.DOCUMENT_INDEX,
3238
3238
  "otsl": DocItemLabel.TABLE,
3239
3239
  "section_header_level_1": DocItemLabel.SECTION_HEADER,
3240
+ "section_header_level_2": DocItemLabel.SECTION_HEADER,
3241
+ "section_header_level_3": DocItemLabel.SECTION_HEADER,
3242
+ "section_header_level_4": DocItemLabel.SECTION_HEADER,
3243
+ "section_header_level_5": DocItemLabel.SECTION_HEADER,
3244
+ "section_header_level_6": DocItemLabel.SECTION_HEADER,
3240
3245
  "checkbox_selected": DocItemLabel.CHECKBOX_SELECTED,
3241
3246
  "checkbox_unselected": DocItemLabel.CHECKBOX_UNSELECTED,
3242
3247
  "text": DocItemLabel.TEXT,
@@ -3622,7 +3627,7 @@ class DoclingDocument(BaseModel):
3622
3627
  rf"{DocItemLabel.PAGE_FOOTER}|{DocItemLabel.FORMULA}|"
3623
3628
  rf"{DocItemLabel.CAPTION}|{DocItemLabel.PICTURE}|"
3624
3629
  rf"{DocItemLabel.FOOTNOTE}|{DocItemLabel.CODE}|"
3625
- rf"{DocItemLabel.SECTION_HEADER}_level_1|"
3630
+ rf"{DocItemLabel.SECTION_HEADER}_level_[1-6]|"
3626
3631
  rf"{DocumentToken.ORDERED_LIST.value}|"
3627
3632
  rf"{DocumentToken.UNORDERED_LIST.value}|"
3628
3633
  rf"{DocItemLabel.KEY_VALUE_REGION}|"
@@ -3830,12 +3835,23 @@ class DoclingDocument(BaseModel):
3830
3835
  if tag_name in [DocItemLabel.PAGE_HEADER, DocItemLabel.PAGE_FOOTER]:
3831
3836
  content_layer = ContentLayer.FURNITURE
3832
3837
 
3833
- doc.add_text(
3834
- label=doc_label,
3835
- text=text_content,
3836
- prov=element_prov,
3837
- content_layer=content_layer,
3838
- )
3838
+ if doc_label == DocItemLabel.SECTION_HEADER:
3839
+ # Extract level from tag_name (e.g. "section_level_header_1" -> 1)
3840
+ level = int(tag_name.split("_")[-1])
3841
+ doc.add_heading(
3842
+ text=text_content,
3843
+ level=level,
3844
+ prov=element_prov,
3845
+ content_layer=content_layer,
3846
+ )
3847
+ else:
3848
+ doc.add_text(
3849
+ label=doc_label,
3850
+ text=text_content,
3851
+ prov=element_prov,
3852
+ content_layer=content_layer,
3853
+ )
3854
+
3839
3855
  return doc
3840
3856
 
3841
3857
  @deprecated("Use save_as_doctags instead.")
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: docling-core
3
+ Version: 2.33.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: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Database
20
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Classifier: Programming Language :: Python :: 3
24
+ Requires-Python: <4.0,>=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: jsonschema<5.0.0,>=4.16.0
28
+ Requires-Dist: pydantic!=2.10.0,!=2.10.1,!=2.10.2,<3.0.0,>=2.6.0
29
+ Requires-Dist: jsonref<2.0.0,>=1.1.0
30
+ Requires-Dist: tabulate<0.10.0,>=0.9.0
31
+ Requires-Dist: pandas<3.0.0,>=2.1.4
32
+ Requires-Dist: pillow<12.0.0,>=10.0.0
33
+ Requires-Dist: pyyaml<7.0.0,>=5.1
34
+ Requires-Dist: typing-extensions<5.0.0,>=4.12.2
35
+ Requires-Dist: typer<0.17.0,>=0.12.5
36
+ Requires-Dist: latex2mathml<4.0.0,>=3.77.0
37
+ Provides-Extra: chunking
38
+ Requires-Dist: semchunk<3.0.0,>=2.2.0; extra == "chunking"
39
+ Requires-Dist: transformers<5.0.0,>=4.34.0; extra == "chunking"
40
+ Provides-Extra: chunking-openai
41
+ Requires-Dist: semchunk; extra == "chunking-openai"
42
+ Requires-Dist: tiktoken<0.10.0,>=0.9.0; extra == "chunking-openai"
43
+ Dynamic: license-file
44
+
45
+ # Docling Core
46
+
47
+ [![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)
48
+ ![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%20%203.11%20%7C%203.12%20%7C%203.13-blue)
49
+ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
50
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
51
+ [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
52
+ [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
53
+ [![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
54
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
55
+ [![License MIT](https://img.shields.io/github/license/docling-project/docling-core)](https://opensource.org/licenses/MIT)
56
+
57
+ Docling Core is a library that defines core data types and transformations in [Docling](https://github.com/docling-project/docling).
58
+
59
+ ## Installation
60
+
61
+ To use Docling Core, simply install `docling-core` from your package manager, e.g. pip:
62
+ ```bash
63
+ pip install docling-core
64
+ ```
65
+
66
+ ### Development setup
67
+
68
+ To develop for Docling Core, you need Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 and uv. You can then install from your local clone's root dir:
69
+ ```bash
70
+ uv sync --all-extras
71
+ ```
72
+
73
+ To run the pytest suite, execute:
74
+ ```
75
+ uv run pytest -s test
76
+ ```
77
+
78
+ ## Main features
79
+
80
+ Docling Core provides the foundational DoclingDocument data model and API, as well as
81
+ additional APIs for tasks like serialization and chunking, which are key to developing
82
+ generative AI applications using Docling.
83
+
84
+ ### DoclingDocument
85
+
86
+ Docling Core defines the DoclingDocument as a Pydantic model, allowing for advanced
87
+ data model control, customizability, and interoperability.
88
+
89
+ In addition to specifying the schema, it provides a handy API for building documents,
90
+ as well as for basic operations, e.g. exporting to various formats, like Markdown, HTML,
91
+ and others.
92
+
93
+ 👉 More details:
94
+ - [Architecture docs](https://docling-project.github.io/docling/concepts/architecture/)
95
+ - [DoclingDocument docs](https://docling-project.github.io/docling/concepts/docling_document/)
96
+
97
+ ### Serialization
98
+
99
+ Different users can have varying requirements when it comes to serialization.
100
+ To address this, the Serialization API introduces a design that allows easy extension,
101
+ while providing feature-rich built-in implementations (on which the respective
102
+ DoclingDocument helpers are actually based).
103
+
104
+ 👉 More details:
105
+ - [Serialization docs](https://docling-project.github.io/docling/concepts/serialization/)
106
+ - [Serialization example](https://docling-project.github.io/docling/examples/serialization/)
107
+
108
+ ### Chunking
109
+
110
+ Similarly to above, the Chunking API provides built-in chunking capabilities as well as
111
+ a design that enables easy extension, this way tackling customization requirements of
112
+ different use cases.
113
+
114
+ 👉 More details:
115
+ - [Chunking docs](https://docling-project.github.io/docling/concepts/chunking/)
116
+ - [Hybrid chunking example](https://docling-project.github.io/docling/examples/hybrid_chunking/)
117
+ - [Advanced chunking and serialization](https://docling-project.github.io/docling/examples/advanced_chunking_and_serialization/)
118
+
119
+ ## Contributing
120
+
121
+ Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
122
+
123
+ ## References
124
+
125
+ If you use Docling Core in your projects, please consider citing the following:
126
+
127
+ ```bib
128
+ @techreport{Docling,
129
+ author = "Deep Search Team",
130
+ month = 8,
131
+ title = "Docling Technical Report",
132
+ url = "https://arxiv.org/abs/2408.09869",
133
+ eprint = "2408.09869",
134
+ doi = "10.48550/arXiv.2408.09869",
135
+ version = "1.0.0",
136
+ year = 2024
137
+ }
138
+ ```
139
+
140
+ ## License
141
+
142
+ The Docling Core codebase is under MIT license.
143
+ For individual model usage, please refer to the model licenses found in the original packages.
@@ -0,0 +1,104 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ docling_core/__init__.py
5
+ docling_core/py.typed
6
+ docling_core.egg-info/PKG-INFO
7
+ docling_core.egg-info/SOURCES.txt
8
+ docling_core.egg-info/dependency_links.txt
9
+ docling_core.egg-info/entry_points.txt
10
+ docling_core.egg-info/requires.txt
11
+ docling_core.egg-info/top_level.txt
12
+ docling_core/cli/__init__.py
13
+ docling_core/cli/view.py
14
+ docling_core/experimental/__init__.py
15
+ docling_core/resources/schemas/doc/ANN.json
16
+ docling_core/resources/schemas/doc/DOC.json
17
+ docling_core/resources/schemas/doc/OCR-output.json
18
+ docling_core/resources/schemas/doc/RAW.json
19
+ docling_core/resources/schemas/generated/ccs_document_schema.json
20
+ docling_core/resources/schemas/generated/minimal_document_schema_flat.json
21
+ docling_core/resources/schemas/search/search_doc_mapping.json
22
+ docling_core/resources/schemas/search/search_doc_mapping_v2.json
23
+ docling_core/search/__init__.py
24
+ docling_core/search/json_schema_to_search_mapper.py
25
+ docling_core/search/mapping.py
26
+ docling_core/search/meta.py
27
+ docling_core/search/package.py
28
+ docling_core/transforms/__init__.py
29
+ docling_core/transforms/chunker/__init__.py
30
+ docling_core/transforms/chunker/base.py
31
+ docling_core/transforms/chunker/hierarchical_chunker.py
32
+ docling_core/transforms/chunker/hybrid_chunker.py
33
+ docling_core/transforms/chunker/tokenizer/__init__.py
34
+ docling_core/transforms/chunker/tokenizer/base.py
35
+ docling_core/transforms/chunker/tokenizer/huggingface.py
36
+ docling_core/transforms/chunker/tokenizer/openai.py
37
+ docling_core/transforms/serializer/__init__.py
38
+ docling_core/transforms/serializer/base.py
39
+ docling_core/transforms/serializer/common.py
40
+ docling_core/transforms/serializer/doctags.py
41
+ docling_core/transforms/serializer/html.py
42
+ docling_core/transforms/serializer/html_styles.py
43
+ docling_core/transforms/serializer/markdown.py
44
+ docling_core/transforms/visualizer/__init__.py
45
+ docling_core/transforms/visualizer/base.py
46
+ docling_core/transforms/visualizer/layout_visualizer.py
47
+ docling_core/transforms/visualizer/reading_order_visualizer.py
48
+ docling_core/types/__init__.py
49
+ docling_core/types/base.py
50
+ docling_core/types/doc/__init__.py
51
+ docling_core/types/doc/base.py
52
+ docling_core/types/doc/document.py
53
+ docling_core/types/doc/labels.py
54
+ docling_core/types/doc/page.py
55
+ docling_core/types/doc/tokens.py
56
+ docling_core/types/doc/utils.py
57
+ docling_core/types/gen/__init__.py
58
+ docling_core/types/gen/generic.py
59
+ docling_core/types/io/__init__.py
60
+ docling_core/types/legacy_doc/__init__.py
61
+ docling_core/types/legacy_doc/base.py
62
+ docling_core/types/legacy_doc/doc_ann.py
63
+ docling_core/types/legacy_doc/doc_ocr.py
64
+ docling_core/types/legacy_doc/doc_raw.py
65
+ docling_core/types/legacy_doc/document.py
66
+ docling_core/types/legacy_doc/tokens.py
67
+ docling_core/types/nlp/__init__.py
68
+ docling_core/types/nlp/qa.py
69
+ docling_core/types/nlp/qa_labels.py
70
+ docling_core/types/rec/__init__.py
71
+ docling_core/types/rec/attribute.py
72
+ docling_core/types/rec/base.py
73
+ docling_core/types/rec/predicate.py
74
+ docling_core/types/rec/record.py
75
+ docling_core/types/rec/statement.py
76
+ docling_core/types/rec/subject.py
77
+ docling_core/utils/__init__.py
78
+ docling_core/utils/alias.py
79
+ docling_core/utils/file.py
80
+ docling_core/utils/generate_docs.py
81
+ docling_core/utils/generate_jsonschema.py
82
+ docling_core/utils/legacy.py
83
+ docling_core/utils/validate.py
84
+ docling_core/utils/validators.py
85
+ test/test_base.py
86
+ test/test_collection.py
87
+ test/test_data_gen_flag.py
88
+ test/test_doc_base.py
89
+ test/test_doc_legacy_convert.py
90
+ test/test_doc_schema.py
91
+ test/test_doc_schema_extractor.py
92
+ test/test_docling_doc.py
93
+ test/test_doctags_load.py
94
+ test/test_hierarchical_chunker.py
95
+ test/test_hybrid_chunker.py
96
+ test/test_json_schema_to_search_mapper.py
97
+ test/test_nlp_qa.py
98
+ test/test_otsl_table_export.py
99
+ test/test_page.py
100
+ test/test_rec_schema.py
101
+ test/test_search_meta.py
102
+ test/test_serialization.py
103
+ test/test_utils.py
104
+ test/test_visualization.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ docling-view = docling_core.cli.view:app
@@ -0,0 +1,18 @@
1
+ jsonschema<5.0.0,>=4.16.0
2
+ pydantic!=2.10.0,!=2.10.1,!=2.10.2,<3.0.0,>=2.6.0
3
+ jsonref<2.0.0,>=1.1.0
4
+ tabulate<0.10.0,>=0.9.0
5
+ pandas<3.0.0,>=2.1.4
6
+ pillow<12.0.0,>=10.0.0
7
+ pyyaml<7.0.0,>=5.1
8
+ typing-extensions<5.0.0,>=4.12.2
9
+ typer<0.17.0,>=0.12.5
10
+ latex2mathml<4.0.0,>=3.77.0
11
+
12
+ [chunking]
13
+ semchunk<3.0.0,>=2.2.0
14
+ transformers<5.0.0,>=4.34.0
15
+
16
+ [chunking-openai]
17
+ semchunk
18
+ tiktoken<0.10.0,>=0.9.0
@@ -0,0 +1 @@
1
+ docling_core