docling-core 2.40.0__py3-none-any.whl → 2.42.0__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.
- docling_core/types/doc/base.py +29 -2
- docling_core/types/doc/document.py +1329 -161
- docling_core/types/doc/page.py +22 -2
- {docling_core-2.40.0.dist-info → docling_core-2.42.0.dist-info}/METADATA +1 -1
- {docling_core-2.40.0.dist-info → docling_core-2.42.0.dist-info}/RECORD +9 -9
- {docling_core-2.40.0.dist-info → docling_core-2.42.0.dist-info}/WHEEL +0 -0
- {docling_core-2.40.0.dist-info → docling_core-2.42.0.dist-info}/entry_points.txt +0 -0
- {docling_core-2.40.0.dist-info → docling_core-2.42.0.dist-info}/licenses/LICENSE +0 -0
- {docling_core-2.40.0.dist-info → docling_core-2.42.0.dist-info}/top_level.txt +0 -0
docling_core/types/doc/page.py
CHANGED
|
@@ -25,9 +25,21 @@ import numpy as np
|
|
|
25
25
|
from PIL import Image as PILImage
|
|
26
26
|
from PIL import ImageColor, ImageDraw, ImageFont
|
|
27
27
|
from PIL.ImageFont import FreeTypeFont
|
|
28
|
-
from pydantic import
|
|
28
|
+
from pydantic import (
|
|
29
|
+
AnyUrl,
|
|
30
|
+
BaseModel,
|
|
31
|
+
Field,
|
|
32
|
+
FieldSerializationInfo,
|
|
33
|
+
field_serializer,
|
|
34
|
+
model_validator,
|
|
35
|
+
)
|
|
29
36
|
|
|
30
|
-
from docling_core.types.doc.base import
|
|
37
|
+
from docling_core.types.doc.base import (
|
|
38
|
+
BoundingBox,
|
|
39
|
+
CoordOrigin,
|
|
40
|
+
PydanticSerCtxKey,
|
|
41
|
+
round_pydantic_float,
|
|
42
|
+
)
|
|
31
43
|
from docling_core.types.doc.document import ImageRef
|
|
32
44
|
|
|
33
45
|
_logger = logging.getLogger(__name__)
|
|
@@ -105,6 +117,10 @@ class BoundingRectangle(BaseModel):
|
|
|
105
117
|
|
|
106
118
|
coord_origin: CoordOrigin = CoordOrigin.BOTTOMLEFT
|
|
107
119
|
|
|
120
|
+
@field_serializer("r_x0", "r_y0", "r_x1", "r_y1", "r_x2", "r_y2", "r_x3", "r_y3")
|
|
121
|
+
def _serialize(self, value: float, info: FieldSerializationInfo) -> float:
|
|
122
|
+
return round_pydantic_float(value, info.context, PydanticSerCtxKey.COORD_PREC)
|
|
123
|
+
|
|
108
124
|
@property
|
|
109
125
|
def width(self) -> float:
|
|
110
126
|
"""Calculate the width of the rectangle."""
|
|
@@ -274,6 +290,10 @@ class TextCell(ColorMixin, OrderedElement):
|
|
|
274
290
|
confidence: float = 1.0
|
|
275
291
|
from_ocr: bool
|
|
276
292
|
|
|
293
|
+
@field_serializer("confidence")
|
|
294
|
+
def _serialize(self, value: float, info: FieldSerializationInfo) -> float:
|
|
295
|
+
return round_pydantic_float(value, info.context, PydanticSerCtxKey.CONFID_PREC)
|
|
296
|
+
|
|
277
297
|
def to_bounding_box(self) -> BoundingBox:
|
|
278
298
|
"""Convert the cell rectangle to a BoundingBox."""
|
|
279
299
|
return self.rect.to_bounding_box()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docling-core
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.42.0
|
|
4
4
|
Summary: A python library to define and validate data types in Docling.
|
|
5
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
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>
|
|
@@ -40,10 +40,10 @@ docling_core/transforms/visualizer/table_visualizer.py,sha256=iJPjk-XQSSCH3oujcj
|
|
|
40
40
|
docling_core/types/__init__.py,sha256=MVRSgsk5focwGyAplh_TRR3dEecIXpd98g_u3zZ5HXo,260
|
|
41
41
|
docling_core/types/base.py,sha256=PusJskRVL19y-hq0BgXr5e8--QEqSqLnFNJ8UbOqW88,8318
|
|
42
42
|
docling_core/types/doc/__init__.py,sha256=8hOhm5W9mArf3zwgfoMxDs1pHizhLFSAZlLu1tPBBRk,1641
|
|
43
|
-
docling_core/types/doc/base.py,sha256=
|
|
44
|
-
docling_core/types/doc/document.py,sha256=
|
|
43
|
+
docling_core/types/doc/base.py,sha256=i98y4IF250adR-8BSS374K90fwfwG-vBfWh14tLC5Cs,15906
|
|
44
|
+
docling_core/types/doc/document.py,sha256=ShxqS9A9N1KhVS73C7eoTBo0WgCI-TRbjwW8frhFEns,199154
|
|
45
45
|
docling_core/types/doc/labels.py,sha256=-W1-LW6z0J9F9ExJqR0Wd1WeqWTaY3Unm-j1UkQGlC4,7330
|
|
46
|
-
docling_core/types/doc/page.py,sha256=
|
|
46
|
+
docling_core/types/doc/page.py,sha256=35h1xdtCM3-AaN8Dim9jDseZIiw-3GxpB-ofF-H2rQQ,41878
|
|
47
47
|
docling_core/types/doc/tokens.py,sha256=z22l9J81_sg9CYMvOuLmPuLsNT7h_s7wao2UT89DvI8,9278
|
|
48
48
|
docling_core/types/doc/utils.py,sha256=JpAi7x9DHksFlIj_gRJPcSZOHa8AHvVPEO_K9aSnw4c,2608
|
|
49
49
|
docling_core/types/gen/__init__.py,sha256=C6TuCfvpSnSL5XDOFMcYHUY2-i08vvfOGRcdu6Af0pI,124
|
|
@@ -74,9 +74,9 @@ docling_core/utils/generate_jsonschema.py,sha256=uNX1O5XnjyB5nA66XqZXTt3YbGuR2ty
|
|
|
74
74
|
docling_core/utils/legacy.py,sha256=5lghO48OEcV9V51tRnH3YSKgLtdqhr-Q5C_OcJZ8TOs,24392
|
|
75
75
|
docling_core/utils/validate.py,sha256=aQ11UbFyl8iD_N7yTTZmm_VVeXz8KcCyn3GLXgkfYRM,2049
|
|
76
76
|
docling_core/utils/validators.py,sha256=azcrndLzhNkTWnbFSu9shJ5D3j_znnLrIFA5R8hzmGU,2798
|
|
77
|
-
docling_core-2.
|
|
78
|
-
docling_core-2.
|
|
79
|
-
docling_core-2.
|
|
80
|
-
docling_core-2.
|
|
81
|
-
docling_core-2.
|
|
82
|
-
docling_core-2.
|
|
77
|
+
docling_core-2.42.0.dist-info/licenses/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
|
|
78
|
+
docling_core-2.42.0.dist-info/METADATA,sha256=R7dpA43x-3YVrXztgu3_Pt87SWRrjaeBW0jXPndawdw,6453
|
|
79
|
+
docling_core-2.42.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
80
|
+
docling_core-2.42.0.dist-info/entry_points.txt,sha256=ER4zROQWkFMHIrY-oqY5E4HeCcCIg8dLkNztYGxdb7c,59
|
|
81
|
+
docling_core-2.42.0.dist-info/top_level.txt,sha256=O-tcXpGiurlud-1ZxMq1b-OmrfAVA4sajcgWU32RtfA,13
|
|
82
|
+
docling_core-2.42.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|