docling-core 2.39.0__tar.gz → 2.40.0__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.39.0 → docling_core-2.40.0}/PKG-INFO +1 -1
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/document.py +5 -3
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/page.py +3 -2
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core.egg-info/PKG-INFO +1 -1
- {docling_core-2.39.0 → docling_core-2.40.0}/pyproject.toml +1 -1
- docling_core-2.40.0/test/test_page.py +214 -0
- docling_core-2.39.0/test/test_page.py +0 -79
- {docling_core-2.39.0 → docling_core-2.40.0}/LICENSE +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/README.md +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/cli/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/cli/view.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/experimental/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/py.typed +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/doc/ANN.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/doc/DOC.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/doc/OCR-output.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/doc/RAW.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/generated/ccs_document_schema.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/generated/minimal_document_schema_flat.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/search/search_doc_mapping.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/resources/schemas/search/search_doc_mapping_v2.json +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/search/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/search/json_schema_to_search_mapper.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/search/mapping.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/search/meta.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/search/package.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/hierarchical_chunker.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/hybrid_chunker.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/huggingface.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/openai.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/common.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/doctags.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/html.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/html_styles.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/markdown.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/layout_visualizer.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/reading_order_visualizer.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/table_visualizer.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/labels.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/tokens.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/doc/utils.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/gen/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/gen/generic.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/io/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/doc_ann.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/doc_ocr.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/doc_raw.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/document.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/legacy_doc/tokens.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/nlp/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/nlp/qa.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/nlp/qa_labels.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/attribute.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/predicate.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/record.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/statement.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/types/rec/subject.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/__init__.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/alias.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/file.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/generate_docs.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/generate_jsonschema.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/legacy.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/validate.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core/utils/validators.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core.egg-info/SOURCES.txt +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core.egg-info/dependency_links.txt +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core.egg-info/entry_points.txt +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core.egg-info/requires.txt +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/docling_core.egg-info/top_level.txt +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/setup.cfg +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_collection.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_data_gen_flag.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_doc_base.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_doc_legacy_convert.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_doc_schema.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_doc_schema_extractor.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_docling_doc.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_doctags_load.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_hierarchical_chunker.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_hybrid_chunker.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_json_schema_to_search_mapper.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_nlp_qa.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_otsl_table_export.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_rec_schema.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_search_meta.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_serialization.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_utils.py +0 -0
- {docling_core-2.39.0 → docling_core-2.40.0}/test/test_visualization.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docling-core
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.40.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>
|
|
@@ -731,9 +731,11 @@ class ProvenanceItem(BaseModel):
|
|
|
731
731
|
class ContentLayer(str, Enum):
|
|
732
732
|
"""ContentLayer."""
|
|
733
733
|
|
|
734
|
-
BODY = "body"
|
|
735
|
-
FURNITURE = "furniture"
|
|
736
|
-
BACKGROUND = "background"
|
|
734
|
+
BODY = "body" # main content of the document
|
|
735
|
+
FURNITURE = "furniture" # eg page-headers/footers
|
|
736
|
+
BACKGROUND = "background" # eg watermarks
|
|
737
|
+
INVISIBLE = "invisible" # hidden or invisible text
|
|
738
|
+
NOTES = "notes" # author/speaker notes, corrections, etc
|
|
737
739
|
|
|
738
740
|
|
|
739
741
|
DEFAULT_CONTENT_LAYERS = {ContentLayer.BODY}
|
|
@@ -122,6 +122,8 @@ class BoundingRectangle(BaseModel):
|
|
|
122
122
|
p_1 = ((self.r_x1 + self.r_x2) / 2.0, (self.r_y1 + self.r_y2) / 2.0)
|
|
123
123
|
|
|
124
124
|
delta_x, delta_y = p_1[0] - p_0[0], p_1[1] - p_0[1]
|
|
125
|
+
if self.coord_origin == CoordOrigin.TOPLEFT:
|
|
126
|
+
delta_y = -delta_y
|
|
125
127
|
|
|
126
128
|
if abs(delta_y) < 1.0e-3:
|
|
127
129
|
angle = 0.0
|
|
@@ -131,8 +133,7 @@ class BoundingRectangle(BaseModel):
|
|
|
131
133
|
angle = math.atan(delta_y / delta_x)
|
|
132
134
|
if delta_x < 0:
|
|
133
135
|
angle += np.pi
|
|
134
|
-
|
|
135
|
-
angle += 2 * np.pi
|
|
136
|
+
angle = angle % (2 * np.pi)
|
|
136
137
|
return angle
|
|
137
138
|
|
|
138
139
|
@property
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docling-core
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.40.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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "docling-core"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.40.0" # DO NOT EDIT, updated automatically
|
|
4
4
|
description = "A python library to define and validate data types in Docling."
|
|
5
5
|
license = "MIT"
|
|
6
6
|
license-files = ["LICENSE"]
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import math
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pytest
|
|
5
|
+
|
|
6
|
+
from docling_core.types.doc import CoordOrigin
|
|
7
|
+
from docling_core.types.doc.page import BoundingRectangle
|
|
8
|
+
|
|
9
|
+
SQRT_2 = math.sqrt(2)
|
|
10
|
+
|
|
11
|
+
R_0_BL = BoundingRectangle(
|
|
12
|
+
r_x0=0,
|
|
13
|
+
r_y0=0,
|
|
14
|
+
r_x1=1,
|
|
15
|
+
r_y1=0,
|
|
16
|
+
r_x2=1,
|
|
17
|
+
r_y2=1,
|
|
18
|
+
r_x3=0,
|
|
19
|
+
r_y3=1,
|
|
20
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
21
|
+
)
|
|
22
|
+
R_0_TL = BoundingRectangle(
|
|
23
|
+
r_x0=0,
|
|
24
|
+
r_y0=0,
|
|
25
|
+
r_x1=1,
|
|
26
|
+
r_y1=0,
|
|
27
|
+
r_x2=1,
|
|
28
|
+
r_y2=1,
|
|
29
|
+
r_x3=0,
|
|
30
|
+
r_y3=1,
|
|
31
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
32
|
+
)
|
|
33
|
+
R_45_BL = BoundingRectangle(
|
|
34
|
+
r_x0=0,
|
|
35
|
+
r_y0=0,
|
|
36
|
+
r_x1=SQRT_2 / 2,
|
|
37
|
+
r_y1=SQRT_2 / 2,
|
|
38
|
+
r_x2=0,
|
|
39
|
+
r_y2=SQRT_2,
|
|
40
|
+
r_x3=-SQRT_2 / 2,
|
|
41
|
+
r_y3=SQRT_2 / 2,
|
|
42
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
43
|
+
)
|
|
44
|
+
R_45_TL = BoundingRectangle(
|
|
45
|
+
r_x0=0,
|
|
46
|
+
r_y0=0,
|
|
47
|
+
r_x1=SQRT_2 / 2,
|
|
48
|
+
r_y1=-SQRT_2 / 2,
|
|
49
|
+
r_x2=0,
|
|
50
|
+
r_y2=-SQRT_2,
|
|
51
|
+
r_x3=-SQRT_2 / 2,
|
|
52
|
+
r_y3=-SQRT_2 / 2,
|
|
53
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
54
|
+
)
|
|
55
|
+
R_90_BL = BoundingRectangle(
|
|
56
|
+
r_x0=0,
|
|
57
|
+
r_y0=0,
|
|
58
|
+
r_x1=0,
|
|
59
|
+
r_y1=1,
|
|
60
|
+
r_x2=-1,
|
|
61
|
+
r_y2=1,
|
|
62
|
+
r_x3=-1,
|
|
63
|
+
r_y3=0,
|
|
64
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
65
|
+
)
|
|
66
|
+
R_90_TL = BoundingRectangle(
|
|
67
|
+
r_x0=0,
|
|
68
|
+
r_y0=0,
|
|
69
|
+
r_x1=0,
|
|
70
|
+
r_y1=-1,
|
|
71
|
+
r_x2=-1,
|
|
72
|
+
r_y2=-1,
|
|
73
|
+
r_x3=-1,
|
|
74
|
+
r_y3=0,
|
|
75
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
76
|
+
)
|
|
77
|
+
R_135_BL = BoundingRectangle(
|
|
78
|
+
r_x0=0,
|
|
79
|
+
r_y0=0,
|
|
80
|
+
r_x1=-SQRT_2 / 2,
|
|
81
|
+
r_y1=SQRT_2 / 2,
|
|
82
|
+
r_x2=-SQRT_2,
|
|
83
|
+
r_y2=0,
|
|
84
|
+
r_x3=-SQRT_2 / 2,
|
|
85
|
+
r_y3=-SQRT_2 / 2,
|
|
86
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
87
|
+
)
|
|
88
|
+
R_135_TL = BoundingRectangle(
|
|
89
|
+
r_x0=0,
|
|
90
|
+
r_y0=0,
|
|
91
|
+
r_x1=-SQRT_2 / 2,
|
|
92
|
+
r_y1=-SQRT_2 / 2,
|
|
93
|
+
r_x2=-SQRT_2,
|
|
94
|
+
r_y2=0,
|
|
95
|
+
r_x3=-SQRT_2 / 2,
|
|
96
|
+
r_y3=SQRT_2 / 2,
|
|
97
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
98
|
+
)
|
|
99
|
+
R_180_BL = BoundingRectangle(
|
|
100
|
+
r_x0=0,
|
|
101
|
+
r_y0=0,
|
|
102
|
+
r_x1=-0,
|
|
103
|
+
r_y1=0,
|
|
104
|
+
r_x2=-1,
|
|
105
|
+
r_y2=-1,
|
|
106
|
+
r_x3=0,
|
|
107
|
+
r_y3=-1,
|
|
108
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
109
|
+
)
|
|
110
|
+
R_180_TL = BoundingRectangle(
|
|
111
|
+
r_x0=0,
|
|
112
|
+
r_y0=0,
|
|
113
|
+
r_x1=-0,
|
|
114
|
+
r_y1=0,
|
|
115
|
+
r_x2=-1,
|
|
116
|
+
r_y2=1,
|
|
117
|
+
r_x3=0,
|
|
118
|
+
r_y3=1,
|
|
119
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
120
|
+
)
|
|
121
|
+
R_225_BL = BoundingRectangle(
|
|
122
|
+
r_x0=0,
|
|
123
|
+
r_y0=0,
|
|
124
|
+
r_x1=-SQRT_2 / 2,
|
|
125
|
+
r_y1=-SQRT_2 / 2,
|
|
126
|
+
r_x2=0,
|
|
127
|
+
r_y2=-SQRT_2,
|
|
128
|
+
r_x3=SQRT_2 / 2,
|
|
129
|
+
r_y3=-SQRT_2 / 2,
|
|
130
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
131
|
+
)
|
|
132
|
+
R_225_TL = BoundingRectangle(
|
|
133
|
+
r_x0=0,
|
|
134
|
+
r_y0=0,
|
|
135
|
+
r_x1=-SQRT_2 / 2,
|
|
136
|
+
r_y1=SQRT_2 / 2,
|
|
137
|
+
r_x2=0,
|
|
138
|
+
r_y2=SQRT_2,
|
|
139
|
+
r_x3=SQRT_2 / 2,
|
|
140
|
+
r_y3=SQRT_2 / 2,
|
|
141
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
142
|
+
)
|
|
143
|
+
R_270_BL = BoundingRectangle(
|
|
144
|
+
r_x0=0,
|
|
145
|
+
r_y0=0,
|
|
146
|
+
r_x1=0,
|
|
147
|
+
r_y1=-1,
|
|
148
|
+
r_x2=1,
|
|
149
|
+
r_y2=-1,
|
|
150
|
+
r_x3=1,
|
|
151
|
+
r_y3=0,
|
|
152
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
153
|
+
)
|
|
154
|
+
R_270_TL = BoundingRectangle(
|
|
155
|
+
r_x0=0,
|
|
156
|
+
r_y0=0,
|
|
157
|
+
r_x1=0,
|
|
158
|
+
r_y1=1,
|
|
159
|
+
r_x2=1,
|
|
160
|
+
r_y2=1,
|
|
161
|
+
r_x3=1,
|
|
162
|
+
r_y3=0,
|
|
163
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
164
|
+
)
|
|
165
|
+
R_315_BL = BoundingRectangle(
|
|
166
|
+
r_x0=0,
|
|
167
|
+
r_y0=0,
|
|
168
|
+
r_x1=SQRT_2 / 2,
|
|
169
|
+
r_y1=-SQRT_2 / 2,
|
|
170
|
+
r_x2=SQRT_2,
|
|
171
|
+
r_y2=0,
|
|
172
|
+
r_x3=SQRT_2 / 2,
|
|
173
|
+
r_y3=SQRT_2 / 2,
|
|
174
|
+
coord_origin=CoordOrigin.BOTTOMLEFT,
|
|
175
|
+
)
|
|
176
|
+
R_315_TL = BoundingRectangle(
|
|
177
|
+
r_x0=0,
|
|
178
|
+
r_y0=0,
|
|
179
|
+
r_x1=SQRT_2 / 2,
|
|
180
|
+
r_y1=SQRT_2 / 2,
|
|
181
|
+
r_x2=SQRT_2,
|
|
182
|
+
r_y2=0,
|
|
183
|
+
r_x3=SQRT_2 / 2,
|
|
184
|
+
r_y3=-SQRT_2 / 2,
|
|
185
|
+
coord_origin=CoordOrigin.TOPLEFT,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@pytest.mark.parametrize(
|
|
190
|
+
("rectangle", "expected_angle", "expected_angle_360"),
|
|
191
|
+
[
|
|
192
|
+
(R_0_BL, 0, 0.0),
|
|
193
|
+
(R_45_BL, np.pi / 4, 45),
|
|
194
|
+
(R_90_BL, np.pi / 2, 90),
|
|
195
|
+
(R_135_BL, 3 * np.pi / 4, 135),
|
|
196
|
+
(R_180_BL, np.pi, 180),
|
|
197
|
+
(R_225_BL, 5 * np.pi / 4, 225),
|
|
198
|
+
(R_270_BL, 3 * np.pi / 2, 270),
|
|
199
|
+
(R_315_BL, 7 * np.pi / 4, 315),
|
|
200
|
+
(R_0_TL, 0, 0.0),
|
|
201
|
+
(R_45_TL, np.pi / 4, 45),
|
|
202
|
+
(R_90_TL, np.pi / 2, 90),
|
|
203
|
+
(R_135_TL, 3 * np.pi / 4, 135),
|
|
204
|
+
(R_180_TL, np.pi, 180),
|
|
205
|
+
(R_225_TL, 5 * np.pi / 4, 225),
|
|
206
|
+
(R_270_TL, 3 * np.pi / 2, 270),
|
|
207
|
+
(R_315_TL, 7 * np.pi / 4, 315),
|
|
208
|
+
],
|
|
209
|
+
)
|
|
210
|
+
def test_bounding_rectangle_angle(
|
|
211
|
+
rectangle: BoundingRectangle, expected_angle: float, expected_angle_360: int
|
|
212
|
+
):
|
|
213
|
+
assert pytest.approx(rectangle.angle, abs=1e-6) == expected_angle
|
|
214
|
+
assert pytest.approx(rectangle.angle_360, abs=1e-6) == expected_angle_360
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import math
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
import pytest
|
|
5
|
-
|
|
6
|
-
from docling_core.types.doc.page import BoundingRectangle
|
|
7
|
-
|
|
8
|
-
SQRT_2 = math.sqrt(2)
|
|
9
|
-
|
|
10
|
-
R_0 = BoundingRectangle(r_x0=0, r_y0=0, r_x1=1, r_y1=0, r_x2=1, r_y2=1, r_x3=0, r_y3=1)
|
|
11
|
-
R_45 = BoundingRectangle(
|
|
12
|
-
r_x0=0,
|
|
13
|
-
r_y0=0,
|
|
14
|
-
r_x1=SQRT_2 / 2,
|
|
15
|
-
r_y1=SQRT_2 / 2,
|
|
16
|
-
r_x2=0,
|
|
17
|
-
r_y2=SQRT_2,
|
|
18
|
-
r_x3=-SQRT_2 / 2,
|
|
19
|
-
r_y3=SQRT_2 / 2,
|
|
20
|
-
)
|
|
21
|
-
R_90 = BoundingRectangle(
|
|
22
|
-
r_x0=0, r_y0=0, r_x1=0, r_y1=1, r_x2=-1, r_y2=1, r_x3=-1, r_y3=0
|
|
23
|
-
)
|
|
24
|
-
R_135 = BoundingRectangle(
|
|
25
|
-
r_x0=0,
|
|
26
|
-
r_y0=0,
|
|
27
|
-
r_x1=-SQRT_2 / 2,
|
|
28
|
-
r_y1=SQRT_2 / 2,
|
|
29
|
-
r_x2=-SQRT_2,
|
|
30
|
-
r_y2=0,
|
|
31
|
-
r_x3=-SQRT_2 / 2,
|
|
32
|
-
r_y3=-SQRT_2 / 2,
|
|
33
|
-
)
|
|
34
|
-
R_180 = BoundingRectangle(
|
|
35
|
-
r_x0=0, r_y0=0, r_x1=-0, r_y1=0, r_x2=-1, r_y2=-1, r_x3=0, r_y3=-1
|
|
36
|
-
)
|
|
37
|
-
R_MINUS_135 = BoundingRectangle(
|
|
38
|
-
r_x0=0,
|
|
39
|
-
r_y0=0,
|
|
40
|
-
r_x1=-SQRT_2 / 2,
|
|
41
|
-
r_y1=-SQRT_2 / 2,
|
|
42
|
-
r_x2=0,
|
|
43
|
-
r_y2=-SQRT_2,
|
|
44
|
-
r_x3=SQRT_2 / 2,
|
|
45
|
-
r_y3=-SQRT_2 / 2,
|
|
46
|
-
)
|
|
47
|
-
R_MINUS_90 = BoundingRectangle(
|
|
48
|
-
r_x0=0, r_y0=0, r_x1=0, r_y1=-1, r_x2=1, r_y2=-1, r_x3=1, r_y3=0
|
|
49
|
-
)
|
|
50
|
-
R_MINUS_45 = BoundingRectangle(
|
|
51
|
-
r_x0=0,
|
|
52
|
-
r_y0=0,
|
|
53
|
-
r_x1=SQRT_2 / 2,
|
|
54
|
-
r_y1=-SQRT_2 / 2,
|
|
55
|
-
r_x2=SQRT_2,
|
|
56
|
-
r_y2=0,
|
|
57
|
-
r_x3=SQRT_2 / 2,
|
|
58
|
-
r_y3=SQRT_2 / 2,
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@pytest.mark.parametrize(
|
|
63
|
-
("rectangle", "expected_angle", "expected_angle_360"),
|
|
64
|
-
[
|
|
65
|
-
(R_0, 0, 0.0),
|
|
66
|
-
(R_45, np.pi / 4, 45),
|
|
67
|
-
(R_90, np.pi / 2, 90),
|
|
68
|
-
(R_135, 3 * np.pi / 4, 135),
|
|
69
|
-
(R_180, np.pi, 180),
|
|
70
|
-
(R_MINUS_135, 5 * np.pi / 4, 225),
|
|
71
|
-
(R_MINUS_90, 3 * np.pi / 2, 270),
|
|
72
|
-
(R_MINUS_45, 7 * np.pi / 4, 315),
|
|
73
|
-
],
|
|
74
|
-
)
|
|
75
|
-
def test_bounding_rectangle_angle(
|
|
76
|
-
rectangle: BoundingRectangle, expected_angle: float, expected_angle_360: int
|
|
77
|
-
):
|
|
78
|
-
assert pytest.approx(rectangle.angle, abs=1e-6) == expected_angle
|
|
79
|
-
assert pytest.approx(rectangle.angle_360, abs=1e-6) == expected_angle_360
|
|
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
|
{docling_core-2.39.0 → docling_core-2.40.0}/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.39.0 → docling_core-2.40.0}/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.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/hierarchical_chunker.py
RENAMED
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/hybrid_chunker.py
RENAMED
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/__init__.py
RENAMED
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/base.py
RENAMED
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/huggingface.py
RENAMED
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/chunker/tokenizer/openai.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/serializer/html_styles.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/layout_visualizer.py
RENAMED
|
File without changes
|
|
File without changes
|
{docling_core-2.39.0 → docling_core-2.40.0}/docling_core/transforms/visualizer/table_visualizer.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
|
|
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
|