Spaces:
Running on Zero
Running on Zero
| """Parse a folder sequentially.""" | |
| from __future__ import annotations | |
| import argparse | |
| from pathlib import Path | |
| from zsgdp import parse_document | |
| def main() -> int: | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("input") | |
| parser.add_argument("output") | |
| args = parser.parse_args() | |
| input_dir = Path(args.input) | |
| output_dir = Path(args.output) | |
| output_dir.mkdir(parents=True, exist_ok=True) | |
| for path in sorted(item for item in input_dir.iterdir() if item.is_file()): | |
| parsed = parse_document(path, output_dir / path.stem) | |
| print(f"{path.name}: score={parsed.quality_report.score:.2f}") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |