Metadata-Version: 2.3
Name: table-metrics
Version: 1.0
Summary: Python library implementing GriTS and TEDS
Author: gu1show
Author-email: denissolovyov57@gmail.com
Requires-Python: >=3.13
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: apted (>=1.0.3,<2.0.0)
Requires-Dist: lxml (>=6.0.2,<7.0.0)
Requires-Dist: numpy (>=2.4.0,<3.0.0)
Requires-Dist: rapidfuzz (>=3.14.1,<4.0.0)
Description-Content-Type: text/markdown

# 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](https://arxiv.org/abs/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](https://arxiv.org/abs/2208.00385))

## Installation

```sh
pip install table-metrics
```

## Quick Start
```python
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](https://choosealicense.com/licenses/mit/)

