Skip to content

Add Table structure evaluations for TEDS #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docling_eval/evaluators/table_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class TableEvaluation(UnitEvaluation):
table_id: int = -1
TEDS: float
is_complex: bool = False
structure_only_evaluation: bool = False

true_ncols: int = -1
pred_ncols: int = -1
Expand All @@ -42,6 +43,7 @@ class TableEvaluation(UnitEvaluation):

class DatasetTableEvaluation(DatasetEvaluation):
evaluations: List[TableEvaluation]
structure_only_evaluations: Optional[List[TableEvaluation]] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call the variable table_structure_evaluations and do not make it optional.


TEDS: DatasetStatistics
TEDS_struct: DatasetStatistics
Expand Down Expand Up @@ -228,6 +230,7 @@ def __call__(
evaluated_samples=len(table_evaluations),
rejected_samples=rejected_samples,
evaluations=table_evaluations,
structure_only_evaluations=table_struct_evaluations,
TEDS=compute_stats(teds_all),
TEDS_struct=compute_stats(teds_struct),
TEDS_simple=compute_stats(teds_simple),
Expand Down Expand Up @@ -297,6 +300,7 @@ def _evaluate_tables_in_documents(
pred_ncols=pred_table.data.num_cols,
true_nrows=true_table.data.num_rows,
pred_nrows=pred_table.data.num_rows,
structure_only_evaluation=structure_only,
)
table_evaluations.append(table_evaluation)
except Exception:
Expand Down