docling-core 2.32.0__py3-none-any.whl → 2.33.1__py3-none-any.whl

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.

@@ -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.
@@ -1,8 +1,8 @@
1
1
  docling_core/__init__.py,sha256=D0afxif-BMUrgx2cYk1cwxiwATRYaGXsIMk_z4nw1Vs,90
2
+ docling_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
3
  docling_core/cli/__init__.py,sha256=C63yWifzpA0IV7YWDatpAdrhoV8zjqxAKv0xMf09VdM,19
3
4
  docling_core/cli/view.py,sha256=gwxSBYhGqwznMR8pdXaEuAh2bjFD5X_g11xFYSgFgtM,1764
4
5
  docling_core/experimental/__init__.py,sha256=XnAVSUHbA6OFhNSpoYqSD3u83-xVaUaki1DIKFw69Ew,99
5
- docling_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  docling_core/resources/schemas/doc/ANN.json,sha256=04U5j-PU9m5w7IagJ_rHcAx7qUtLkUuaWZO9GuYHnTA,4202
7
7
  docling_core/resources/schemas/doc/DOC.json,sha256=9tVKpCqDGGq3074Nn5qlUCdTN-5k1Q0ri_scJblwnLE,6686
8
8
  docling_core/resources/schemas/doc/OCR-output.json,sha256=56A3g5dbUEzUYwEqhQhnoNi-Jgm8n8YMp3U5F23cZVM,3080
@@ -39,8 +39,8 @@ docling_core/transforms/visualizer/reading_order_visualizer.py,sha256=-ej5uLriNt
39
39
  docling_core/types/__init__.py,sha256=MVRSgsk5focwGyAplh_TRR3dEecIXpd98g_u3zZ5HXo,260
40
40
  docling_core/types/base.py,sha256=PusJskRVL19y-hq0BgXr5e8--QEqSqLnFNJ8UbOqW88,8318
41
41
  docling_core/types/doc/__init__.py,sha256=bysJn2iwjAHwThSWDPXEdVUUij7p_ax12_nx2_0CMdg,653
42
- docling_core/types/doc/base.py,sha256=sM3IyFXzVh2WT8IGh5nejXYh8sf39yBh8TBSlHeJ9CI,12611
43
- docling_core/types/doc/document.py,sha256=wxPxTOh3pfZr33rGPgnrFSY6b70C5Fe20tqqgYRUxrI,141930
42
+ docling_core/types/doc/base.py,sha256=ndXquBrOKTFQApIJ5s2-zstj3xlVKRbJDSId0KOQnUg,14817
43
+ docling_core/types/doc/document.py,sha256=rdevCAZDpMPzPlZmAtiucvBM8h_AjuIZpQDaqjpknl0,142796
44
44
  docling_core/types/doc/labels.py,sha256=vp4h3e7AmBvezRmgrfuPehjAHTZOufphErLB4ENhdME,7171
45
45
  docling_core/types/doc/page.py,sha256=1JMPwglaTITBvg959L_pcWPb-fXoDYGh-e_tGZMzVMQ,41060
46
46
  docling_core/types/doc/tokens.py,sha256=z22l9J81_sg9CYMvOuLmPuLsNT7h_s7wao2UT89DvI8,9278
@@ -73,8 +73,9 @@ docling_core/utils/generate_jsonschema.py,sha256=uNX1O5XnjyB5nA66XqZXTt3YbGuR2ty
73
73
  docling_core/utils/legacy.py,sha256=DrI3QGoL755ZCIoKHF74-pTWm8R0zfFo2C2vB5dT2aY,24463
74
74
  docling_core/utils/validate.py,sha256=aQ11UbFyl8iD_N7yTTZmm_VVeXz8KcCyn3GLXgkfYRM,2049
75
75
  docling_core/utils/validators.py,sha256=azcrndLzhNkTWnbFSu9shJ5D3j_znnLrIFA5R8hzmGU,2798
