docling-core 1.1.2__py3-none-any.whl → 1.1.3__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.

@@ -128,37 +128,28 @@ class GlmTableCell(TableCell):
128
128
  )
129
129
 
130
130
 
131
- class Table(AliasModel):
132
- """Table."""
131
+ class BaseCell(AliasModel):
132
+ """Base cell."""
133
133
 
134
- num_cols: int = Field(alias="#-cols")
135
- num_rows: int = Field(alias="#-rows")
136
134
  bounding_box: Optional[BoundingBoxContainer] = Field(
137
135
  default=None, alias="bounding-box", json_schema_extra=es_field(suppress=True)
138
136
  )
139
- data: Optional[list[list[Union[GlmTableCell, TableCell]]]] = None
140
- model: Optional[str] = None
141
137
  prov: Optional[list[Prov]] = None
142
138
  text: Optional[str] = Field(
143
139
  default=None, json_schema_extra=es_field(term_vector="with_positions_offsets")
144
140
  )
145
141
  obj_type: str = Field(
146
- alias="type",
147
- json_schema_extra=es_field(type="keyword", ignore_above=8191),
142
+ alias="type", json_schema_extra=es_field(type="keyword", ignore_above=8191)
148
143
  )
149
144
 
150
145
 
151
- class BaseCell(AliasModel):
152
- """Base cell."""
146
+ class Table(BaseCell):
147
+ """Table."""
153
148
 
154
- bounding_box: Optional[BoundingBoxContainer] = Field(
155
- default=None, alias="bounding-box", json_schema_extra=es_field(suppress=True)
156
- )
157
- prov: Optional[list[Prov]] = None
158
- text: Optional[str] = None
159
- obj_type: str = Field(
160
- alias="type", json_schema_extra=es_field(type="keyword", ignore_above=8191)
161
- )
149
+ num_cols: int = Field(alias="#-cols")
150
+ num_rows: int = Field(alias="#-rows")
151
+ data: Optional[list[list[Union[GlmTableCell, TableCell]]]] = None
152
+ model: Optional[str] = None
162
153
 
163
154
 
164
155
  class BaseText(AliasModel):
