Skip to content

Commit bc60093

Browse files
Saidgurbuzcau-git
andauthored
feat: Add KeyValueEvaluator (#140)
* add KeyValueEvaluator Signed-off-by: Saidgurbuz <[email protected]> * add test script for keyvalue_evaluator Signed-off-by: Saidgurbuz <[email protected]> * add keyvalue_evaluator in cli Signed-off-by: Saidgurbuz <[email protected]> * add entity and link difference metrics in keyvalue evaluator Signed-off-by: Saidgurbuz <[email protected]> * update dependencies and fix style Signed-off-by: Saidgurbuz <[email protected]> * Refactor to remove levenshtein dependency Signed-off-by: Christoph Auer <[email protected]> --------- Signed-off-by: Saidgurbuz <[email protected]> Signed-off-by: Christoph Auer <[email protected]> Co-authored-by: Christoph Auer <[email protected]>
1 parent c31b107 commit bc60093

File tree

5 files changed

+830
-0
lines changed

5 files changed

+830
-0
lines changed

docling_eval/cli/main.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@
5555
from docling_eval.evaluators.base_evaluator import DatasetEvaluationType
5656
from docling_eval.evaluators.bbox_text_evaluator import BboxTextEvaluator
5757
from docling_eval.evaluators.doc_structure_evaluator import DocStructureEvaluator
58+
from docling_eval.evaluators.keyvalue_evaluator import (
59+
DatasetKeyValueEvaluation,
60+
KeyValueEvaluator,
61+
)
5862
from docling_eval.evaluators.layout_evaluator import (
5963
DatasetLayoutEvaluation,
6064
LabelFilteringStrategy,
@@ -570,7 +574,21 @@ def evaluate(
570574
idir,
571575
split=split,
572576
)
577+
with open(save_fn, "w") as fd:
578+
json.dump(
579+
evaluation.model_dump(),
580+
fd,
581+
indent=2,
582+
sort_keys=True,
583+
ensure_ascii=False,
584+
)
573585

586+
elif modality == EvaluationModality.KEY_VALUE:
587+
keyvalue_evaluator = KeyValueEvaluator()
588+
evaluation = keyvalue_evaluator( # type: ignore
589+
idir,
590+
split=split,
591+
)
574592
with open(save_fn, "w") as fd:
575593
json.dump(
576594
evaluation.model_dump(),

0 commit comments

Comments
 (0)