docling-core 2.6.0__tar.gz → 2.6.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.
- {docling_core-2.6.0 → docling_core-2.6.1}/PKG-INFO +1 -1
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/doc/document.py +1 -1
- docling_core-2.6.1/docling_core/types/doc/utils.py +48 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/file.py +1 -40
- {docling_core-2.6.0 → docling_core-2.6.1}/pyproject.toml +1 -1
- {docling_core-2.6.0 → docling_core-2.6.1}/LICENSE +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/README.md +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/py.typed +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/doc/ANN.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/doc/DOC.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/doc/OCR-output.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/doc/RAW.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/generated/ccs_document_schema.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/generated/minimal_document_schema_flat.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/search/search_doc_mapping.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/search/search_doc_mapping_v2.json +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/search/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/search/json_schema_to_search_mapper.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/search/mapping.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/search/meta.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/search/package.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/transforms/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/transforms/chunker/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/transforms/chunker/base.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/transforms/chunker/hierarchical_chunker.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/base.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/doc/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/doc/base.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/doc/labels.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/gen/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/gen/generic.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/io/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/base.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/doc_ann.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/doc_ocr.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/doc_raw.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/document.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/legacy_doc/tokens.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/nlp/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/nlp/qa.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/nlp/qa_labels.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/attribute.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/base.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/predicate.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/record.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/statement.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/types/rec/subject.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/__init__.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/alias.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/generate_docs.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/generate_jsonschema.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/validate.py +0 -0
- {docling_core-2.6.0 → docling_core-2.6.1}/docling_core/utils/validators.py +0 -0
|
@@ -37,8 +37,8 @@ from docling_core.types.base import _JSON_POINTER_REGEX
|
|
|
37
37
|
from docling_core.types.doc import BoundingBox, Size
|
|
38
38
|
from docling_core.types.doc.base import ImageRefMode
|
|
39
39
|
from docling_core.types.doc.labels import DocItemLabel, GroupLabel
|
|
40
|
+
from docling_core.types.doc.utils import relative_path
|
|
40
41
|
from docling_core.types.legacy_doc.tokens import DocumentToken
|
|
41
|
-
from docling_core.utils.file import relative_path
|
|
42
42
|
|
|
43
43
|
Uint64 = typing.Annotated[int, Field(ge=0, le=(2**64 - 1))]
|
|
44
44
|
LevelNumber = typing.Annotated[int, Field(ge=1, le=100)]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright IBM Corp. 2024 - 2024
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
"""Utils for document types."""
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def relative_path(src: Path, target: Path) -> Path:
|
|
12
|
+
"""Compute the relative path from `src` to `target`.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
src (str | Path): The source directory or file path (must be absolute).
|
|
16
|
+
target (str | Path): The target directory or file path (must be absolute).
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
Path: The relative path from `src` to `target`.
|
|
20
|
+
|
|
21
|
+
Raises:
|
|
22
|
+
ValueError: If either `src` or `target` is not an absolute path.
|
|
23
|
+
"""
|
|
24
|
+
src = Path(src).resolve()
|
|
25
|
+
target = Path(target).resolve()
|
|
26
|
+
|
|
27
|
+
# Ensure both paths are absolute
|
|
28
|
+
if not src.is_absolute():
|
|
29
|
+
raise ValueError(f"The source path must be absolute: {src}")
|
|
30
|
+
if not target.is_absolute():
|
|
31
|
+
raise ValueError(f"The target path must be absolute: {target}")
|
|
32
|
+
|
|
33
|
+
# Find the common ancestor
|
|
34
|
+
common_parts = []
|
|
35
|
+
for src_part, target_part in zip(src.parts, target.parts):
|
|
36
|
+
if src_part == target_part:
|
|
37
|
+
common_parts.append(src_part)
|
|
38
|
+
else:
|
|
39
|
+
break
|
|
40
|
+
|
|
41
|
+
# Determine the path to go up from src to the common ancestor
|
|
42
|
+
up_segments = [".."] * (len(src.parts) - len(common_parts))
|
|
43
|
+
|
|
44
|
+
# Add the path from the common ancestor to the target
|
|
45
|
+
down_segments = target.parts[len(common_parts) :]
|
|
46
|
+
|
|
47
|
+
# Combine and return the result
|
|
48
|
+
return Path(*up_segments, *down_segments)
|
|
@@ -15,6 +15,7 @@ import requests
|
|
|
15
15
|
from pydantic import AnyHttpUrl, TypeAdapter, ValidationError
|
|
16
16
|
from typing_extensions import deprecated
|
|
17
17
|
|
|
18
|
+
from docling_core.types.doc.utils import relative_path # noqa
|
|
18
19
|
from docling_core.types.io import DocumentStream
|
|
19
20
|
|
|
20
21
|
|
|
@@ -168,43 +169,3 @@ def resolve_file_source(
|
|
|
168
169
|
source=source,
|
|
169
170
|
headers=headers,
|
|
170
171
|
)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
def relative_path(src: Path, target: Path) -> Path:
|
|
174
|
-
"""Compute the relative path from `src` to `target`.
|
|
175
|
-
|
|
176
|
-
Args:
|
|
177
|
-
src (str | Path): The source directory or file path (must be absolute).
|
|
178
|
-
target (str | Path): The target directory or file path (must be absolute).
|
|
179
|
-
|
|
180
|
-
Returns:
|
|
181
|
-
Path: The relative path from `src` to `target`.
|
|
182
|
-
|
|
183
|
-
Raises:
|
|
184
|
-
ValueError: If either `src` or `target` is not an absolute path.
|
|
185
|
-
"""
|
|
186
|
-
src = Path(src).resolve()
|
|
187
|
-
target = Path(target).resolve()
|
|
188
|
-
|
|
189
|
-
# Ensure both paths are absolute
|
|
190
|
-
if not src.is_absolute():
|
|
191
|
-
raise ValueError(f"The source path must be absolute: {src}")
|
|
192
|
-
if not target.is_absolute():
|
|
193
|
-
raise ValueError(f"The target path must be absolute: {target}")
|
|
194
|
-
|
|
195
|
-
# Find the common ancestor
|
|
196
|
-
common_parts = []
|
|
197
|
-
for src_part, target_part in zip(src.parts, target.parts):
|
|
198
|
-
if src_part == target_part:
|
|
199
|
-
common_parts.append(src_part)
|
|
200
|
-
else:
|
|
201
|
-
break
|
|
202
|
-
|
|
203
|
-
# Determine the path to go up from src to the common ancestor
|
|
204
|
-
up_segments = [".."] * (len(src.parts) - len(common_parts))
|
|
205
|
-
|
|
206
|
-
# Add the path from the common ancestor to the target
|
|
207
|
-
down_segments = target.parts[len(common_parts) :]
|
|
208
|
-
|
|
209
|
-
# Combine and return the result
|
|
210
|
-
return Path(*up_segments, *down_segments)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docling_core-2.6.0 → docling_core-2.6.1}/docling_core/resources/schemas/doc/OCR-output.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docling_core-2.6.0 → docling_core-2.6.1}/docling_core/search/json_schema_to_search_mapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docling_core-2.6.0 → docling_core-2.6.1}/docling_core/transforms/chunker/hierarchical_chunker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|