James R. Barlow
1f493ba789
refactor: post-AI code cleanup
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
e1d976168c
feat: handle Pydantic serialization iterators in JSON serialization
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
60182ac8a8
fix: update JSON serialization tests to match default values
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow
53db7b384b
refactor: set default values for optional OCR configuration parameters
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
d77d63f1dc
feat: add JSON serialization tests for OCROptions in multiprocessing
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
ff250afa51
fix: add helper function to calculate effective JBIG2 page group size
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
cdb976db41
fix: handle None or zero jbig2_page_group_size in extract_images_jbig2
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
9535b52d06
fix: revert default option values to preserve original behavior
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: set default optimize value to 1 to prevent NoneType comparison
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
e1216eddb0
test: modify test_two_languages to use list of languages
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
21d69ffe87
fix: set default value for fast_web_view to prevent NoneType errors
...
This change ensures that `fast_web_view` always has a default value of 1.0, preventing the TypeError that was occurring in multiple test cases when trying to multiply `None` with an integer.
The modifications include:
1. Changing the type hint for `fast_web_view` from `float | None` to `float`
2. Setting a default value of 1.0
3. Adding a validation step in the `model_validator` to set the default value if not provided
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
3baeb83533
fix: Add compatibility for jpeg_quality and resolve strategy validation
...
This commit addresses several test failures by:
- Adding a compatibility property for `jpeg_quality`
- Changing default color conversion strategy from 'auto' to 'RGB'
- Ensuring `tesseract_config` is always a list
- Improving validation for color conversion and image compression strategies
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
134f4fcc28
fix: remove Union type hints and add default values in OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
a869a4ac42
fix: filter out None values from OCROptions kwargs
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
48a2fdb0f2
refactor: replace _kwargs_to_cmdline with direct OCROptions construction in experimental API functions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
91a2d39845
refactor: replace command line synthesis with direct OCROptions construction
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
3a0a7c546b
feat: Implement JSON serialization for OCROptions with safe handling of Path and stream objects
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
d0a46a0359
feat: convert CLI Namespace to OCROptions in main entry point
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
cb22a35834
refactor: convert hOCR API entry points to use OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
9ff7ab491c
fix: handle None jobs in hOCR pipeline concurrency
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
refactor: remove unused argparse import from pdf_to_hocr.py
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: import OCROptions in pdf_to_hocr pipeline
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: handle None jobs in hocr_to_ocr_pdf pipeline
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
0c3110857e
fix: add lossless_reconstruction to namespace options in PdfContext
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
aad90bcb54
fix: compute lossless_reconstruction when not present in options
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
5f685aef6e
fix: handle None jobs in concurrent processing
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
65b89cafde
fix: use available_cpu_count fallback for jobs in hOCR
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
eeda99636a
fix: handle Namespace conversion in PdfContext initialization
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
afc85333ac
feat: add OCROptions import and type hints to pipeline functions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
3987a610e1
fix: update pipeline setup to handle immutable OCROptions correctly
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
dab969f97d
refactor: update context management with OCROptions type hints
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow
480a8253eb
refactor: propagate lossless_reconstruction option to clean_options in PageContext
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
8a06dd478a
refactor: update pipeline functions to use OCROptions instead of argparse.Namespace
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
4dbd34f06a
refactor: update type hint for do_get_pdfinfo to accept generic options
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
8668cf4524
fix: add type conversion for pages in pipeline common
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:47 -08:00
James R. Barlow and aider
1d74c2831f
refactor: update pipeline entry points to use OCROptions directly
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
530186b468
docs: update documentation for OCROptions plugin interface migration
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
7b37f57b1c
refactor: replace Namespace with OCROptions in plugins and validation
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow
d4b7165d72
fix: resolve pickling issue with Pydantic validators in PageContext
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
Fix pickling issue
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
f5bfd2fd3e
Add compat function for pages_from_ranges
...
fix: handle Pydantic validation errors with correct exit code
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-21 12:21:46 -08:00
James R. Barlow and aider
7575dddefc
fix: add lossless_reconstruction attribute to OCROptions for compatibility
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: resolve recursion error in lossless_reconstruction option
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: ensure lossless_reconstruction attribute is added to Namespace
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
fix: ensure lossless_reconstruction attribute is correctly propagated to PageContext
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:49 -08:00
James R. Barlow and aider
66a3e8508e
feat: add comprehensive validators to OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
7bb3a97208
refactor: update test_validation.py to use Pydantic model validation
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
d2add01217
fix: remove deprecated set_lossless_reconstruction import and call
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
4476e81240
refactor: remove redundant validation functions from _validation.py
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
a373fcd649
fix: add jobs fallback in pipeline common
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:42:23 -08:00
James R. Barlow
87478bc240
Fix options.jpg_quality issue
2025-12-13 11:42:23 -08:00
James R. Barlow and aider
04ad78f01d
refactor: replace OptimizeOptions with OCROptions in tests
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:58 -08:00
James R. Barlow and aider
62c3ae80c7
fix: ensure pickling compatibility for OCROptions in multiprocessing
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:58 -08:00
James R. Barlow
d556014185
Remove language warning
2025-12-13 11:41:58 -08:00
James R. Barlow and aider
d18efcbbf1
fix: support flexible type inputs for pages and unpaper_args
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
f9a4a2e240
fix: handle missing input_file in OCROptions namespace conversion
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
5f89100dc3
test: add lossless_reconstruction field to OCROptions
...
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00
James R. Barlow and aider
1ef9aaf659
fix: Correct PDF/A part extraction and handle hOCR API output file
...
This commit addresses two issues:
1. Properly extract the PDF/A part from output_type
2. Add a placeholder output_file for hOCR API tests when output_folder is used
The changes include:
- Modifying `from_namespace` to add a placeholder output_file
- Updating PDF/A part extraction logic to handle different output_type formats
- Ensuring correct PDF/A part is passed to Ghostscript
Co-authored-by: aider (openrouter/anthropic/claude-sonnet-4) <aider@aider.chat >
2025-12-13 11:41:27 -08:00