Skip to content

Ordering API

Factory function and interface for reading order sorters.

Factory Function

from pipeline.layout.ordering import create_sorter, validate_combination

sorter = create_sorter("mineru-xycut")
validate_combination("doclayout-yolo", "mineru-xycut")  # Check compatibility

Sorter Protocol

from typing import Protocol
import numpy as np
from pipeline.types import Block

class Sorter(Protocol):
    def sort(self, blocks: list[Block], image: np.ndarray) -> list[Block]:
        """Sort blocks in reading order."""
        ...

Full API Reference

Detailed API reference coming soon. See Sorters for available sorters.