docling-metrics-core 0.1.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.
@@ -0,0 +1,446 @@
1
+ *~
2
+ scratch/
3
+ .worktrees/
4
+
5
+ # Created by https://www.toptal.com/developers/gitignore/api/python,macos,virtualenv,pycharm,visualstudiocode,emacs,vim,jupyternotebooks
6
+ # Edit at https://www.toptal.com/developers/gitignore?templates=python,macos,virtualenv,pycharm,visualstudiocode,emacs,vim,jupyternotebooks
7
+
8
+ ### Emacs ###
9
+ # -*- mode: gitignore; -*-
10
+ *~
11
+ \#*\#
12
+ /.emacs.desktop
13
+ /.emacs.desktop.lock
14
+ *.elc
15
+ auto-save-list
16
+ tramp
17
+ .\#*
18
+
19
+ # Org-mode
20
+ .org-id-locations
21
+ *_archive
22
+
23
+ # flymake-mode
24
+ *_flymake.*
25
+
26
+ # eshell files
27
+ /eshell/history
28
+ /eshell/lastdir
29
+
30
+ # elpa packages
31
+ /elpa/
32
+
33
+ # reftex files
34
+ *.rel
35
+
36
+ # AUCTeX auto folder
37
+ /auto/
38
+
39
+ # cask packages
40
+ .cask/
41
+ dist/
42
+
43
+ # Flycheck
44
+ flycheck_*.el
45
+
46
+ # server auth directory
47
+ /server/
48
+
49
+ # projectiles files
50
+ .projectile
51
+
52
+ # directory configuration
53
+ .dir-locals.el
54
+
55
+ # network security
56
+ /network-security.data
57
+
58
+
59
+ ### JupyterNotebooks ###
60
+ # gitignore template for Jupyter Notebooks
61
+ # website: http://jupyter.org/
62
+
63
+ .ipynb_checkpoints
64
+ */.ipynb_checkpoints/*
65
+
66
+ # IPython
67
+ profile_default/
68
+ ipython_config.py
69
+
70
+ # Remove previous ipynb_checkpoints
71
+ # git rm -r .ipynb_checkpoints/
72
+
73
+ ### macOS ###
74
+ # General
75
+ .DS_Store
76
+ .AppleDouble
77
+ .LSOverride
78
+
79
+ # Icon must end with two \r
80
+ Icon
81
+
82
+
83
+ # Thumbnails
84
+ ._*
85
+
86
+ # Files that might appear in the root of a volume
87
+ .DocumentRevisions-V100
88
+ .fseventsd
89
+ .Spotlight-V100
90
+ .TemporaryItems
91
+ .Trashes
92
+ .VolumeIcon.icns
93
+ .com.apple.timemachine.donotpresent
94
+
95
+ # Directories potentially created on remote AFP share
96
+ .AppleDB
97
+ .AppleDesktop
98
+ Network Trash Folder
99
+ Temporary Items
100
+ .apdisk
101
+
102
+ ### macOS Patch ###
103
+ # iCloud generated files
104
+ *.icloud
105
+
106
+ ### PyCharm ###
107
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
108
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
109
+
110
+ # User-specific stuff
111
+ .idea/**/workspace.xml
112
+ .idea/**/tasks.xml
113
+ .idea/**/usage.statistics.xml
114
+ .idea/**/dictionaries
115
+ .idea/**/shelf
116
+
117
+ # AWS User-specific
118
+ .idea/**/aws.xml
119
+
120
+ # Generated files
121
+ .idea/**/contentModel.xml
122
+
123
+ # Sensitive or high-churn files
124
+ .idea/**/dataSources/
125
+ .idea/**/dataSources.ids
126
+ .idea/**/dataSources.local.xml
127
+ .idea/**/sqlDataSources.xml
128
+ .idea/**/dynamic.xml
129
+ .idea/**/uiDesigner.xml
130
+ .idea/**/dbnavigator.xml
131
+
132
+ # Gradle
133
+ .idea/**/gradle.xml
134
+ .idea/**/libraries
135
+
136
+ # Gradle and Maven with auto-import
137
+ # When using Gradle or Maven with auto-import, you should exclude module files,
138
+ # since they will be recreated, and may cause churn. Uncomment if using
139
+ # auto-import.
140
+ # .idea/artifacts
141
+ # .idea/compiler.xml
142
+ # .idea/jarRepositories.xml
143
+ # .idea/modules.xml
144
+ # .idea/*.iml
145
+ # .idea/modules
146
+ # *.iml
147
+ # *.ipr
148
+
149
+ # CMake
150
+ cmake-build-*/
151
+
152
+ # Mongo Explorer plugin
153
+ .idea/**/mongoSettings.xml
154
+
155
+ # File-based project format
156
+ *.iws
157
+
158
+ # IntelliJ
159
+ out/
160
+
161
+ # mpeltonen/sbt-idea plugin
162
+ .idea_modules/
163
+
164
+ # JIRA plugin
165
+ atlassian-ide-plugin.xml
166
+
167
+ # Cursive Clojure plugin
168
+ .idea/replstate.xml
169
+
170
+ # SonarLint plugin
171
+ .idea/sonarlint/
172
+
173
+ # Crashlytics plugin (for Android Studio and IntelliJ)
174
+ com_crashlytics_export_strings.xml
175
+ crashlytics.properties
176
+ crashlytics-build.properties
177
+ fabric.properties
178
+
179
+ # Editor-based Rest Client
180
+ .idea/httpRequests
181
+
182
+ # Android studio 3.1+ serialized cache file
183
+ .idea/caches/build_file_checksums.ser
184
+
185
+ ### PyCharm Patch ###
186
+ # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
187
+
188
+ # *.iml
189
+ # modules.xml
190
+ # .idea/misc.xml
191
+ # *.ipr
192
+
193
+ # Sonarlint plugin
194
+ # https://plugins.jetbrains.com/plugin/7973-sonarlint
195
+ .idea/**/sonarlint/
196
+
197
+ # SonarQube Plugin
198
+ # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
199
+ .idea/**/sonarIssues.xml
200
+
201
+ # Markdown Navigator plugin
202
+ # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
203
+ .idea/**/markdown-navigator.xml
204
+ .idea/**/markdown-navigator-enh.xml
205
+ .idea/**/markdown-navigator/
206
+
207
+ # Cache file creation bug
208
+ # See https://youtrack.jetbrains.com/issue/JBR-2257
209
+ .idea/$CACHE_FILE$
210
+
211
+ # CodeStream plugin
212
+ # https://plugins.jetbrains.com/plugin/12206-codestream
213
+ .idea/codestream.xml
214
+
215
+ # Azure Toolkit for IntelliJ plugin
216
+ # https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
217
+ .idea/**/azureSettings.xml
218
+
219
+ ### Python ###
220
+ # Byte-compiled / optimized / DLL files
221
+ __pycache__/
222
+ *.py[cod]
223
+ *$py.class
224
+
225
+ # C extensions
226
+ *.so
227
+
228
+ # Distribution / packaging
229
+ .Python
230
+ build/
231
+ develop-eggs/
232
+ downloads/
233
+ eggs/
234
+ .eggs/
235
+ lib/
236
+ lib64/
237
+ parts/
238
+ sdist/
239
+ var/
240
+ wheels/
241
+ share/python-wheels/
242
+ *.egg-info/
243
+ .installed.cfg
244
+ *.egg
245
+ MANIFEST
246
+
247
+ # PyInstaller
248
+ # Usually these files are written by a python script from a template
249
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
250
+ *.manifest
251
+ *.spec
252
+
253
+ # Installer logs
254
+ pip-log.txt
255
+ pip-delete-this-directory.txt
256
+
257
+ # Unit test / coverage reports
258
+ htmlcov/
259
+ .tox/
260
+ .nox/
261
+ .coverage
262
+ .coverage.*
263
+ .cache
264
+ nosetests.xml
265
+ coverage.xml
266
+ *.cover
267
+ *.py,cover
268
+ .hypothesis/
269
+ .pytest_cache/
270
+ cover/
271
+
272
+ # Translations
273
+ *.mo
274
+ *.pot
275
+
276
+ # Django stuff:
277
+ *.log
278
+ local_settings.py
279
+ db.sqlite3
280
+ db.sqlite3-journal
281
+
282
+ # Flask stuff:
283
+ instance/
284
+ .webassets-cache
285
+
286
+ # Scrapy stuff:
287
+ .scrapy
288
+
289
+ # Sphinx documentation
290
+ docs/_build/
291
+
292
+ # PyBuilder
293
+ .pybuilder/
294
+ target/
295
+
296
+ # Jupyter Notebook
297
+
298
+ # IPython
299
+
300
+ # pyenv
301
+ # For a library or package, you might want to ignore these files since the code is
302
+ # intended to run in multiple environments; otherwise, check them in:
303
+ # .python-version
304
+
305
+ # pipenv
306
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
307
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
308
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
309
+ # install all needed dependencies.
310
+ #Pipfile.lock
311
+
312
+ # poetry
313
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
314
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
315
+ # commonly ignored for libraries.
316
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
317
+ #poetry.lock
318
+
319
+ # pdm
320
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
321
+ #pdm.lock
322
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
323
+ # in version control.
324
+ # https://pdm.fming.dev/#use-with-ide
325
+ .pdm.toml
326
+
327
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
328
+ __pypackages__/
329
+
330
+ # Celery stuff
331
+ celerybeat-schedule
332
+ celerybeat.pid
333
+
334
+ # SageMath parsed files
335
+ *.sage.py
336
+
337
+ # Environments
338
+ .env
339
+ .venv
340
+ env/
341
+ venv/
342
+ ENV/
343
+ env.bak/
344
+ venv.bak/
345
+
346
+ # Spyder project settings
347
+ .spyderproject
348
+ .spyproject
349
+
350
+ # Rope project settings
351
+ .ropeproject
352
+
353
+ # mkdocs documentation
354
+ /site
355
+
356
+ # mypy
357
+ .mypy_cache/
358
+ .dmypy.json
359
+ dmypy.json
360
+
361
+ # Pyre type checker
362
+ .pyre/
363
+
364
+ # pytype static type analyzer
365
+ .pytype/
366
+
367
+ # Cython debug symbols
368
+ cython_debug/
369
+
370
+ # PyCharm
371
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
372
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
373
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
374
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
375
+ .idea/
376
+
377
+ ### Python Patch ###
378
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
379
+ poetry.toml
380
+
381
+ # ruff
382
+ .ruff_cache/
383
+
384
+ ### Vim ###
385
+ # Swap
386
+ [._]*.s[a-v][a-z]
387
+ !*.svg # comment out if you don't need vector files
388
+ [._]*.sw[a-p]
389
+ [._]s[a-rt-v][a-z]
390
+ [._]ss[a-gi-z]
391
+ [._]sw[a-p]
392
+
393
+ # Session
394
+ Session.vim
395
+ Sessionx.vim
396
+
397
+ # Temporary
398
+ .netrwhist
399
+ # Auto-generated tag files
400
+ tags
401
+ # Persistent undo
402
+ [._]*.un~
403
+
404
+
405
+ ### Visual Studio Code ###
406
+ .vscode/
407
+
408
+ ### VirtualEnv ###
409
+ # Virtualenv
410
+ # http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
411
+ [Bb]in
412
+ [Ii]nclude
413
+ [Ll]ib
414
+ [Ll]ib64
415
+ [Ll]ocal
416
+ pyvenv.cfg
417
+ pip-selfcheck.json
418
+
419
+ ### VisualStudioCode ###
420
+ .vscode/*
421
+ !.vscode/settings.json
422
+ !.vscode/tasks.json
423
+ !.vscode/launch.json
424
+ !.vscode/extensions.json
425
+ !.vscode/*.code-snippets
426
+
427
+ # Local History for Visual Studio Code
428
+ .history/
429
+
430
+ # Built Visual Studio Code Extensions
431
+ *.vsix
432
+
433
+ ### VisualStudioCode Patch ###
434
+ # Ignore all local history of files
435
+ .history
436
+ .ionide
437
+
438
+
439
+ # Docs
440
+ # docs/**/*.png
441
+ # docs/**/*.svg
442
+
443
+
444
+ # AI tools
445
+ **/.bob/
446
+
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: docling-metrics-core
3
+ Version: 0.1.0
4
+ Summary: Metric types and evaluation utilities for Docling document processing
5
+ Project-URL: homepage, https://github.com/docling-project/docling-metrics
6
+ Project-URL: repository, https://github.com/docling-project/docling-metrics
7
+ Project-URL: issues, https://github.com/docling-project/docling-metrics/issues
8
+ Author-email: Christoph Auer <cau@zurich.ibm.com>, Panos Vagenas <pva@zurich.ibm.com>, Ahmed Nassar <ahn@zurich.ibm.com>, Nikos Livathinos <nli@zurich.ibm.com>, Maxim Lysak <mly@zurich.ibm.com>, Michele Dolfi <dol@zurich.ibm.com>, Peter Staar <taa@zurich.ibm.com>
9
+ License-Expression: MIT
10
+ Keywords: docling,evaluation,metrics,types
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Requires-Python: <4.0,>=3.10
19
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # docling-metrics-core
23
+
24
+ A minimal interface for computing and aggregating metrics on paired data samples.
25
+
26
+ ## Overview
27
+
28
+ This package provides base types for building metrics that:
29
+ - Evaluate pairs of input samples (e.g., ground-truth vs. prediction)
30
+ - Produce per-sample results traceable by sample ID
31
+ - Aggregate results across multiple samples
32
+
33
+ ## Core Types
34
+
35
+ - **`BaseInputSample`** — Input data with a unique `id` shared between sample pairs
36
+ - **`BaseSampleResult`** — Output of evaluating a single sample pair
37
+ - **`BaseAggregateResult`** — Output of aggregating multiple sample results
38
+ - **`BaseMetric`** — Abstract interface defining `evaluate_sample`, `aggregate`, and `evaluate_dataset`
39
+
40
+ ## Installation
41
+
42
+ ```bash
43
+ pip install docling-metrics-core
44
+ ```
45
+
46
+ ## Requirements
47
+
48
+ - Python >=3.10,<4.0
49
+
50
+ ## Usage
51
+
52
+ *Coming soon*
53
+
54
+ ## Development
55
+
56
+ ```bash
57
+ # Install in development mode
58
+ uv sync
59
+
60
+ # Run tests
61
+ uv run pytest
62
+ ```
63
+
64
+ ## License
65
+
66
+ MIT
@@ -0,0 +1,45 @@
1
+ # docling-metrics-core
2
+
3
+ A minimal interface for computing and aggregating metrics on paired data samples.
4
+
5
+ ## Overview
6
+
7
+ This package provides base types for building metrics that:
8
+ - Evaluate pairs of input samples (e.g., ground-truth vs. prediction)
9
+ - Produce per-sample results traceable by sample ID
10
+ - Aggregate results across multiple samples
11
+
12
+ ## Core Types
13
+
14
+ - **`BaseInputSample`** — Input data with a unique `id` shared between sample pairs
15
+ - **`BaseSampleResult`** — Output of evaluating a single sample pair
16
+ - **`BaseAggregateResult`** — Output of aggregating multiple sample results
17
+ - **`BaseMetric`** — Abstract interface defining `evaluate_sample`, `aggregate`, and `evaluate_dataset`
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install docling-metrics-core
23
+ ```
24
+
25
+ ## Requirements
26
+
27
+ - Python >=3.10,<4.0
28
+
29
+ ## Usage
30
+
31
+ *Coming soon*
32
+
33
+ ## Development
34
+
35
+ ```bash
36
+ # Install in development mode
37
+ uv sync
38
+
39
+ # Run tests
40
+ uv run pytest
41
+ ```
42
+
43
+ ## License
44
+
45
+ MIT
@@ -0,0 +1 @@
1
+ """Metric types and evaluation utilities for Docling document processing."""
@@ -0,0 +1,56 @@
1
+ from abc import ABC, abstractmethod
2
+ from typing import Annotated, Iterable, Optional
3
+
4
+ from pydantic import BaseModel, Field
5
+
6
+
7
+ class BaseInputSample(BaseModel):
8
+ """Base class for input samples to metrics."""
9
+
10
+ id: Annotated[
11
+ str,
12
+ Field(
13
+ description="Unique sample identifier, shared between ground-truth and predictions"
14
+ ),
15
+ ]
16
+
17
+
18
+ class BaseSampleResult(BaseModel):
19
+ """Output of a single sample evaluation."""
20
+
21
+ id: Annotated[
22
+ str, Field(description="Sample identifier from the evaluated input pair")
23
+ ]
24
+
25
+
26
+ class BaseAggregateResult(BaseModel):
27
+ """Output of aggregating multiple sample results."""
28
+
29
+ sample_count: Annotated[
30
+ int, Field(description="Number of samples that contributed to this result")
31
+ ]
32
+
33
+
34
+ class BaseMetric(ABC):
35
+ """Abstract base class defining the interface for all metrics."""
36
+
37
+ @abstractmethod
38
+ def evaluate_sample(
39
+ self, sample_a: BaseInputSample, sample_b: BaseInputSample
40
+ ) -> BaseSampleResult:
41
+ """Evaluate a single sample pair."""
42
+ ...
43
+
44
+ @abstractmethod
45
+ def aggregate(
46
+ self, results: Iterable[BaseSampleResult]
47
+ ) -> Optional[BaseAggregateResult]:
48
+ """Aggregate multiple sample results."""
49
+ ...
50
+
51
+ @abstractmethod
52
+ def evaluate_dataset(
53
+ self, sample_pairs: Iterable[BaseInputSample]
54
+ ) -> BaseAggregateResult:
55
+ """Evaluate an entire dataset."""
56
+ ...
@@ -0,0 +1,66 @@
1
+ [project]
2
+ name = "docling-metrics-core"
3
+ version = "0.1.0" # DO NOT EDIT, updated automatically
4
+ description = "Metric types and evaluation utilities for Docling document processing"
5
+ license = "MIT"
6
+ keywords = ["docling", "metrics", "evaluation", "types"]
7
+ readme = "README.md"
8
+ authors = [
9
+ { name = "Christoph Auer", email = "cau@zurich.ibm.com" },
10
+ { name = "Panos Vagenas", email = "pva@zurich.ibm.com" },
11
+ { name = "Ahmed Nassar", email = "ahn@zurich.ibm.com" },
12
+ { name = "Nikos Livathinos", email = "nli@zurich.ibm.com" },
13
+ { name = "Maxim Lysak", email = "mly@zurich.ibm.com" },
14
+ { name = "Michele Dolfi", email = "dol@zurich.ibm.com" },
15
+ { name = "Peter Staar", email = "taa@zurich.ibm.com" },
16
+ ]
17
+ classifiers = [
18
+ "Operating System :: MacOS :: MacOS X",
19
+ "Operating System :: POSIX :: Linux",
20
+ "Development Status :: 4 - Beta",
21
+ "Intended Audience :: Developers",
22
+ "Intended Audience :: Science/Research",
23
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
24
+ "Programming Language :: Python :: 3",
25
+ ]
26
+ requires-python = '>=3.10,<4.0'
27
+ dependencies = [
28
+ "pydantic>=2.0.0,<3.0.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ homepage = "https://github.com/docling-project/docling-metrics"
33
+ repository = "https://github.com/docling-project/docling-metrics"
34
+ issues = "https://github.com/docling-project/docling-metrics/issues"
35
+
36
+ [build-system]
37
+ requires = ["hatchling"]
38
+ build-backend = "hatchling.build"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["docling_metrics_core"]
42
+
43
+ [tool.uv]
44
+ package = true
45
+
46
+ [dependency-groups]
47
+ test = [
48
+ "coverage~=7.6",
49
+ "pytest~=8.3",
50
+ "pytest-cov>=6.1.1",
51
+ "pytest-dependency~=0.6",
52
+ "pytest-xdist~=3.3",
53
+ ]
54
+
55
+ [tool.semantic_release]
56
+ # for default values check:
57
+ # https://github.com/python-semantic-release/python-semantic-release/blob/v7.32.2/semantic_release/defaults.cfg
58
+
59
+ version_source = "tag_only"
60
+ branch = "main"
61
+
62
+ # configure types which should trigger minor and patch version bumps respectively
63
+ # (note that they must be a subset of the configured allowed types):
64
+ parser_angular_allowed_types = "build,chore,ci,docs,feat,fix,perf,style,refactor,test"
65
+ parser_angular_minor_types = "feat"
66
+ parser_angular_patch_types = "fix,perf"