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-0.1.1.tar.gz (8.7 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-0.1.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: table_metrics-0.1.1.tar.gz
  • Upload date:
  • Size: 8.7 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-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3a2a2f75751f1b93c0992c7d03fce4ee9caa38590dea1a58513276e277da25d
MD5 d2c95f4e2048ccbb739404054574f0fc
BLAKE2b-256 7483edcc31409873195c19fc8cd25f741d2e574558dce657324feb488855200b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: table_metrics-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 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-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a763e8ac3f181647b6db456d3fc9c922cadf462fd824af1d648162157446469
MD5 6d6b9bbded32fcbb1eeac87a2dd5a58b
BLAKE2b-256 70cf510972b00d3a4314885697d0b828231e35535f8799018ceb000ebbe87127

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