76
- docling_core-2.32.0.dist-info/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
77
- docling_core-2.32.0.dist-info/METADATA,sha256=3ZtmT43WNDIQQd4I9H-Yf1Z954rod4Y5ZDrvTNPsRBQ,5976
78
- docling_core-2.32.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
79
- docling_core-2.32.0.dist-info/entry_points.txt,sha256=oClcdb2L2RKx4jdqUykY16Kum_f0_whwWhGzIodyidc,216
80
- docling_core-2.32.0.dist-info/RECORD,,
76
+ docling_core-2.33.1.dist-info/licenses/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
77
+ docling_core-2.33.1.dist-info/METADATA,sha256=tib261Wc010Z2y6_lgKcXdO2OKPG8pdf2n1CoIYSDBA,6453
78
+ docling_core-2.33.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
+ docling_core-2.33.1.dist-info/entry_points.txt,sha256=ER4zROQWkFMHIrY-oqY5E4HeCcCIg8dLkNztYGxdb7c,59
80
+ docling_core-2.33.1.dist-info/top_level.txt,sha256=O-tcXpGiurlud-1ZxMq1b-OmrfAVA4sajcgWU32RtfA,13
81
+ docling_core-2.33.1.dist-info/RECORD,,
@@ -1,4 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.0
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ docling-view = docling_core.cli.view:app
@@ -0,0 +1 @@
1
+ docling_core
@@ -1,143 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: docling-core
3
- Version: 2.32.0
4
- Summary: A python library to define and validate data types in Docling.
5
- Home-page: https://github.com/docling-project
6
- License: MIT
7
- Keywords: docling,discovery,etl,information retrieval,analytics,database,database schema,schema,JSON
8
- Author: Cesar Berrospi Ramis
9
- Author-email: ceb@zurich.ibm.com
10
- Maintainer: Cesar Berrospi Ramis
11
- Maintainer-email: ceb@zurich.ibm.com
12
- Requires-Python: >=3.9,<4.0
13
- Classifier: Development Status :: 5 - Production/Stable
14
- Classifier: Intended Audience :: Developers
15
- Classifier: Intended Audience :: Science/Research
16
- Classifier: License :: OSI Approved :: MIT License
17
- Classifier: Natural Language :: English
18
- Classifier: Operating System :: OS Independent
19
- Classifier: Programming Language :: Python :: 3
20
- Classifier: Programming Language :: Python :: 3.9
21
- Classifier: Programming Language :: Python :: 3.10
22
- Classifier: Programming Language :: Python :: 3.11
23
- Classifier: Programming Language :: Python :: 3.12
24
- Classifier: Topic :: Database
25
- Classifier: Topic :: Scientific/Engineering :: Information Analysis
26
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
- Classifier: Typing :: Typed
28
- Provides-Extra: chunking
29
- Provides-Extra: chunking-openai
30
- Requires-Dist: jsonref (>=1.1.0,<2.0.0)
31
- Requires-Dist: jsonschema (>=4.16.0,<5.0.0)
32
- Requires-Dist: latex2mathml (>=3.77.0,<4.0.0)
33
- Requires-Dist: pandas (>=2.1.4,<3.0.0)
34
- Requires-Dist: pillow (>=10.0.0,<12.0.0)
35
- Requires-Dist: pydantic (>=2.6.0,<3.0.0,!=2.10.0,!=2.10.1,!=2.10.2)
36
- Requires-Dist: pyyaml (>=5.1,<7.0.0)
37
- Requires-Dist: semchunk (>=2.2.0,<3.0.0) ; extra == "chunking" or extra == "chunking-openai"
38
- Requires-Dist: tabulate (>=0.9.0,<0.10.0)
39
- Requires-Dist: tiktoken (>=0.9.0,<0.10.0) ; extra == "chunking-openai"
40
- Requires-Dist: transformers (>=4.34.0,<5.0.0) ; extra == "chunking"
41
- Requires-Dist: typer (>=0.12.5,<0.16.0)
42
- Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
43
- Project-URL: Repository, https://github.com/docling-project/docling-core
44
- Description-Content-Type: text/markdown
45
-
46
- # Docling Core
47
-
48
- [![PyPI version](https://img.shields.io/pypi/v/docling-core)](https://pypi.org/project/docling-core/)
49
- ![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)
50
- [![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
51
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
52
- [![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
53
- [![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
54
- [![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
55
- [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
56
- [![License MIT](https://img.shields.io/github/license/docling-project/docling-core)](https://opensource.org/licenses/MIT)
57
-
58
- Docling Core is a library that defines the data types in [Docling](https://github.com/docling-project/docling), leveraging pydantic models.
59
-
60
- ## Installation
61
-
62
- To use Docling Core, simply install `docling-core` from your package manager, e.g. pip:
63
- ```bash
64
- pip install docling-core
65
- ```
66
-
67
- ### Development setup
68
-
69
- To develop for Docling Core, you need Python 3.9 / 3.10 / 3.11 / 3.12 / 3.13 and Poetry. You can then install from your local clone's root dir:
70
- ```bash
71
- poetry install --all-extras
72
- ```
73
-
74
- To run the pytest suite, execute:
75
- ```
76
- poetry run pytest test
77
- ```
78
-
79
- ## Basic Usage
80
-
81
- - You can validate your JSON objects using the pydantic class definition.
82
-
83
- ```py
84
- from docling_core.types import DoclingDocument
85
-
86
- data_dict = {...} # here the object you want to validate, as a dictionary
87
- DoclingDocument.model_validate(data_dict)
88
-
89
- data_str = {...} # here the object as a JSON string
90
- DoclingDocument.model_validate_json(data_str)
91
- ```
92
-
93
- - You can generate the JSON schema of a model with the script `generate_jsonschema`.
94
-
95
- ```py
96
- # for the `DoclingDocument` type
97
- generate_jsonschema DoclingDocument
98
-
99
- # for the use `Record` type
100
- generate_jsonschema Record
101
- ```
102
-
103
- ## Documentation
104
-
105
- Docling Core contains 3 top-level data types:
106
-
107
- - **DoclingDocument** for publications like books, articles, reports, or patents. The JSON that can be exported using Docling follows this schema.
108
- The DoclingDocument type also models the metadata that may be attached to the converted document.
109
- Check [DoclingDocument](docs/DoclingDocument.json) for the full JSON schema.
110
- - **Record** for structured database records, centered on an entity or _subject_ that is provided with a list of attributes.
111
- Related to records, the statements can represent annotations on text by Natural Language Processing (NLP) tools.
112
- Check [Record](docs/Record.json) for the full JSON schema.
113
- - **Generic** for any data representation, ensuring minimal configuration and maximum flexibility.
114
- Check [Generic](docs/Generic.json) for the full JSON schema.
115
-
116
- The data schemas are defined using [pydantic](https://pydantic-docs.helpmanual.io/) models, which provide built-in processes to support the creation of data that adhere to those models.
117
-
118
- ## Contributing
119
-
120
- Please read [Contributing to Docling Core](./CONTRIBUTING.md) for details.
121
-
122
- ## References
123
-
124
- If you use Docling Core in your projects, please consider citing the following:
125
-
126
- ```bib
127
- @techreport{Docling,
128
- author = "Deep Search Team",
129
- month = 8,
130
- title = "Docling Technical Report",
131
- url = "https://arxiv.org/abs/2408.09869",
132
- eprint = "2408.09869",
133
- doi = "10.48550/arXiv.2408.09869",
134
- version = "1.0.0",
135
- year = 2024
136
- }
137
- ```
138
-
139
- ## License
140
-
141
- The Docling Core codebase is under MIT license.
142
- For individual model usage, please refer to the model licenses found in the original packages.
143
-
@@ -1,6 +0,0 @@
1
- [console_scripts]
2
- docling-view=docling_core.cli.view:app
3
- generate_docs=docling_core.utils.generate_docs:main
4
- generate_jsonschema=docling_core.utils.generate_jsonschema:main
5
- validate=docling_core.utils.validate:main
6
-