H-ROTS
Adaptive Structural Inference and Hierarchical Semantic Path Serialization of Complex Tables for Retrieval-Augmented Generation
H-ROTS transforms complex HTML tables into semantic records and retrieval-ready text. It resolves hierarchical headers, merged cells, row labels and supported contextual transitions before indexing. No LLM calls, model training, GPU or embedding service are needed.
- FullPath: explicit hierarchical semantic paths.
- Compact: shared-prefix serialization with reconstruction of supported intermediate records.
- Python API and command-line interface; CPU-only preprocessing.
This main branch is the lightweight library. The paper branch contains the research implementation, evaluation datasets, experiments, results and limitations.
Installation
Python 3.10 or newer. Until the first PyPI release is published, install directly from GitHub:
python -m pip install "h-rots @ git+https://github.com/hallymgitoslab/H-ROTS.git@main"
After publication on PyPI:
python -m pip install h-rots
Quick start
from h_rots import parse, serialize, decode, convert
html = """
<table>
<thead>
<tr><th rowspan="2">Department</th><th colspan="2">2026</th></tr>
<tr><th>Applications</th><th>Admissions</th></tr>
</thead>
<tbody>
<tr><th>Computer Science</th><td>120</td><td>40</td></tr>
<tr><th>Mathematics</th><td>90</td><td>30</td></tr>
</tbody>
</table>
"""
records = parse(html)
print(serialize(records, mode="fullpath"))
compact = serialize(records, mode="compact")
print(compact)
assert decode(compact) == records
# Direct HTML-to-text conversion (also retains supported captions).
text = convert(html, mode="compact")
CLI
h-rots table.html --mode fullpath
h-rots table.html --mode compact -o table.compact.txt
h-rots table.compact.txt --mode decode -o records.json
h-rots table.html --mode json
python -m h_rots table.html --mode fullpath
Use - or omit the input path to read UTF-8 from stdin. The CLI's Compact mode serializes intermediate records without a caption so it can be decoded directly.
API
| Function | Purpose |
|---|---|
parse(html) |
Parse the first table to ordered semantic records. |
serialize(records, mode="fullpath") |
Serialize records as FullPath or Compact. |
decode(text) |
Reconstruct supported intermediate records from Compact. |
convert(html, mode="fullpath") |
Convert the first table to text, including supported captions. |
html_tables_to_markdown_text(html) |
Render multiple top-level tables with the research FullPath convenience function. |
Original research entry points are also exported from h_rots for migration. See API documentation and examples.
Design and scope
HTML → span-aware cell-origin grid → adaptive structural inference and context integration → intermediate records → FullPath / Compact → downstream chunking, indexing and retrieval.
The library does not implement retrieval, answer generation or general table reasoning. Heuristic inference can be ambiguous; Compact reconstructs supported intermediate records, not original HTML or visual layout. Token savings depend on the input. Process untrusted HTML with appropriate input size and resource limits in your application.
Research and citation
See the research branch for experimental protocols, quantitative results, citations and limitations. This library preserves the research core without algorithm changes. The original core comes from paper commit 39ab0685ccc71f6f08ff0f184ba703dec090eddb (blob ef5bbabbd1951d51cc86dc8d30077e597e06ef2b). A formal bibliographic citation will be added when available.
Development and release
python -m pip install -e .
python -m unittest discover -s tests -v
python -m pip install build twine
python -m build
python -m twine check dist/*
See release guide for PyPI Trusted Publishing. The existing research-only addon script is retained for repository history and is not installed by the library.
Acknowledgments (지원 및 사사)
본 과제(결과물)는 2026년도 교육부 및 강원특별자치도의 재원으로 강원앵커센터의 지원을 받아 수행된 지역성장 인재양성체계(앵커) 한림대학교 글로컬대학 30의 결과입니다.(2026-ANCHOR-10-009)
License
Original H-ROTS software and documentation are licensed under Apache-2.0. Third-party dependencies and datasets retain their respective licenses. Research data is not distributed in this package.
Metadata
Release files for h-rots 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| h_rots-0.1.0.tar.gz | 40.7 kB | With provenance | Details for h_rots-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| h_rots-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for h_rots-0.1.0-py3-none-any.whl |
Total release size: 71.4 kB
Release files / h_rots-0.1.0.tar.gz
| Download URL | h_rots-0.1.0.tar.gz |
|---|---|
| Size | 40.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
329cccb2e0ad62182542b8f35a5aad869fa6ff9f8c99187013f7d0e4b3ba108d
|
|
BLAKE2b-256 checksum How to use checksums |
9b5a61bf64c48e77db6264934dfcb3bfb633026aefb2af9908540149df0cc17b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / h_rots-0.1.0-py3-none-any.whl
| Download URL | h_rots-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92ac10af0270408687e55f6bc76c355c81a0f584c90be6ebee7d4a2dbf84afc0
|
|
BLAKE2b-256 checksum How to use checksums |
f78e65ffe0cd61ec9daf9100fee5dd6efaf0fcbf0f8db4d2fdec432524eac8ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for h-rots 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for h_rots-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.