Files
wehub-resource-sync 925e56bb5f
Unit tests / build (t4_gpu) (push) Has been cancelled
Unit tests / build (ubuntu-latest) (push) Has been cancelled
Unit tests / build (windows-latest) (push) Has been cancelled
Test CLI scripts / build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:24:56 +08:00

45 lines
1.3 KiB
Python

"""Surya2 layout labels emitted by the model + canonicalization to surya's
public label vocabulary."""
# Canonical text-bearing labels — used by blank-region filters to decide
# which blocks may be dropped when their underlying image region is empty.
# Excludes Picture/Figure/Diagram/Table/Form/Equation/etc., which can legitimately
# contain whitespace or solid fills.
TEXT_LABELS = frozenset(
{
"Text",
"SectionHeader",
"PageHeader",
"PageFooter",
"Caption",
"Footnote",
"Code",
"Bibliography",
}
)
# Canonicalize raw model labels to public surya label names. Marker and other
# downstream consumers depend on these names.
LAYOUT_PRED_RELABEL = {
"Caption": "Caption",
"Footnote": "Footnote",
"Equation-Block": "Equation",
"List-Group": "ListGroup",
"Page-Header": "PageHeader",
"Page-Footer": "PageFooter",
"Image": "Picture",
"Section-Header": "SectionHeader",
"Table": "Table",
"Text": "Text",
"Complex-Block": "Figure",
"Code-Block": "Code",
"Form": "Form",
"Table-Of-Contents": "TableOfContents",
"Figure": "Figure",
"Chemical-Block": "ChemicalBlock",
"Diagram": "Diagram",
"Bibliography": "Bibliography",
"Blank-Page": "BlankPage",
}