@@ -393,14 +393,28 @@ class ExportedCCSDocument(
393
393
 
394
394
  return data
395
395
 
396
- def _resolve_ref(self, item: Ref) -> Optional[Table]:
397
- """Return the resolved reference in case of table reference, otherwise None."""
398
- result: Optional[Table] = None
396
+ def _resolve_ref(self, item: Ref) -> Optional[Union[BaseCell, BaseText]]:
397
+ """Return the resolved reference.
399
398
 
400
- # NOTE: currently only resolves table refs & makes assumptions on ref parts
399
+ Resolved the Ref object within the document.
400
+ If the object is not found, None is returned.
401
+ """
402
+ result: Optional[Union[BaseCell, BaseText]] = None
403
+
404
+ # NOTE: currently only resolves refs explicitely, such that we can make
405
+ # assumptions on ref parts
401
406
  if item.obj_type == "table" and self.tables:
402
407
  parts = item.ref.split("/")
403
408
  result = self.tables[int(parts[2])]
409
+ elif item.obj_type == "figure" and self.figures:
410
+ parts = item.ref.split("/")
411
+ result = self.figures[int(parts[2])]
412
+ elif item.obj_type == "equation" and self.equations:
413
+ parts = item.ref.split("/")
414
+ result = self.equations[int(parts[2])]
415
+ elif item.obj_type == "footnote" and self.footnotes:
416
+ parts = item.ref.split("/")
417
+ result = self.footnotes[int(parts[2])]
404
418
 
405
419
  return result
406
420
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docling-core
3
- Version: 1.1.2
3
+ Version: 1.1.3
4
4
  Summary: A python library to define and validate data types in Docling.
5
5
  Home-page: https://ds4sd.github.io/
6
6
  License: MIT
@@ -16,11 +16,11 @@ docling_core/search/package.py,sha256=Lz2ml2eDy5t0ZimnGTq-DXHAn-f18w0bn4H5xrhs75
16
16
  docling_core/types/__init__.py,sha256=6mrAEKRW85uHJwNQBufwjPcMWCjm3oocA6MaO4_NLgg,805
17
17
  docling_core/types/base.py,sha256=fNtfQ20NKa_RBNBWbq0DfO8o0zC1Cec8UAMu0Znsltk,8170
18
18
  docling_core/types/doc/__init__.py,sha256=Pzj_8rft6SJTVTCHgXRwHtuZjL6LK_6dcBWjikL9biY,125
19
- docling_core/types/doc/base.py,sha256=ihkr_RqcyK_ngRFhTc1OhQiilIYymw5_0cgBe7VdVq0,5553
19
+ docling_core/types/doc/base.py,sha256=Vwh-8Q8n9meFxbrbMUx2zNzt1JnUo3Y3Hpwmmf82IlM,5206
20
20
  docling_core/types/doc/doc_ann.py,sha256=8pV2efUglw19jxl4_oqB__mSxjWvtGIcllyCdqA-b2s,1196
21
21
  docling_core/types/doc/doc_ocr.py,sha256=6PC0C-OczF-MyfgRxEI1xs3PWgNOzi7i2yEQbTqZz0I,1387
22
22
  docling_core/types/doc/doc_raw.py,sha256=Y69G6IiauNDaoT-5el4xo1ypWpnBJQ75akGGkCMTZSc,3888
23
- docling_core/types/doc/document.py,sha256=nkJbdYLm0NEuYwvB0UumQCS1Gb_8dHJPXWh9HE1ot4I,16466
23
+ docling_core/types/doc/document.py,sha256=W7y-cV8I7RVE2GvBUZFTiYa_m3tMGWz1TWa56LHHGt0,17061
24
24
  docling_core/types/gen/__init__.py,sha256=C6TuCfvpSnSL5XDOFMcYHUY2-i08vvfOGRcdu6Af0pI,124
25
25
  docling_core/types/gen/generic.py,sha256=l4CZ4_Lb8ONG36WNJWbKX5hGKvTh_yU-hXp5hsm7uVU,844
26
26
  docling_core/types/nlp/__init__.py,sha256=hGcztAeVK7xkRBqRRvc4zbY4PGeJ0r0QrEsetnSx9nI,119
@@ -39,8 +39,8 @@ docling_core/utils/ds_generate_docs.py,sha256=0xGBagdC_PGjyeHXYZo90VnVrSTMZgHb0S
39
39
  docling_core/utils/ds_generate_jsonschema.py,sha256=EhNQutqWJFWuN-yl9UUPFZ7DJTvGqg54qBIvUMHTHdA,1647
40
40
  docling_core/utils/validate.py,sha256=3FmnxnKTDZC5J9OGxCL3U3DGRl0t0bBV1NcySXswdas,2031
41
41
  docling_core/utils/validators.py,sha256=fBdyWX4PvFh7o_d25ZTs4iwmeo75QTbrxsvXv2kXkTg,2777
42
- docling_core-1.1.2.dist-info/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
43
- docling_core-1.1.2.dist-info/METADATA,sha256=_6KPgXt_4k2BdT7Pu6RiOvZ3DMQ4nnZ5lpgdK73IHeY,5335
44
- docling_core-1.1.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
45
- docling_core-1.1.2.dist-info/entry_points.txt,sha256=XHhtJEkdUuLxXSNxLdFIzx_siQ3z2UFQEKp-P8VYAE4,189
46
- docling_core-1.1.2.dist-info/RECORD,,
42
+ docling_core-1.1.3.dist-info/LICENSE,sha256=2M9-6EoQ1sxFztTOkXGAtwUDJvnWaAHdB9BYWVwGkIw,1087
43
+ docling_core-1.1.3.dist-info/METADATA,sha256=H0MipSdTp4sgX1z871MxEY-t8i9FG-qHYJO78nzpbxU,5335
44
+ docling_core-1.1.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
45
+ docling_core-1.1.3.dist-info/entry_points.txt,sha256=XHhtJEkdUuLxXSNxLdFIzx_siQ3z2UFQEKp-P8VYAE4,189
46
+ docling_core-1.1.3.dist-info/RECORD,,