INNER CODE UNIT · Python
_xml_paths
mindee/doctr · doctr/cli/main.py:263
def _xml_paths(output: str, num_pages: int) -> list[Path]:
"""Build one output path per page, since hOCR describes a single page per file
Args:
output: the `--output` value
num_pages: the number of exported pages
Returns:
the list of paths to write to
"""
path = Path(output)
if num_pages <= 1:
return [path]
return [path.with_name(f"{path.stem}_page_{idx + 1}{path.suffix}") for idx in range(num_pages)]
def _save_results(result: Any, fmt: str, args: argparse.Namespace) -> None:
"""Export the predictions and write them to disk