From cbb23b0217b01d8229b085fea6b1405a6655f28c Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Thu, 14 Nov 2024 14:00:52 +0100 Subject: [PATCH] Revert "Moved image attribute from FloatingItem to DocItem" This reverts commit e48cd47d3743a25ce17bbaf31b3152ed53365fba. Signed-off-by: Shubham Gupta <26436285+sh-gupta@users.noreply.github.com> --- docling_core/types/doc/document.py | 2 +- docs/DoclingDocument.json | 88 +++++-------------- .../docling_document/unit/KeyValueItem.yaml | 1 - test/data/docling_document/unit/ListItem.yaml | 1 - .../unit/SectionHeaderItem.yaml | 1 - test/data/docling_document/unit/TextItem.yaml | 1 - 6 files changed, 23 insertions(+), 71 deletions(-) diff --git a/docling_core/types/doc/document.py b/docling_core/types/doc/document.py index f78002a..598f5ee 100644 --- a/docling_core/types/doc/document.py +++ b/docling_core/types/doc/document.py @@ -518,7 +518,6 @@ class DocItem( label: DocItemLabel prov: List[ProvenanceItem] = [] - image: Optional[ImageRef] = None def get_location_tokens( self, @@ -625,6 +624,7 @@ class FloatingItem(DocItem): captions: List[RefItem] = [] references: List[RefItem] = [] footnotes: List[RefItem] = [] + image: Optional[ImageRef] = None def caption_text(self, doc: "DoclingDocument") -> str: """Computes the caption as a single text.""" diff --git a/docs/DoclingDocument.json b/docs/DoclingDocument.json index 2e214a1..a514456 100644 --- a/docs/DoclingDocument.json +++ b/docs/DoclingDocument.json @@ -363,17 +363,6 @@ }, "title": "Prov", "type": "array" - }, - "image": { - "anyOf": [ - { - "$ref": "#/$defs/ImageRef" - }, - { - "type": "null" - } - ], - "default": null } }, "required": [ @@ -428,17 +417,6 @@ "title": "Prov", "type": "array" }, - "image": { - "anyOf": [ - { - "$ref": "#/$defs/ImageRef" - }, - { - "type": "null" - } - ], - "default": null - }, "orig": { "title": "Orig", "type": "string" @@ -659,17 +637,6 @@ "title": "Prov", "type": "array" }, - "image": { - "anyOf": [ - { - "$ref": "#/$defs/ImageRef" - }, - { - "type": "null" - } - ], - "default": null - }, "captions": { "default": [], "items": { @@ -694,6 +661,17 @@ "title": "Footnotes", "type": "array" }, + "image": { + "anyOf": [ + { + "$ref": "#/$defs/ImageRef" + }, + { + "type": "null" + } + ], + "default": null + }, "annotations": { "default": [], "items": { @@ -1077,17 +1055,6 @@ "title": "Prov", "type": "array" }, - "image": { - "anyOf": [ - { - "$ref": "#/$defs/ImageRef" - }, - { - "type": "null" - } - ], - "default": null - }, "orig": { "title": "Orig", "type": "string" @@ -1269,17 +1236,6 @@ "title": "Prov", "type": "array" }, - "image": { - "anyOf": [ - { - "$ref": "#/$defs/ImageRef" - }, - { - "type": "null" - } - ], - "default": null - }, "captions": { "default": [], "items": { @@ -1304,6 +1260,17 @@ "title": "Footnotes", "type": "array" }, + "image": { + "anyOf": [ + { + "$ref": "#/$defs/ImageRef" + }, + { + "type": "null" + } + ], + "default": null + }, "data": { "$ref": "#/$defs/TableData" } @@ -1354,17 +1321,6 @@ "title": "Prov", "type": "array" }, - "image": { - "anyOf": [ - { - "$ref": "#/$defs/ImageRef" - }, - { - "type": "null" - } - ], - "default": null - }, "orig": { "title": "Orig", "type": "string" diff --git a/test/data/docling_document/unit/KeyValueItem.yaml b/test/data/docling_document/unit/KeyValueItem.yaml index 0c1a181..ea7a00c 100644 --- a/test/data/docling_document/unit/KeyValueItem.yaml +++ b/test/data/docling_document/unit/KeyValueItem.yaml @@ -1,5 +1,4 @@ children: [] -image: null label: text parent: null prov: [] diff --git a/test/data/docling_document/unit/ListItem.yaml b/test/data/docling_document/unit/ListItem.yaml index f9ed1ae..e8cc4ae 100644 --- a/test/data/docling_document/unit/ListItem.yaml +++ b/test/data/docling_document/unit/ListItem.yaml @@ -1,6 +1,5 @@ children: [] enumerated: true -image: null label: list_item marker: (1) orig: whatever diff --git a/test/data/docling_document/unit/SectionHeaderItem.yaml b/test/data/docling_document/unit/SectionHeaderItem.yaml index d32393b..b4729e3 100644 --- a/test/data/docling_document/unit/SectionHeaderItem.yaml +++ b/test/data/docling_document/unit/SectionHeaderItem.yaml @@ -1,5 +1,4 @@ children: [] -image: null label: section_header level: 2 orig: whatever diff --git a/test/data/docling_document/unit/TextItem.yaml b/test/data/docling_document/unit/TextItem.yaml index c085f4c..aa56c38 100644 --- a/test/data/docling_document/unit/TextItem.yaml +++ b/test/data/docling_document/unit/TextItem.yaml @@ -1,5 +1,4 @@ children: [] -image: null label: text orig: whatever parent: null