Skip to content

Python library implementing GriTS and TEDS metrics for table extraction and table structure evaluation

License

Notifications You must be signed in to change notification settings

gu1show/table-metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table Metrics

Table Metrics is a Python library implementing evaluation metrics for table extraction and table structure recognition tasks.

Currently supported metrics:

  • GriTS - Grid Table Similarity (arXiv:2203.12555)

    • GriTS_Top – topology / structure similarity

    • GriTS_Con – cell content similarity

    • GriTS_Loc – spatial (layout) similarity using bounding boxes

  • TEDS – Tree Edit Distance-based Similarity (arXiv:2208.00385)

Installation

pip install table-metrics

Quick Start

from docling.document_converter import DocumentConverter
from table_metrics import (
    grits_top_score,
    grits_con_score,
    teds_score,
)


converter = DocumentConverter()
doc = converter.convert("your.pdf")

extracted_html_table = doc.document.tables[0].export_to_html()
true_html_table = (
    "<table><tr><td>We</td><td>love</td><td>open</td><td>source</td></tr></table>"
)

print("GriTS_Top:", grits_top_score(true_html_table, extracted_html_table))
print("GriTS_Con:", grits_con_score(true_html_table, extracted_html_table))
print("TEDS:", teds_score(true_html_table, extracted_html_table))

License

MIT

About

Python library implementing GriTS and TEDS metrics for table extraction and table structure evaluation

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages