Skip to main content

Python library implementing GriTS and TEDS

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

table_metrics-1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

table_metrics-1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file table_metrics-1.0.tar.gz.

File metadata

  • Download URL: table_metrics-1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.1 Windows/11

File hashes

Hashes for table_metrics-1.0.tar.gz
Algorithm Hash digest
SHA256 f230080999ace853447ea2ce08d6625a57c82e56de4e7d87d51c1d69683f87a8
MD5 59227be809bbf25ed734d91ed32e53f8
BLAKE2b-256 3c412d7be9b3edb3569b5395ccf73798ea4a027a69b9f4b8d2fbe331bcfbdcd2

See more details on using hashes here.

File details

Details for the file table_metrics-1.0-py3-none-any.whl.

File metadata

  • Download URL: table_metrics-1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.1 Windows/11

File hashes

Hashes for table_metrics-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ada2a48a452c04d47f6c57553727ab5cbd63aa19913e50a465a8150a5433c29
MD5 9333ac459165264c368422b4e5ac4258
BLAKE2b-256 37e50c47166f167884033f4ca4097fbe1b386ff2404b0ca911483d8a212fc8cb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page